Title: [178648] trunk
Revision
178648
Author
[email protected]
Date
2015-01-19 09:25:23 -0800 (Mon, 19 Jan 2015)

Log Message

Console log sometimes prefixed with line number
https://bugs.webkit.org/show_bug.cgi?id=105280

Reviewed by Darin Adler.

Source/WebCore:

Improve the logic for determining whether a console message should be associated
with a source code location.

* dom/ScriptableDocumentParser.h:
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::shouldAssociateConsoleMessagesWithTextPosition):
* html/parser/HTMLDocumentParser.h:
* page/PageConsoleClient.cpp:
(WebCore::getParserLocationForConsoleMessage):
(WebCore::PageConsoleClient::addMessage):
* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::pauseParsing):
* xml/parser/XMLDocumentParser.h:
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::shouldAssociateConsoleMessagesWithTextPosition):

LayoutTests:

Some messages lost line numbers now. Some of these were definitely wrong, others
were roughly right. Unfortunately, it is not currently possible to figure out whether
ScriptController actually executes a script after passing control to it. So the cases
where it refuses to execute the script and logs a message are handled like those
where it does.

I think that it shouldn't be a big obstacle in practice, it is easy enough to find
a script in a page when Web Inspector tells you that scripts were not allowed.

* 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:
* http/tests/security/mixedContent/insecure-script-in-iframe-expected.txt:
* http/tests/security/mixedContent/redirect-http-to-https-script-in-iframe-expected.txt:
* http/tests/security/no-_javascript_-refresh-expected.txt:
* http/tests/security/no-_javascript_-refresh-spaces-expected.txt:

* platform/efl/TestExpectations:
* platform/gtk/TestExpectations:
Unmark tests that were broken by this.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (178647 => 178648)


--- trunk/LayoutTests/ChangeLog	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/ChangeLog	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,3 +1,45 @@
+2015-01-16  Alexey Proskuryakov  <[email protected]>
+
+        Console log sometimes prefixed with line number
+        https://bugs.webkit.org/show_bug.cgi?id=105280
+
+        Reviewed by Darin Adler.
+
+        Some messages lost line numbers now. Some of these were definitely wrong, others
+        were roughly right. Unfortunately, it is not currently possible to figure out whether
+        ScriptController actually executes a script after passing control to it. So the cases
+        where it refuses to execute the script and logs a message are handled like those
+        where it does.
+
+        I think that it shouldn't be a big obstacle in practice, it is easy enough to find
+        a script in a page when Web Inspector tells you that scripts were not allowed.
+
+        * 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:
+        * http/tests/security/mixedContent/insecure-script-in-iframe-expected.txt:
+        * http/tests/security/mixedContent/redirect-http-to-https-script-in-iframe-expected.txt:
+        * http/tests/security/no-_javascript_-refresh-expected.txt:
+        * http/tests/security/no-_javascript_-refresh-spaces-expected.txt:
+
+        * platform/efl/TestExpectations:
+        * platform/gtk/TestExpectations:
+        Unmark tests that were broken by this.
+
 2015-01-19  Csaba Osztrogonác  <[email protected]>
 
         [Win] REGRESSION(r177542 or r177613): svg/W3C tests are broken

Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-06-expected.txt (178647 => 178648)


--- trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-06-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-06-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,5 +1,5 @@
 CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'allowscripts' is an invalid sandbox flag.
-CONSOLE 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.
+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.
 Misspelling.
 
 

Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-07-expected.txt (178647 => 178648)


--- trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-07-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-07-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,5 +1,5 @@
 CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'allows-cripts' is an invalid sandbox flag.
-CONSOLE 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.
+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.
 Misspelling.
 
 

Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-08-expected.txt (178647 => 178648)


--- trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-08-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-08-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,5 +1,5 @@
 CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: '-allow-scripts' is an invalid sandbox flag.
-CONSOLE 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.
+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.
 Misspelling.
 
 

Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-09-expected.txt (178647 => 178648)


--- trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-09-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-09-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,5 +1,5 @@
 CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'allow_scripts' is an invalid sandbox flag.
-CONSOLE 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.
+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.
 Misspelling.
 
 

Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-10-expected.txt (178647 => 178648)


--- trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-10-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-10-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,5 +1,5 @@
 CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'allowScripts' is an invalid sandbox flag.
-CONSOLE 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.
+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.
 Misspelling.
 
 

Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-11-expected.txt (178647 => 178648)


--- trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-11-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-11-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,5 +1,5 @@
 CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'aallow-scripts' is an invalid sandbox flag.
-CONSOLE 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.
+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.
 Misspelling.
 
 

Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-12-expected.txt (178647 => 178648)


--- trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-12-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-12-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,5 +1,5 @@
 CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'allow-scriptss' is an invalid sandbox flag.
-CONSOLE 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.
+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.
 Misspelling.
 
 

Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-13-expected.txt (178647 => 178648)


--- trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-13-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-13-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,5 +1,5 @@
 CONSOLE MESSAGE: line 9: Error while parsing the 'sandbox' attribute: 'allow-script' is an invalid sandbox flag.
-CONSOLE 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.
+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.
 Misspelling.
 
 

Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-14-expected.txt (178647 => 178648)


--- trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-14-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-attribute-parsing-14-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,4 +1,4 @@
-CONSOLE 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.
+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.
 Full sandbox.
 
 

Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-parsing-space-characters-expected.txt (178647 => 178648)


--- trunk/LayoutTests/fast/frames/sandboxed-iframe-parsing-space-characters-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-parsing-space-characters-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,10 +1,10 @@
 ALERT: PASS: Form feed is a delimiter.
 CONSOLE MESSAGE: line 16: Error while parsing the 'sandbox' attribute: 'allow-scriptsallow-forms' is an invalid sandbox flag.
-CONSOLE 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.
+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.
 ALERT: PASS: Newline is a delimiter.
 ALERT: PASS: Return is a delimiter.
 CONSOLE MESSAGE: line 16: Error while parsing the 'sandbox' attribute: 'allow-scriptsxallow-forms' is an invalid sandbox flag.
-CONSOLE 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.
+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.
 ALERT: PASS: Tab is a delimiter.
 ALERT: PASS: Space is a delimiter character.
 This tests whether we correct parse various space characters in the sandbox attribute.

Modified: trunk/LayoutTests/fast/frames/sandboxed-iframe-scripting-04-expected.txt (178647 => 178648)


--- trunk/LayoutTests/fast/frames/sandboxed-iframe-scripting-04-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/fast/frames/sandboxed-iframe-scripting-04-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,4 +1,4 @@
-CONSOLE 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.
+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.
 Verify that sandboxed frames without sandbox='allow-scripts' cannot execute script from data: URLs.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-empty-expected.txt (178647 => 178648)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-empty-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-empty-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,2 +1,2 @@
-CONSOLE 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.
+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.
 This test passes if it doesn't alert fail.

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-empty-subframe-expected.txt (178647 => 178648)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-empty-subframe-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-empty-subframe-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,2 +1,2 @@
-CONSOLE 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.
+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.
 This test passes if it doesn't alert fail. 

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-in-http-header-control-expected.txt (178647 => 178648)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-in-http-header-control-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-in-http-header-control-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,3 +1,3 @@
-CONSOLE 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.
+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.
 ALERT: PASS: Iframe was not in a unique origin
 

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-in-http-header-expected.txt (178647 => 178648)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-in-http-header-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-in-http-header-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,4 +1,4 @@
-CONSOLE 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.
+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.
 CONSOLE MESSAGE: line 9: 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.
 ALERT: PASS: Iframe was in a unique origin
 

Modified: trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-invalid-header-expected.txt (178647 => 178648)


--- trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-invalid-header-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/http/tests/security/contentSecurityPolicy/sandbox-invalid-header-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,3 +1,3 @@
 CONSOLE MESSAGE: Error while parsing the 'sandbox' Content Security Policy directive: 'allowScript' is an invalid sandbox flag.
-CONSOLE 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.
+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.
 

Modified: trunk/LayoutTests/http/tests/security/isolatedWorld/sandboxed-iframe-expected.txt (178647 => 178648)


--- trunk/LayoutTests/http/tests/security/isolatedWorld/sandboxed-iframe-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/http/tests/security/isolatedWorld/sandboxed-iframe-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,4 +1,4 @@
-CONSOLE 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.
+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.
 ALERT: PASS
 Test that executing scripts in an isolated world works even inside sandboxed iframes. The test passes, if an alert with the text "PASS" is shown.
 

Modified: trunk/LayoutTests/http/tests/security/mixedContent/insecure-script-in-iframe-expected.txt (178647 => 178648)


--- trunk/LayoutTests/http/tests/security/mixedContent/insecure-script-in-iframe-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/http/tests/security/mixedContent/insecure-script-in-iframe-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,4 +1,4 @@
-CONSOLE 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.
+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.
 
 This 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.
 

Modified: trunk/LayoutTests/http/tests/security/mixedContent/redirect-http-to-https-script-in-iframe-expected.txt (178647 => 178648)


--- trunk/LayoutTests/http/tests/security/mixedContent/redirect-http-to-https-script-in-iframe-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/http/tests/security/mixedContent/redirect-http-to-https-script-in-iframe-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,7 +1,7 @@
 frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
 main frame - didFinishDocumentLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
-CONSOLE 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=""
+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=""
 
 didRunInsecureContent
 frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame

Modified: trunk/LayoutTests/http/tests/security/no-_javascript_-refresh-expected.txt (178647 => 178648)


--- trunk/LayoutTests/http/tests/security/no-_javascript_-refresh-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/http/tests/security/no-_javascript_-refresh-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,2 +1,2 @@
-CONSOLE MESSAGE: line 1: Refused to refresh http://127.0.0.1:8000/security/no-_javascript_-refresh.php to a _javascript_: URL
+CONSOLE MESSAGE: Refused to refresh http://127.0.0.1:8000/security/no-_javascript_-refresh.php to a _javascript_: URL
 PASS: This is the content that appears in place of a refresh.

Modified: trunk/LayoutTests/http/tests/security/no-_javascript_-refresh-spaces-expected.txt (178647 => 178648)


--- trunk/LayoutTests/http/tests/security/no-_javascript_-refresh-spaces-expected.txt	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/http/tests/security/no-_javascript_-refresh-spaces-expected.txt	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,2 +1,2 @@
-CONSOLE MESSAGE: line 1: Refused to refresh http://127.0.0.1:8000/security/no-_javascript_-refresh-spaces.php to a _javascript_: URL
+CONSOLE MESSAGE: Refused to refresh http://127.0.0.1:8000/security/no-_javascript_-refresh-spaces.php to a _javascript_: URL
 PASS: This is the content that appears in place of a refresh.

Modified: trunk/LayoutTests/platform/efl/TestExpectations (178647 => 178648)


--- trunk/LayoutTests/platform/efl/TestExpectations	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2015-01-19 17:25:23 UTC (rev 178648)
@@ -690,13 +690,6 @@
 
 webkit.org/b/103383 fast/css/counters/element-removal-crash.xhtml [ Failure Pass ]
 
-# flaky console output problem
-webkit.org/b/105280 http/tests/xmlhttprequest/origin-whitelisting-https.html [ Failure Pass ]
-webkit.org/b/105280 http/tests/xmlhttprequest/access-control-preflight-async-header-denied.html [ Failure Pass ]
-webkit.org/b/105280 http/tests/xmlhttprequest/access-control-preflight-async-method-denied.html [ Failure Pass ]
-webkit.org/b/105280 http/tests/xmlhttprequest/cross-site-denied-response.html [ Failure Pass ]
-webkit.org/b/105280 http/tests/xmlhttprequest/access-control-preflight-async-not-supported.html [ Failure Pass ]
-
 webkit.org/b/105296 webaudio/delaynode-maxdelay.html [ Failure Pass ]
 webkit.org/b/105296 webaudio/delaynode-max-nondefault-delay.html [ Failure Pass ]
 webkit.org/b/105296 webaudio/delaynode-scheduling.html [ Failure Pass ]

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (178647 => 178648)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2015-01-19 17:25:23 UTC (rev 178648)
@@ -761,14 +761,6 @@
 
 webkit.org/b/105191 media/video-playing-and-pause.html [ Failure Pass ]
 
-webkit.org/b/105280 http/tests/xmlhttprequest/access-control-preflight-async-header-denied.html [ Failure Pass ]
-webkit.org/b/105280 http/tests/xmlhttprequest/access-control-preflight-async-method-denied.html [ Failure Pass ]
-webkit.org/b/105280 http/tests/xmlhttprequest/access-control-preflight-async-not-supported.html [ Failure Pass ]
-webkit.org/b/105280 http/tests/xmlhttprequest/cross-site-denied-response.html [ Failure Pass ]
-webkit.org/b/105280 http/tests/xmlhttprequest/origin-whitelisting-https.html [ Failure Pass ]
-webkit.org/b/105280 http/tests/xmlhttprequest/simple-cross-origin-denied-events.html [ Failure Pass ]
-webkit.org/b/105280 http/tests/xmlhttprequest/simple-cross-origin-denied-events-post.html [ Failure Pass ]
-
 webkit.org/b/118460 media/media-element-play-after-eos.html [ Timeout Pass ]
 webkit.org/b/118460 media/video-duration-known-after-eos.html [ Timeout Pass ]
 

Modified: trunk/Source/WebCore/ChangeLog (178647 => 178648)


--- trunk/Source/WebCore/ChangeLog	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/Source/WebCore/ChangeLog	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1,3 +1,26 @@
+2015-01-16  Alexey Proskuryakov  <[email protected]>
+
+        Console log sometimes prefixed with line number
+        https://bugs.webkit.org/show_bug.cgi?id=105280
+
+        Reviewed by Darin Adler.
+
+        Improve the logic for determining whether a console message should be associated
+        with a source code location.
+
+        * dom/ScriptableDocumentParser.h:
+        * html/parser/HTMLDocumentParser.cpp:
+        (WebCore::HTMLDocumentParser::shouldAssociateConsoleMessagesWithTextPosition):
+        * html/parser/HTMLDocumentParser.h:
+        * page/PageConsoleClient.cpp:
+        (WebCore::getParserLocationForConsoleMessage):
+        (WebCore::PageConsoleClient::addMessage):
+        * xml/parser/XMLDocumentParser.cpp:
+        (WebCore::XMLDocumentParser::pauseParsing):
+        * xml/parser/XMLDocumentParser.h:
+        * xml/parser/XMLDocumentParserLibxml2.cpp:
+        (WebCore::XMLDocumentParser::shouldAssociateConsoleMessagesWithTextPosition):
+
 2015-01-19  Myles C. Maxfield  <[email protected]>
 
         [SVG -> OTF Converter] Glyphs get clipped weirdly

Modified: trunk/Source/WebCore/dom/ScriptableDocumentParser.h (178647 => 178648)


--- trunk/Source/WebCore/dom/ScriptableDocumentParser.h	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/Source/WebCore/dom/ScriptableDocumentParser.h	2015-01-19 17:25:23 UTC (rev 178648)
@@ -46,6 +46,10 @@
 
     virtual TextPosition textPosition() const = 0;
 
+    // Returns true if the parser didn't yield or pause or synchronously execute a script,
+    // so calls to PageConsoleClient should be associated with the parser's text position.
+    virtual bool shouldAssociateConsoleMessagesWithTextPosition() const = 0;
+
     void setWasCreatedByScript(bool wasCreatedByScript) { m_wasCreatedByScript = wasCreatedByScript; }
     bool wasCreatedByScript() const { return m_wasCreatedByScript; }
 

Modified: trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp (178647 => 178648)


--- trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp	2015-01-19 17:25:23 UTC (rev 178648)
@@ -462,6 +462,11 @@
     return TextPosition(currentString.currentLine(), currentString.currentColumn());
 }
 
+bool HTMLDocumentParser::shouldAssociateConsoleMessagesWithTextPosition() const
+{
+    return inPumpSession() && !isExecutingScript();
+}
+
 bool HTMLDocumentParser::isWaitingForScripts() const
 {
     // When the TreeBuilder encounters a </script> tag, it returns to the HTMLDocumentParser

Modified: trunk/Source/WebCore/html/parser/HTMLDocumentParser.h (178647 => 178648)


--- trunk/Source/WebCore/html/parser/HTMLDocumentParser.h	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/Source/WebCore/html/parser/HTMLDocumentParser.h	2015-01-19 17:25:23 UTC (rev 178648)
@@ -87,6 +87,8 @@
     virtual void suspendScheduledTasks() override final;
     virtual void resumeScheduledTasks() override final;
 
+    virtual bool shouldAssociateConsoleMessagesWithTextPosition() const override final;
+
     // HTMLScriptRunnerHost
     virtual void watchForLoad(CachedResource*) override final;
     virtual void stopWatchingForLoad(CachedResource*) override final;

Modified: trunk/Source/WebCore/page/PageConsoleClient.cpp (178647 => 178648)


--- trunk/Source/WebCore/page/PageConsoleClient.cpp	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/Source/WebCore/page/PageConsoleClient.cpp	2015-01-19 17:25:23 UTC (rev 178648)
@@ -83,27 +83,34 @@
     muteCount--;
 }
 
+static void getParserLocationForConsoleMessage(Document* document, String& url, unsigned& line, unsigned& column)
+{
+    if (!document)
+        return;
+
+    // We definitely cannot associate the message with a location being parsed if we are not even parsing.
+    if (!document->parsing())
+        return;
+
+    ScriptableDocumentParser* parser = document->scriptableDocumentParser();
+
+    // When the parser waits for scripts, any messages must be coming from some other source, and are not related to the location of the script element that made the parser wait.
+    if (!parser->shouldAssociateConsoleMessagesWithTextPosition())
+        return;
+
+    url = ""
+    TextPosition position = parser->textPosition();
+    line = position.m_line.oneBasedInt();
+    column = position.m_column.oneBasedInt();
+}
+
 void PageConsoleClient::addMessage(MessageSource source, MessageLevel level, const String& message, unsigned long requestIdentifier, Document* document)
 {
     String url;
-    if (document)
-        url = ""
-
-    // 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.
-    // 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.
-    // Also, we should determine line numbers for script generated messages (e.g. calling getImageData on a canvas).
-    // We probably need to split this function into multiple ones, as appropriate for different call sites. Or maybe decide based on MessageSource.
-    // https://bugs.webkit.org/show_bug.cgi?id=125340
     unsigned line = 0;
     unsigned column = 0;
-    if (document && document->parsing() && !document->isInDocumentWrite() && document->scriptableDocumentParser()) {
-        ScriptableDocumentParser* parser = document->scriptableDocumentParser();
-        if (!parser->isWaitingForScripts() && !JSMainThreadExecState::currentState()) {
-            TextPosition position = parser->textPosition();
-            line = position.m_line.oneBasedInt();
-            column = position.m_column.oneBasedInt();
-        }
-    }
+    getParserLocationForConsoleMessage(document, url, line, column);
+
     addMessage(source, level, message, url, line, column, 0, JSMainThreadExecState::currentState(), requestIdentifier);
 }
 

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp (178647 => 178648)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2015-01-19 17:25:23 UTC (rev 178648)
@@ -261,6 +261,8 @@
 
 void XMLDocumentParser::pauseParsing()
 {
+    ASSERT(!m_parserPaused);
+
     if (m_parsingFragment)
         return;
 

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParser.h (178647 => 178648)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParser.h	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParser.h	2015-01-19 17:25:23 UTC (rev 178648)
@@ -65,7 +65,7 @@
         xmlParserCtxtPtr m_context;
     };
 
-    class XMLDocumentParser : public ScriptableDocumentParser, public CachedResourceClient {
+    class XMLDocumentParser final : public ScriptableDocumentParser, public CachedResourceClient {
         WTF_MAKE_FAST_ALLOCATED;
     public:
         static Ref<XMLDocumentParser> create(Document& document, FrameView* view)
@@ -90,8 +90,6 @@
         // Used by the XMLHttpRequest to check if the responseXML was well formed.
         virtual bool wellFormed() const { return !m_sawError; }
 
-        TextPosition textPosition() const;
-
         static bool supportsXMLVersion(const String&);
 
     private:
@@ -106,6 +104,9 @@
         virtual void stopParsing() override;
         virtual void detach() override;
 
+        virtual TextPosition textPosition() const override;
+        virtual bool shouldAssociateConsoleMessagesWithTextPosition() const override;
+
         // from CachedResourceClient
         virtual void notifyFinished(CachedResource*) override;
 

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp (178647 => 178648)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp	2015-01-19 16:32:26 UTC (rev 178647)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp	2015-01-19 17:25:23 UTC (rev 178648)
@@ -1434,6 +1434,11 @@
                         OrdinalNumber::fromOneBasedInt(context->input->col));
 }
 
+bool XMLDocumentParser::shouldAssociateConsoleMessagesWithTextPosition() const
+{
+    return !m_parserPaused && !m_requestingScript;
+}
+
 void XMLDocumentParser::stopParsing()
 {
     DocumentParser::stopParsing();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to