Changeset 218000 in webkit


Ignore:
Timestamp:
Jun 9, 2017 10:59:18 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Add flag allow-popups-to-escape-sandbox to iframe sandbox
https://bugs.webkit.org/show_bug.cgi?id=158875

Patch by Frederic Wang <fwang@igalia.com> on 2017-06-09
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

Update expected results for iframe popup escaping tests.

  • web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1-expected.txt: This test passes.
  • web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2-expected.txt: This test passes.
  • web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3-expected.txt: Remove error message from text expectation.

Source/WebCore:

This patch adds support for the iframe@allow-popups-to-escape-sandbox attribute.
This allows to pass more W3C Web Platform tests.

Tests: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html

imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2.html

  • dom/SecurityContext.cpp: Add allow-popups-to-escape-sandbox flag.

(WebCore::SecurityContext::isSupportedSandboxPolicy):
(WebCore::SecurityContext::parseSandboxPolicy):

  • dom/SecurityContext.h: Ditto.
  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Do not force sandbox flags when we have allow-popups-to-escape-sandbox.
(WebCore::createWindow): Ditto.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r217973 r218000  
     12017-06-09  Frederic Wang  <fwang@igalia.com>
     2
     3        Add flag allow-popups-to-escape-sandbox to iframe sandbox
     4        https://bugs.webkit.org/show_bug.cgi?id=158875
     5
     6        Reviewed by Chris Dumez.
     7
     8        Update expected results for iframe popup escaping tests.
     9
     10        * web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1-expected.txt: This test passes.
     11        * web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2-expected.txt: This test passes.
     12        * web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3-expected.txt: Remove error message from text expectation.
     13
    1142017-06-09  Zan Dobersek  <zdobersek@igalia.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1-expected.txt

    r206999 r218000  
    1 CONSOLE MESSAGE: line 7: Error while parsing the 'sandbox' attribute: 'allow-popups-to-escape-sandbox' is an invalid sandbox flag.
    21
    32
    4 FAIL Check that popups from a sandboxed iframe escape the sandbox if
    5        allow-popups-to-escape-sandbox is used assert_equals: Should have escaped the sandbox expected "http://localhost:8800" but got "null"
     3PASS Check that popups from a sandboxed iframe escape the sandbox if
     4       allow-popups-to-escape-sandbox is used
    65
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2-expected.txt

    r206999 r218000  
    1 CONSOLE MESSAGE: line 7: Error while parsing the 'sandbox' attribute: 'allow-popups-to-escape-sandbox' is an invalid sandbox flag.
    21
    32
    4 FAIL Check that popups from a sandboxed iframe escape the sandbox if
    5        allow-popups-to-escape-sandbox is used assert_equals: Should have escaped the sandbox expected "http://localhost:8800" but got "null"
     3PASS Check that popups from a sandboxed iframe escape the sandbox if
     4       allow-popups-to-escape-sandbox is used
    65
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3-expected.txt

    r206999 r218000  
    1 CONSOLE MESSAGE: line 7: Error while parsing the 'sandbox' attribute: 'allow-popups-to-escape-sandbox' is an invalid sandbox flag.
    21CONSOLE MESSAGE: line 15: Unsafe JavaScript attempt to initiate navigation for frame with URL 'about:blank' from frame with URL 'http://localhost:8800/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_helper-3.html'. The frame attempting navigation is sandboxed, and is therefore disallowed from navigating its ancestors.
    32
  • trunk/Source/WebCore/ChangeLog

    r217999 r218000  
     12017-06-09  Frederic Wang  <fwang@igalia.com>
     2
     3        Add flag allow-popups-to-escape-sandbox to iframe sandbox
     4        https://bugs.webkit.org/show_bug.cgi?id=158875
     5
     6        Reviewed by Chris Dumez.
     7
     8        This patch adds support for the iframe@allow-popups-to-escape-sandbox attribute.
     9        This allows to pass more W3C Web Platform tests.
     10
     11        Tests: imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html
     12               imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-2.html
     13
     14        * dom/SecurityContext.cpp: Add allow-popups-to-escape-sandbox flag.
     15        (WebCore::SecurityContext::isSupportedSandboxPolicy):
     16        (WebCore::SecurityContext::parseSandboxPolicy):
     17        * dom/SecurityContext.h: Ditto.
     18        * loader/FrameLoader.cpp:
     19        (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Do not force sandbox flags when we have allow-popups-to-escape-sandbox.
     20        (WebCore::createWindow): Ditto.
     21
    1222017-06-09  Jer Noble  <jer.noble@apple.com>
    223
  • trunk/Source/WebCore/dom/SecurityContext.cpp

    r214203 r218000  
    8787{
    8888    static const char* const supportedPolicies[] = {
    89         "allow-forms", "allow-same-origin", "allow-scripts", "allow-top-navigation", "allow-pointer-lock", "allow-popups"
     89        "allow-forms", "allow-same-origin", "allow-scripts", "allow-top-navigation", "allow-pointer-lock", "allow-popups", "allow-popups-to-escape-sandbox"
    9090    };
    9191
     
    131131        else if (equalLettersIgnoringASCIICase(sandboxToken, "allow-pointer-lock"))
    132132            flags &= ~SandboxPointerLock;
     133        else if (equalLettersIgnoringASCIICase(sandboxToken, "allow-popups-to-escape-sandbox"))
     134            flags &= ~SandboxPropagatesToAuxiliaryBrowsingContexts;
    133135        else {
    134136            if (numberOfTokenErrors)
  • trunk/Source/WebCore/dom/SecurityContext.h

    r214203 r218000  
    5050    SandboxAutomaticFeatures    = 1 << 7,
    5151    SandboxPointerLock          = 1 << 8,
     52    SandboxPropagatesToAuxiliaryBrowsingContexts = 1 << 9,
    5253    SandboxAll                  = -1 // Mask with all bits set to 1.
    5354};
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r217774 r218000  
    31613161        return;
    31623162
    3163     mainFrame->loader().forceSandboxFlags(frame->loader().effectiveSandboxFlags());
     3163    SandboxFlags sandboxFlags = frame->loader().effectiveSandboxFlags();
     3164    if (sandboxFlags & SandboxPropagatesToAuxiliaryBrowsingContexts)
     3165        mainFrame->loader().forceSandboxFlags(sandboxFlags);
    31643166
    31653167    if (!equalIgnoringASCIICase(frameName, "_blank"))
     
    37053707    RefPtr<Frame> frame = &page->mainFrame();
    37063708
    3707     frame->loader().forceSandboxFlags(openerFrame.document()->sandboxFlags());
     3709    if (isDocumentSandboxed(openerFrame, SandboxPropagatesToAuxiliaryBrowsingContexts))
     3710        frame->loader().forceSandboxFlags(openerFrame.document()->sandboxFlags());
    37083711
    37093712    if (!equalIgnoringASCIICase(request.frameName(), "_blank"))
Note: See TracChangeset for help on using the changeset viewer.