WebCore:

2008-12-22  Julien Chaffraix  <jchaffraix@webkit.org>

        Reviewed by Darin Adler.

        Bug 11106: Some XMLHttpRequest URI resolving tests fail
        https://bugs.webkit.org/show_bug.cgi?id=11106

        Use the ScriptExecutionContext to resolve the URI when calling open in JavaScript.
        The previous code was using the containing DOMWindow to do so which would fail for
        XMLHttpRequest object being passed between iframe.

        Tests: http/tests/xmlhttprequest/uri-resolution-opera-open-004.html
               http/tests/xmlhttprequest/uri-resolution-opera-open-005.html
               http/tests/xmlhttprequest/uri-resolution-opera-open-006.html
               http/tests/xmlhttprequest/uri-resolution-opera-open-007.html
               http/tests/xmlhttprequest/uri-resolution-opera-open-008.html
               http/tests/xmlhttprequest/uri-resolution-opera-open-009.html
               http/tests/xmlhttprequest/uri-resolution-opera-open-010.html

        * bindings/js/JSXMLHttpRequestCustom.cpp:
        (WebCore::JSXMLHttpRequest::open): Use the ScriptExecutionContext
        to resolve the URL.

        * dom/Document.cpp:
        (WebCore::Document::virtualCompleteURL): Virtual method added to
        avoid performance hit on completeURL call.

        * dom/Document.h:
        * dom/ScriptExecutionContext.h:
        (WebCore::ScriptExecutionContext::completeURL): Non-virtual method
        that wrap the call to the virtual call.
        * dom/WorkerContext.cpp:
        (WebCore::WorkerContext::virtualCompleteURL): Pure virtual method.
        * dom/WorkerContext.h:

LayoutTests:

2008-12-22  Julien Chaffraix  <jchaffraix@webkit.org>

        Reviewed by Darin Adler.

        Test case for bug 11106: Some XMLHttpRequest URI resolving tests fail
        https://bugs.webkit.org/show_bug.cgi?id=11106

        These tests are borrowed from Opera's test case suite (http://tc.labs.opera.com/apis/XMLHttpRequest).
        They correspond to open/004.html - open/010.html which were previously failing.

        * http/tests/xmlhttprequest/resources/test-uri-resolution.txt: Added.
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-004-iframe.html: Added.
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-005-iframe.html: Added.
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-006-iframe.html: Added.
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-007-iframe.html: Added.
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-008-iframe.html: Added.
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-009-iframe.html: Added.
        * http/tests/xmlhttprequest/resources/uri-resolution-opera-open-010-iframe.html: Added.
        * http/tests/xmlhttprequest/test-uri-resolution.txt: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-004-expected.txt: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-004.html: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-005-expected.txt: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-005.html: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-006-expected.txt: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-006.html: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-007-expected.txt: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-007.html: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-008-expected.txt: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-008.html: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-009-expected.txt: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-009.html: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-010-expected.txt: Added.
        * http/tests/xmlhttprequest/uri-resolution-opera-open-010.html: Added.




git-svn-id: http://svn.webkit.org/repository/webkit/trunk@39453 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed