Changeset 156130 in webkit


Ignore:
Timestamp:
Sep 19, 2013 4:19:56 PM (11 years ago)
Author:
ap@apple.com
Message:

Layout Test http/tests/security/canvas-remote-read-remote-image-redirect.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=121458

Reviewed by Sam Weinig.

Source/WebCore:

The code to automagically produce line numbers is quite fragile. Added some FIXMEs,
and added an issue that was making reporting flaky for code is JS event handlers
executed while parsing was paused.

  • page/PageConsole.cpp: (WebCore::PageConsole::addMessage): Use actual "script is

running" check instead of "parsing a script element" one.

LayoutTests:

  • fast/frames/sandboxed-iframe-attribute-parsing-06-expected.txt:
  • fast/frames/sandboxed-iframe-attribute-parsing-07-expected.txt:
  • fast/frames/sandboxed-iframe-attribute-parsing-08-expected.txt:
  • fast/frames/sandboxed-iframe-attribute-parsing-09-expected.txt:
  • fast/frames/sandboxed-iframe-attribute-parsing-10-expected.txt:
  • fast/frames/sandboxed-iframe-attribute-parsing-11-expected.txt:
  • fast/frames/sandboxed-iframe-attribute-parsing-12-expected.txt:
  • fast/frames/sandboxed-iframe-attribute-parsing-13-expected.txt:
  • fast/frames/sandboxed-iframe-attribute-parsing-14-expected.txt:
  • fast/frames/sandboxed-iframe-parsing-space-characters-expected.txt:
  • fast/frames/sandboxed-iframe-scripting-04-expected.txt:
  • http/tests/security/contentSecurityPolicy/sandbox-empty-expected.txt:
  • http/tests/security/contentSecurityPolicy/sandbox-empty-subframe-expected.txt:
  • http/tests/security/contentSecurityPolicy/sandbox-in-http-header-control-expected.txt:
  • http/tests/security/contentSecurityPolicy/sandbox-in-http-header-expected.txt:
  • http/tests/security/contentSecurityPolicy/sandbox-invalid-header-expected.txt:
  • http/tests/security/isolatedWorld/sandboxed-iframe-expected.txt:
  • media/video-controls-no-scripting-expected.txt:

We now get a line number for blocked inline scripts, which is a progression.
It is the line number for the closing </script>, which is not ideal, but better
than nothing.

  • http/tests/security/mixedContent/insecure-script-in-iframe-expected.txt:
  • http/tests/security/mixedContent/redirect-http-to-https-script-in-iframe-expected.txt:

Also a progression - we now get a line number for offending <script>.

Location:
trunk
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r156116 r156130  
     12013-09-19  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Layout Test http/tests/security/canvas-remote-read-remote-image-redirect.html is flaky
     4        https://bugs.webkit.org/show_bug.cgi?id=121458
     5
     6        Reviewed by Sam Weinig.
     7
     8        * fast/frames/sandboxed-iframe-attribute-parsing-06-expected.txt:
     9        * fast/frames/sandboxed-iframe-attribute-parsing-07-expected.txt:
     10        * fast/frames/sandboxed-iframe-attribute-parsing-08-expected.txt:
     11        * fast/frames/sandboxed-iframe-attribute-parsing-09-expected.txt:
     12        * fast/frames/sandboxed-iframe-attribute-parsing-10-expected.txt:
     13        * fast/frames/sandboxed-iframe-attribute-parsing-11-expected.txt:
     14        * fast/frames/sandboxed-iframe-attribute-parsing-12-expected.txt:
     15        * fast/frames/sandboxed-iframe-attribute-parsing-13-expected.txt:
     16        * fast/frames/sandboxed-iframe-attribute-parsing-14-expected.txt:
     17        * fast/frames/sandboxed-iframe-parsing-space-characters-expected.txt:
     18        * fast/frames/sandboxed-iframe-scripting-04-expected.txt:
     19        * http/tests/security/contentSecurityPolicy/sandbox-empty-expected.txt:
     20        * http/tests/security/contentSecurityPolicy/sandbox-empty-subframe-expected.txt:
     21        * http/tests/security/contentSecurityPolicy/sandbox-in-http-header-control-expected.txt:
     22        * http/tests/security/contentSecurityPolicy/sandbox-in-http-header-expected.txt:
     23        * http/tests/security/contentSecurityPolicy/sandbox-invalid-header-expected.txt:
     24        * http/tests/security/isolatedWorld/sandboxed-iframe-expected.txt:
     25        * media/video-controls-no-scripting-expected.txt:
     26        We now get a line number for blocked inline scripts, which is a progression.
     27        It is the line number for the closing </script>, which is not ideal, but better
     28        than nothing.
     29
     30        * http/tests/security/mixedContent/insecure-script-in-iframe-expected.txt:
     31        * http/tests/security/mixedContent/redirect-http-to-https-script-in-iframe-expected.txt:
     32        Also a progression - we now get a line number for offending <script>.
     33
    1342013-09-19  Bear Travis  <betravis@adobe.com>
    235
  • trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-06-expected.txt

    r138625 r156130  
    11CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'allowscripts' is an invalid sandbox flag.
    2 CONSOLE MESSAGE: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     2CONSOLE MESSAGE: line 4: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    33Misspelling.
    44
  • trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-07-expected.txt

    r138625 r156130  
    11CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'allows-cripts' is an invalid sandbox flag.
    2 CONSOLE MESSAGE: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     2CONSOLE MESSAGE: line 4: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    33Misspelling.
    44
  • trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-08-expected.txt

    r138625 r156130  
    11CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: '-allow-scripts' is an invalid sandbox flag.
    2 CONSOLE MESSAGE: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     2CONSOLE MESSAGE: line 4: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    33Misspelling.
    44
  • trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-09-expected.txt

    r138625 r156130  
    11CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'allow_scripts' is an invalid sandbox flag.
    2 CONSOLE MESSAGE: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     2CONSOLE MESSAGE: line 4: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    33Misspelling.
    44
  • trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-10-expected.txt

    r138625 r156130  
    11CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'allowScripts' is an invalid sandbox flag.
    2 CONSOLE MESSAGE: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     2CONSOLE MESSAGE: line 4: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    33Misspelling.
    44
  • trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-11-expected.txt

    r138625 r156130  
    11CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'aallow-scripts' is an invalid sandbox flag.
    2 CONSOLE MESSAGE: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     2CONSOLE MESSAGE: line 4: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    33Misspelling.
    44
  • trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-12-expected.txt

    r138625 r156130  
    11CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'allow-scriptss' is an invalid sandbox flag.
    2 CONSOLE MESSAGE: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     2CONSOLE MESSAGE: line 4: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    33Misspelling.
    44
  • trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-13-expected.txt

    r138625 r156130  
    11CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'allow-script' is an invalid sandbox flag.
    2 CONSOLE MESSAGE: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     2CONSOLE MESSAGE: line 4: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    33Misspelling.
    44
  • trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-14-expected.txt

    r138625 r156130  
    1 CONSOLE MESSAGE: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     1CONSOLE MESSAGE: line 4: Blocked script execution in 'sandboxed-iframe-attribute-parsing-disallowed.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    22Full sandbox.
    33
  • trunk/LayoutTests/fast/frames/sandboxed-iframe-parsing-space-characters-expected.txt

    r137180 r156130  
    22CONSOLE MESSAGE: Error while parsing the 'sandbox' attribute: 'allow-scripts
    33allow-forms' is an invalid sandbox flag.
    4 CONSOLE MESSAGE: Blocked script execution in 'data:text/html,<script>alert('FAIL: Vertical tab is not a delimiter.');</script>' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     4CONSOLE MESSAGE: line 1: Blocked script execution in 'data:text/html,<script>alert('FAIL: Vertical tab is not a delimiter.');</script>' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    55ALERT: PASS: Newline is a delimiter.
    66ALERT: PASS: Return is a delimiter.
    77CONSOLE MESSAGE: Error while parsing the 'sandbox' attribute: 'allow-scriptsxallow-forms' is an invalid sandbox flag.
    8 CONSOLE MESSAGE: Blocked script execution in 'data:text/html,<script>alert('FAIL: x is not a delimiter.');</script>' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     8CONSOLE MESSAGE: line 1: Blocked script execution in 'data:text/html,<script>alert('FAIL: x is not a delimiter.');</script>' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    99ALERT: PASS: Tab is a delimiter.
    1010ALERT: PASS: Space is a delimiter character.
  • trunk/LayoutTests/fast/frames/sandboxed-iframe-scripting-04-expected.txt

    r145993 r156130  
    1 CONSOLE MESSAGE: Blocked script execution in 'data:text/html,<script>alert('FAIL: Executed script without allow-scripts in data URL');window.parent.postMessage({'fail': true}, '*');</script>' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     1CONSOLE MESSAGE: line 1: Blocked script execution in 'data:text/html,<script>alert('FAIL: Executed script without allow-scripts in data URL');window.parent.postMessage({'fail': true}, '*');</script>' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    22Verify that sandboxed frames without sandbox='allow-scripts' cannot execute script from data: URLs.
    33
  • trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-empty-expected.txt

    r137180 r156130  
    1 CONSOLE MESSAGE: Blocked script execution in 'http://127.0.0.1:8000/security/contentSecurityPolicy/sandbox-empty.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     1CONSOLE MESSAGE: line 9: Blocked script execution in 'http://127.0.0.1:8000/security/contentSecurityPolicy/sandbox-empty.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    22This test passes if it doesn't alert fail.
  • trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-empty-subframe-expected.txt

    r137180 r156130  
    1 CONSOLE MESSAGE: Blocked script execution in 'data:text/html,<script>alert('FAIL');</script>' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     1CONSOLE MESSAGE: line 1: Blocked script execution in 'data:text/html,<script>alert('FAIL');</script>' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    22This test passes if it doesn't alert fail.
  • trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-in-http-header-control-expected.txt

    r137180 r156130  
    1 CONSOLE MESSAGE: Blocked script execution in 'http://127.0.0.1:8000/security/contentSecurityPolicy/resources/sandbox.php?sandbox=allow-top-navigation%20allow-same-origin' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     1CONSOLE MESSAGE: line 6: Blocked script execution in 'http://127.0.0.1:8000/security/contentSecurityPolicy/resources/sandbox.php?sandbox=allow-top-navigation%20allow-same-origin' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    22ALERT: PASS: Iframe was not in a unique origin
    33
  • trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-in-http-header-expected.txt

    r146725 r156130  
    1 CONSOLE MESSAGE: Blocked script execution in 'http://127.0.0.1:8000/security/contentSecurityPolicy/resources/sandbox.php?sandbox=allow-top-navigation' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     1CONSOLE MESSAGE: line 6: Blocked script execution in 'http://127.0.0.1:8000/security/contentSecurityPolicy/resources/sandbox.php?sandbox=allow-top-navigation' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    22CONSOLE MESSAGE: Sandbox access violation: Blocked a frame at "http://127.0.0.1:8000" from accessing a frame at "http://127.0.0.1:8000".  The frame being accessed is sandboxed and lacks the "allow-same-origin" flag.
    33ALERT: PASS: Iframe was in a unique origin
  • trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-invalid-header-expected.txt

    r137180 r156130  
    11CONSOLE MESSAGE: Error while parsing the 'sandbox' Content Security Policy directive: 'allowScript' is an invalid sandbox flag.
    2 CONSOLE MESSAGE: Blocked script execution in 'http://127.0.0.1:8000/security/contentSecurityPolicy/resources/sandbox.php?sandbox=allowScript' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     2CONSOLE MESSAGE: line 6: Blocked script execution in 'http://127.0.0.1:8000/security/contentSecurityPolicy/resources/sandbox.php?sandbox=allowScript' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    33
  • trunk/LayoutTests/http/tests/security/isolatedWorld/sandboxed-iframe-expected.txt

    r137180 r156130  
    1 CONSOLE MESSAGE: Blocked script execution in 'http://127.0.0.1:8000/security/isolatedWorld/resources/fail.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     1CONSOLE MESSAGE: line 3: Blocked script execution in 'http://127.0.0.1:8000/security/isolatedWorld/resources/fail.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    22ALERT: PASS
    33Test that executing scripts in an isolated world works even inside sandboxed iframes. The test passes, if an alert with the text "PASS" is shown.
  • trunk/LayoutTests/http/tests/security/mixedContent/insecure-script-in-iframe-expected.txt

    r106896 r156130  
    1 CONSOLE MESSAGE: The page at https://127.0.0.1:8443/security/mixedContent/resources/frame-with-insecure-script.html ran insecure content from http://127.0.0.1:8080/security/mixedContent/resources/script.js.
     1CONSOLE MESSAGE: line 1: The page at https://127.0.0.1:8443/security/mixedContent/resources/frame-with-insecure-script.html ran insecure content from http://127.0.0.1:8080/security/mixedContent/resources/script.js.
    22
    33This test loads a secure iframe that loads an insecure script. We should trigger a mixed content callback even though the main frame is HTTP because the HTTPS frame's origin is contaminated with an insecure script.
  • trunk/LayoutTests/http/tests/security/mixedContent/redirect-http-to-https-script-in-iframe-expected.txt

    r153915 r156130  
    22main frame - didFinishDocumentLoadForFrame
    33frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
    4 CONSOLE MESSAGE: The page at https://127.0.0.1:8443/security/mixedContent/resources/frame-with-redirect-http-to-https-script.html ran insecure content from http://127.0.0.1:8080/resources/redirect.php?url=https://127.0.0.1:8443/security/mixedContent/resources/script.js.
     4CONSOLE MESSAGE: line 1: The page at https://127.0.0.1:8443/security/mixedContent/resources/frame-with-redirect-http-to-https-script.html ran insecure content from http://127.0.0.1:8080/resources/redirect.php?url=https://127.0.0.1:8443/security/mixedContent/resources/script.js.
    55
    66didRunInsecureContent
  • trunk/LayoutTests/media/video-controls-no-scripting-expected.txt

    r137180 r156130  
    1 CONSOLE MESSAGE: Blocked script execution in 'video-controls-no-scripting-iframe.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
     1CONSOLE MESSAGE: line 10: Blocked script execution in 'video-controls-no-scripting-iframe.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    22CONSOLE MESSAGE: line 13: Blocked script execution in 'video-controls-no-scripting-iframe.html' because the document's frame is sandboxed and the 'allow-scripts' permission is not set.
    33
  • trunk/Source/WebCore/ChangeLog

    r156125 r156130  
     12013-09-19  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Layout Test http/tests/security/canvas-remote-read-remote-image-redirect.html is flaky
     4        https://bugs.webkit.org/show_bug.cgi?id=121458
     5
     6        Reviewed by Sam Weinig.
     7
     8        The code to automagically produce line numbers is quite fragile. Added some FIXMEs,
     9        and added an issue that was making reporting flaky for code is JS event handlers
     10        executed while parsing was paused.
     11
     12        * page/PageConsole.cpp: (WebCore::PageConsole::addMessage): Use actual "script is
     13        running" check instead of "parsing a script element" one.
     14
    1152013-09-18  Ryosuke Niwa  <rniwa@webkit.org>
    216
  • trunk/Source/WebCore/page/PageConsole.cpp

    r155736 r156130  
    3838#include "InspectorConsoleInstrumentation.h"
    3939#include "InspectorController.h"
     40#include "JSMainThreadExecState.h"
    4041#include "Page.h"
    4142#include "ScriptArguments.h"
     
    137138    if (document)
    138139        url = document->url().string();
    139     // FIXME: <http://webkit.org/b/114319> PageConsole::addMessage should automatically determine column number alongside line number
     140    // FIXME: <http://webkit.org/b/114319> PageConsole::addMessage should automatically determine column number alongside line number.
     141    // FIXME: The below code attempts to determine line numbers for parser generated errors, but this is not the only reason why we can get here.
     142    // For example, if we are still parsing and get a WebSocket network error, it will be erroneously attributed to a line where parsing was paused.
     143    // Also, we should determine line numbers for script generated messages (e.g. calling getImageData on a canvas).
     144    // We probably need to split this function into multiple ones, as appropriate for different call sites. Or maybe decide based on MessageSource.
    140145    unsigned line = 0;
    141146    if (document && document->parsing() && !document->isInDocumentWrite() && document->scriptableDocumentParser()) {
    142147        ScriptableDocumentParser* parser = document->scriptableDocumentParser();
    143         if (!parser->isWaitingForScripts() && !parser->isExecutingScript())
     148        if (!parser->isWaitingForScripts() && !JSMainThreadExecState::currentState())
    144149            line = parser->lineNumber().oneBasedInt();
    145150    }
Note: See TracChangeset for help on using the changeset viewer.