Changeset 284758 in webkit


Ignore:
Timestamp:
Oct 24, 2021 9:01:14 AM (9 months ago)
Author:
Alexey Shvayka
Message:

document.open() and friends use incorrect document as a source for reseted document's URL
https://bugs.webkit.org/show_bug.cgi?id=230131

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

  • web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/origin-check-in-document-open-same-origin-domain.sub-expected.txt:
  • web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/url-entry-document-incumbent-frame.html: Added.
  • web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document-sync-call.window-expected.txt: Added.
  • web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document-sync-call.window.html: Added.
  • web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document-sync-call.window.js: Added.

Source/WebCore:

With this patch, Document's open() / write() / writeln() methods receive entry global
object's document [1] as an argument, which is used to perform same-origin security check
and to set the URL of reseted document from. Aligns WebKit with Blink and Gecko.

Instead of maintaining consistency with FirstWindow, EntryDocument is named to match
the spec and because it's not always the "first" (topmost) document, but rather a document
of closest <script> or inline event handler.

ResponsibleDocument is removed because it's now unused and, in terms of implementation,
a poor man's IncumbentWindow. Also, the spec describes different concept by that name [2].

[1] https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#opening-the-input-stream:entry-global-object
[2] https://html.spec.whatwg.org/multipage/webappapis.html#responsible-document

Tests: http/tests/security/aboutBlank/security-context-grandchildren-lexical.html

http/tests/security/aboutBlank/security-context-grandchildren-write-lexical.html
http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical.html
imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document-sync-call.window.html

  • bindings/js/JSDOMWindowBase.cpp:

(WebCore::responsibleDocument): Deleted.

  • bindings/js/JSDOMWindowBase.h:
  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateCallWith):

  • bindings/scripts/IDLAttributes.json:
  • dom/Document+HTML.idl:
  • dom/Document.cpp:

(WebCore::Document::open):
(WebCore::Document::write):
(WebCore::Document::writeln):

  • dom/Document.h:

LayoutTests:

  • http/tests/security/aboutBlank/security-context-grandchildren-lexical.html:
  • http/tests/security/aboutBlank/security-context-grandchildren-write-lexical.html:
  • http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical.html:

Tweak javascript: URLs to evaluate as undefined so the tests could be run in Firefox.

  • http/tests/security/aboutBlank/security-context-grandchildren-lexical-expected.txt:
  • http/tests/security/aboutBlank/security-context-grandchildren-write-lexical-expected.txt:
  • http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical-expected.txt:

Align expectations with Blink and Gecko.

  • http/tests/security/resources/parent-document-open.html: Added.
  • http/tests/security/xss-DENIED-xsl-document-securityOrigin.xml:

The test relied on behavior that wasn't spec-compliant, causing timeouts once document.open() is fixed.
This patch preserves the test semantics of calling document.open() with iframe's global object.
Similar Blink bug: crbug.com/579493.

Location:
trunk
Files:
5 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r284754 r284758  
     12021-10-24  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        document.open() and friends use incorrect document as a source for reseted document's URL
     4        https://bugs.webkit.org/show_bug.cgi?id=230131
     5
     6        Reviewed by Chris Dumez.
     7
     8        * http/tests/security/aboutBlank/security-context-grandchildren-lexical.html:
     9        * http/tests/security/aboutBlank/security-context-grandchildren-write-lexical.html:
     10        * http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical.html:
     11        Tweak javascript: URLs to evaluate as `undefined` so the tests could be run in Firefox.
     12
     13        * http/tests/security/aboutBlank/security-context-grandchildren-lexical-expected.txt:
     14        * http/tests/security/aboutBlank/security-context-grandchildren-write-lexical-expected.txt:
     15        * http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical-expected.txt:
     16        Align expectations with Blink and Gecko.
     17
     18        * http/tests/security/resources/parent-document-open.html: Added.
     19        * http/tests/security/xss-DENIED-xsl-document-securityOrigin.xml:
     20        The test relied on behavior that wasn't spec-compliant, causing timeouts once document.open() is fixed.
     21        This patch preserves the test semantics of calling document.open() with iframe's global object.
     22        Similar Blink bug: crbug.com/579493.
     23
    1242021-10-23  Rob Buis  <rbuis@igalia.com>
    225
  • trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-lexical-expected.txt

    r280491 r284758  
    1212--- After document.open() ---
    1313* "about:blank"
    14 document.URL = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    15 document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    16 document.cookie = cookie=resources; cookie=parent
     14document.URL = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-lexical.html
     15document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-lexical.html
     16document.cookie = cookie=parent
    1717* ""
    18 document.URL = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    19 document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    20 document.cookie = cookie=resources; cookie=parent
     18document.URL = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-lexical.html
     19document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-lexical.html
     20document.cookie = cookie=parent
    2121--- After document.close() ---
    2222* "about:blank"
    23 document.URL = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    24 document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    25 document.cookie = cookie=resources; cookie=parent
     23document.URL = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-lexical.html
     24document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-lexical.html
     25document.cookie = cookie=parent
    2626* ""
    27 document.URL = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    28 document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    29 document.cookie = cookie=resources; cookie=parent
     27document.URL = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-lexical.html
     28document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-lexical.html
     29document.cookie = cookie=parent
    3030--- Test ends ---
  • trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-lexical.html

    r120174 r284758  
    2727      "window.myclose = function(i) { frames[i].document.close(); };" +
    2828      "parent.log('Helpers loaded!\\n');" +
    29       "parent.setTimeout('continueTest()', 10);";
     29      "parent.setTimeout('continueTest()', 10); undefined;";
    3030}
    3131
  • trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-write-lexical-expected.txt

    r280491 r284758  
    1212--- After document.open() ---
    1313* "about:blank"
    14 document.URL = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    15 document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    16 document.cookie = cookie=resources; cookie=parent
     14document.URL = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-write-lexical.html
     15document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-write-lexical.html
     16document.cookie = cookie=parent
    1717* ""
    18 document.URL = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    19 document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    20 document.cookie = cookie=resources; cookie=parent
     18document.URL = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-write-lexical.html
     19document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-write-lexical.html
     20document.cookie = cookie=parent
    2121--- After document.close() ---
    2222* "about:blank"
    23 document.URL = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    24 document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    25 document.cookie = cookie=resources; cookie=parent
     23document.URL = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-write-lexical.html
     24document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-write-lexical.html
     25document.cookie = cookie=parent
    2626* ""
    27 document.URL = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    28 document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    29 document.cookie = cookie=resources; cookie=parent
     27document.URL = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-write-lexical.html
     28document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-write-lexical.html
     29document.cookie = cookie=parent
    3030--- Test ends ---
  • trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-write-lexical.html

    r120174 r284758  
    2727      "window.myclose = function(i) { frames[i].document.close(); };" +
    2828      "parent.log('Helpers loaded!\\n');" +
    29       "parent.setTimeout('continueTest()', 10);";
     29      "parent.setTimeout('continueTest()', 10); undefined;";
    3030}
    3131
  • trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical-expected.txt

    r280491 r284758  
    1212--- After document.open() ---
    1313* "about:blank"
    14 document.URL = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    15 document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    16 document.cookie = cookie=resources; cookie=parent
     14document.URL = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-writeln-lexical.html
     15document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-writeln-lexical.html
     16document.cookie = cookie=parent
    1717* ""
    18 document.URL = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    19 document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    20 document.cookie = cookie=resources; cookie=parent
     18document.URL = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-writeln-lexical.html
     19document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-writeln-lexical.html
     20document.cookie = cookie=parent
    2121--- After document.close() ---
    2222* "about:blank"
    23 document.URL = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    24 document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    25 document.cookie = cookie=resources; cookie=parent
     23document.URL = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-writeln-lexical.html
     24document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-writeln-lexical.html
     25document.cookie = cookie=parent
    2626* ""
    27 document.URL = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    28 document.baseURI = http://127.0.0.1:8000/security/aboutBlank/resources/iframe-with-about-blank-children.html
    29 document.cookie = cookie=resources; cookie=parent
     27document.URL = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-writeln-lexical.html
     28document.baseURI = http://127.0.0.1:8000/security/aboutBlank/security-context-grandchildren-writeln-lexical.html
     29document.cookie = cookie=parent
    3030--- Test ends ---
  • trunk/LayoutTests/http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical.html

    r120174 r284758  
    2727      "window.myclose = function(i) { frames[i].document.close(); };" +
    2828      "parent.log('Helpers loaded!\\n');" +
    29       "parent.setTimeout('continueTest()', 10);";
     29      "parent.setTimeout('continueTest()', 10); undefined;";
    3030}
    3131
  • trunk/LayoutTests/http/tests/security/xss-DENIED-xsl-document-securityOrigin.xml

    r282103 r284758  
    1818        victim.src = "http://localhost:8080/security/resources/innocent-victim.html";
    1919        victim.onload = function() { wnd.eval("location = '" + location + "'"); }
    20     } else if (location != "about:blank") {
     20    } else if (!location.href.includes("parent-document-open.html")) {
    2121        url = location.href;
    22         blank = document.body.appendChild(document.createElement("iframe"));
    23         blank.contentWindow.eval("parent.document.open()");
     22        var parentDocOpen = document.createElement("iframe");
     23        parentDocOpen.src = "resources/parent-document-open.html";
     24        document.body.append(parentDocOpen);
     25        setTimeout(() => {
    2426        location = "javascript:(\"\x3C?xml-stylesheet type='text/xsl' href='" + url + "'?\x3E\x3Croot/\x3E\")";
     27        }, 150);
    2528    } else {
    2629        try {
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r284752 r284758  
     12021-10-24  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        document.open() and friends use incorrect document as a source for reseted document's URL
     4        https://bugs.webkit.org/show_bug.cgi?id=230131
     5
     6        Reviewed by Chris Dumez.
     7
     8        * web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/origin-check-in-document-open-same-origin-domain.sub-expected.txt:
     9        * web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/url-entry-document-incumbent-frame.html: Added.
     10        * web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document-sync-call.window-expected.txt: Added.
     11        * web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document-sync-call.window.html: Added.
     12        * web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document-sync-call.window.js: Added.
     13
    1142021-10-23  Cameron McCormack  <heycam@apple.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/origin-check-in-document-open-same-origin-domain.sub-expected.txt

    r264035 r284758  
    11
    2 FAIL It should not be possible to open same origin-domain (but not same origin) documents. assert_throws_dom: Opening a same origin-domain (but not same origin) document doesn't throw. function "function open() {
    3     [native code]
    4 }" did not throw
    5 FAIL It should not be possible to implicitly open same origin-domain (but not same origin) documents. assert_throws_dom: Implicitly opening a same origin-domain (but not same origin) document doesn't throw. function "function write() {
    6     [native code]
    7 }" did not throw
     2PASS It should not be possible to open same origin-domain (but not same origin) documents.
     3PASS It should not be possible to implicitly open same origin-domain (but not same origin) documents.
    84
  • trunk/Source/WebCore/ChangeLog

    r284755 r284758  
     12021-10-24  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        document.open() and friends use incorrect document as a source for reseted document's URL
     4        https://bugs.webkit.org/show_bug.cgi?id=230131
     5
     6        Reviewed by Chris Dumez.
     7
     8        With this patch, Document's open() / write() / writeln() methods receive entry global
     9        object's document [1] as an argument, which is used to perform same-origin security check
     10        and to set the URL of reseted document from. Aligns WebKit with Blink and Gecko.
     11
     12        Instead of maintaining consistency with FirstWindow, EntryDocument is named to match
     13        the spec and because it's not always the "first" (topmost) document, but rather a document
     14        of closest <script> or inline event handler.
     15
     16        ResponsibleDocument is removed because it's now unused and, in terms of implementation,
     17        a poor man's IncumbentWindow. Also, the spec describes different concept by that name [2].
     18
     19        [1] https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#opening-the-input-stream:entry-global-object
     20        [2] https://html.spec.whatwg.org/multipage/webappapis.html#responsible-document
     21
     22        Tests: http/tests/security/aboutBlank/security-context-grandchildren-lexical.html
     23               http/tests/security/aboutBlank/security-context-grandchildren-write-lexical.html
     24               http/tests/security/aboutBlank/security-context-grandchildren-writeln-lexical.html
     25               imported/w3c/web-platform-tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document-sync-call.window.html
     26
     27        * bindings/js/JSDOMWindowBase.cpp:
     28        (WebCore::responsibleDocument): Deleted.
     29        * bindings/js/JSDOMWindowBase.h:
     30        * bindings/scripts/CodeGeneratorJS.pm:
     31        (GenerateCallWith):
     32        * bindings/scripts/IDLAttributes.json:
     33        * dom/Document+HTML.idl:
     34        * dom/Document.cpp:
     35        (WebCore::Document::open):
     36        (WebCore::Document::write):
     37        (WebCore::Document::writeln):
     38        * dom/Document.h:
     39
    1402021-10-24  Rob Buis  <rbuis@igalia.com>
    241
  • trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp

    r284516 r284758  
    338338}
    339339
    340 Document* responsibleDocument(VM& vm, CallFrame& callFrame)
    341 {
    342     CallerFunctor functor;
    343     callFrame.iterate(vm, functor);
    344     auto* callerFrame = functor.callerFrame();
    345     if (!callerFrame)
    346         return nullptr;
    347     return asJSDOMWindow(callerFrame->lexicalGlobalObject(vm))->wrapped().document();
    348 }
    349 
    350340void JSDOMWindowBase::fireFrameClearedWatchpointsForWindow(DOMWindow* window)
    351341{
  • trunk/Source/WebCore/bindings/js/JSDOMWindowBase.h

    r284080 r284758  
    132132DOMWindow& legacyActiveDOMWindowForAccessor(JSC::JSGlobalObject&);
    133133
    134 // FIXME: This should probably be removed in favor of one of the other DOMWindow accessors. It is intended
    135 //        to provide the document specfied as the 'responsible document' in the algorithm for document.open()
    136 //        (https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#document-open-steps steps 4
    137 //        and 23 and https://html.spec.whatwg.org/multipage/webappapis.html#responsible-document). It is only
    138 //        used by JSDocument.
    139 Document* responsibleDocument(JSC::VM&, JSC::CallFrame&);
    140 
    141134} // namespace WebCore
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r284241 r284758  
    59665966        push(@callWithArgs, "*incumbentDocument");
    59675967    }
    5968     if ($codeGenerator->ExtendedAttributeContains($callWith, "ResponsibleDocument")) {
     5968    if ($codeGenerator->ExtendedAttributeContains($callWith, "EntryDocument")) {
    59695969        AddToImplIncludes("DOMWindow.h");
    59705970        AddToImplIncludes("JSDOMWindowBase.h");
    5971         push(@callWithArgs, "responsibleDocument(${globalObject}->vm(), $callFrameReference)");
     5971        push(@callWithArgs, "firstDOMWindow(*$globalObject).document()");
    59725972    }
    59735973    if ($codeGenerator->ExtendedAttributeContains($callWith, "ActiveWindow")) {
  • trunk/Source/WebCore/bindings/scripts/IDLAttributes.json

    r284241 r284758  
    5252        "CallWith": {
    5353            "contextsAllowed": ["attribute", "operation"],
    54             "values": ["Document", "ExecState", "ScriptExecutionContext", "GlobalObject", "ActiveWindow", "FirstWindow", "ResponsibleDocument", "World", "PropertyName"],
     54            "values": ["Document", "ExecState", "ScriptExecutionContext", "GlobalObject", "ActiveWindow", "FirstWindow", "EntryDocument", "World", "PropertyName"],
    5555            "supportsConjunction": true
    5656        },
  • trunk/Source/WebCore/dom/Document+HTML.idl

    r274832 r284758  
    5959    // that the caller document matches those semantics. It is possible we should replace it with
    6060    // the existing 'incumbent document' concept.
    61     [CEReactions, CallWith=ResponsibleDocument, ImplementedAs=openForBindings] Document open(optional DOMString unused1, optional DOMString unused2); // both arguments are ignored.
     61    [CEReactions, CallWith=EntryDocument, ImplementedAs=openForBindings] Document open(optional DOMString unused1, optional DOMString unused2); // both arguments are ignored.
    6262    [CallWith=ActiveWindow&FirstWindow, ImplementedAs=openForBindings] WindowProxy open(USVString url, DOMString name, DOMString features);
    6363    [CEReactions, ImplementedAs=closeForBindings] undefined close();
    64     [CEReactions, CallWith=ResponsibleDocument] undefined write(DOMString... text);
    65     [CEReactions, CallWith=ResponsibleDocument] undefined writeln(DOMString... text);
     64    [CEReactions, CallWith=EntryDocument] undefined write(DOMString... text);
     65    [CEReactions, CallWith=EntryDocument] undefined writeln(DOMString... text);
    6666
    6767    // user interaction
  • trunk/Source/WebCore/dom/Document.cpp

    r284693 r284758  
    29182918}
    29192919
    2920 ExceptionOr<Document&> Document::openForBindings(Document* responsibleDocument, const String&, const String&)
     2920ExceptionOr<Document&> Document::openForBindings(Document* entryDocument, const String&, const String&)
    29212921{
    29222922    if (!isHTMLDocument() || m_throwOnDynamicMarkupInsertionCount)
    29232923        return Exception { InvalidStateError };
    29242924
    2925     auto result = open(responsibleDocument);
     2925    auto result = open(entryDocument);
    29262926    if (UNLIKELY(result.hasException()))
    29272927        return result.releaseException();
     
    29302930}
    29312931
    2932 ExceptionOr<void> Document::open(Document* responsibleDocument)
    2933 {
    2934     if (responsibleDocument && !responsibleDocument->securityOrigin().isSameOriginAs(securityOrigin()))
     2932ExceptionOr<void> Document::open(Document* entryDocument)
     2933{
     2934    if (entryDocument && !entryDocument->securityOrigin().isSameOriginAs(securityOrigin()))
    29352935        return Exception { SecurityError };
    29362936
     
    29612961    removeAllEventListeners();
    29622962
    2963     if (responsibleDocument && isFullyActive()) {
    2964         auto newURL = responsibleDocument->url();
    2965         if (responsibleDocument != this)
     2963    if (entryDocument && isFullyActive()) {
     2964        auto newURL = entryDocument->url();
     2965        if (entryDocument != this)
    29662966            newURL.removeFragmentIdentifier();
    29672967        setURL(newURL);
    2968         auto newCookieURL = responsibleDocument->cookieURL();
    2969         if (responsibleDocument != this)
     2968        auto newCookieURL = entryDocument->cookieURL();
     2969        if (entryDocument != this)
    29702970            newCookieURL.removeFragmentIdentifier();
    29712971        setCookieURL(newCookieURL);
    2972         setSecurityOriginPolicy(responsibleDocument->securityOriginPolicy());
     2972        setSecurityOriginPolicy(entryDocument->securityOriginPolicy());
    29732973    }
    29742974
     
    33093309}
    33103310
    3311 ExceptionOr<void> Document::write(Document* responsibleDocument, SegmentedString&& text)
     3311ExceptionOr<void> Document::write(Document* entryDocument, SegmentedString&& text)
    33123312{
    33133313    if (m_activeParserWasAborted)
     
    33273327
    33283328    if (!hasInsertionPoint) {
    3329         auto result = open(responsibleDocument);
     3329        auto result = open(entryDocument);
    33303330        if (UNLIKELY(result.hasException()))
    33313331            return result.releaseException();
     
    33373337}
    33383338
    3339 ExceptionOr<void> Document::write(Document* responsibleDocument, Vector<String>&& strings)
     3339ExceptionOr<void> Document::write(Document* entryDocument, Vector<String>&& strings)
    33403340{
    33413341    if (!isHTMLDocument() || m_throwOnDynamicMarkupInsertionCount)
     
    33463346        text.append(WTFMove(string));
    33473347
    3348     return write(responsibleDocument, WTFMove(text));
    3349 }
    3350 
    3351 ExceptionOr<void> Document::writeln(Document* responsibleDocument, Vector<String>&& strings)
     3348    return write(entryDocument, WTFMove(text));
     3349}
     3350
     3351ExceptionOr<void> Document::writeln(Document* entryDocument, Vector<String>&& strings)
    33523352{
    33533353    if (!isHTMLDocument() || m_throwOnDynamicMarkupInsertionCount)
     
    33593359
    33603360    text.append("\n"_s);
    3361     return write(responsibleDocument, WTFMove(text));
     3361    return write(entryDocument, WTFMove(text));
    33623362}
    33633363
  • trunk/Source/WebCore/dom/Document.h

    r284528 r284758  
    669669
    670670    WEBCORE_EXPORT ExceptionOr<RefPtr<WindowProxy>> openForBindings(DOMWindow& activeWindow, DOMWindow& firstDOMWindow, const String& url, const AtomString& name, const String& features);
    671     WEBCORE_EXPORT ExceptionOr<Document&> openForBindings(Document* responsibleDocument, const String&, const String&);
     671    WEBCORE_EXPORT ExceptionOr<Document&> openForBindings(Document* entryDocument, const String&, const String&);
    672672
    673673    // FIXME: We should rename this at some point and give back the name 'open' to the HTML specified ones.
    674     WEBCORE_EXPORT ExceptionOr<void> open(Document* responsibleDocument = nullptr);
     674    WEBCORE_EXPORT ExceptionOr<void> open(Document* entryDocument = nullptr);
    675675    void implicitOpen();
    676676
     
    688688    void cancelParsing();
    689689
    690     ExceptionOr<void> write(Document* responsibleDocument, SegmentedString&&);
    691     WEBCORE_EXPORT ExceptionOr<void> write(Document* responsibleDocument, Vector<String>&&);
    692     WEBCORE_EXPORT ExceptionOr<void> writeln(Document* responsibleDocument, Vector<String>&&);
     690    ExceptionOr<void> write(Document* entryDocument, SegmentedString&&);
     691    WEBCORE_EXPORT ExceptionOr<void> write(Document* entryDocument, Vector<String>&&);
     692    WEBCORE_EXPORT ExceptionOr<void> writeln(Document* entryDocument, Vector<String>&&);
    693693
    694694    bool wellFormed() const { return m_wellFormed; }
Note: See TracChangeset for help on using the changeset viewer.