RESOLVED FIXED Bug 65829
JavaScript console can't evaluate expression in strict context
https://bugs.webkit.org/show_bug.cgi?id=65829
Summary JavaScript console can't evaluate expression in strict context
Mark S. Miller
Reported 2011-08-07 13:28:47 PDT
In WebKit Nightly Version 5.0.6 (5533.22.3, r92569), open the attachment and follow the instructions. The next attachment will show what I see when I do so.
Attachments
Load and follow instructions to see JavaScript console bug (351 bytes, text/html)
2011-08-07 13:31 PDT, Mark S. Miller
no flags
What I see when I follow the instructions on previous attachment (47.83 KB, image/png)
2011-08-07 13:34 PDT, Mark S. Miller
no flags
Demonstrates that the bug also occurs on the released Safari 5.0.6 (68.07 KB, image/png)
2011-08-07 13:42 PDT, Mark S. Miller
no flags
the latest error message and traceback from the attached test case (Webkit r108593) (142.75 KB, image/png)
2012-02-23 11:16 PST, David Baumgold
no flags
Proposed Change (5.17 KB, patch)
2013-03-21 15:17 PDT, Timothy Hatcher
ggaren: review+
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-11 (937.32 KB, application/zip)
2013-03-21 15:57 PDT, Build Bot
no flags
Archive of layout-test-results from gce-cr-linux-06 (720.14 KB, application/zip)
2013-03-21 16:11 PDT, WebKit Review Bot
no flags
Archive of layout-test-results from webkit-ews-04 (605.62 KB, application/zip)
2013-03-21 23:39 PDT, Build Bot
no flags
Proposed Change (Take 2) (19.81 KB, patch)
2013-03-23 14:32 PDT, Timothy Hatcher
webkit.review.bot: commit-queue-
Archive of layout-test-results from gce-cr-linux-02 for chromium-linux-x86_64 (848.08 KB, application/zip)
2013-03-23 18:16 PDT, WebKit Review Bot
no flags
Proposed Change (Take 3) (19.24 KB, patch)
2013-03-23 18:26 PDT, Timothy Hatcher
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-05 for mac-future (573.57 KB, application/zip)
2013-03-23 21:11 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2 (459.82 KB, application/zip)
2013-03-23 21:21 PDT, Build Bot
no flags
Proposed Change (Take 4) (19.23 KB, patch)
2013-03-24 08:00 PDT, Timothy Hatcher
no flags
The bug still happens on the latest Nightly (part 1) (627.44 KB, image/png)
2013-03-26 00:09 PDT, Mark S. Miller
no flags
The bug still happens on the latest Nightly (part 2) (641.70 KB, image/png)
2013-03-26 00:10 PDT, Mark S. Miller
no flags
Screenshot showing that the bug isn't fixed -- Part 1 (611.12 KB, image/png)
2013-03-26 12:15 PDT, Mark S. Miller
no flags
Screenshot showing that the bug isn't fixed -- Part 2 (605.37 KB, image/png)
2013-03-26 12:16 PDT, Mark S. Miller
no flags
Proposed Additional Change (3.29 KB, patch)
2013-03-26 13:48 PDT, Timothy Hatcher
joepeck: review+
timothy: commit-queue-
Mark S. Miller
Comment 1 2011-08-07 13:31:45 PDT
Created attachment 103184 [details] Load and follow instructions to see JavaScript console bug This attachment didn't take the first time, so adding it now.
Mark S. Miller
Comment 2 2011-08-07 13:34:28 PDT
Created attachment 103185 [details] What I see when I follow the instructions on previous attachment This screenshot seems to demonstrate that, when the JavaScript console is in a strict context and tries to evaluate an expression, it first surrounds the expression with a "with" statement and then tries to evaluate the resulting string in a strict context. This of course cannot work, since "with" is illegal in strict mode.
Mark S. Miller
Comment 3 2011-08-07 13:42:14 PDT
Created attachment 103186 [details] Demonstrates that the bug also occurs on the released Safari 5.0.6
David Baumgold
Comment 4 2012-02-23 11:13:28 PST
Confirmed that this bug is still occuring in the latest version of Safari (Version 5.1.3 (7534.53.10)) and in the latest Webkit Nightly build (r108593).
David Baumgold
Comment 5 2012-02-23 11:16:52 PST
Created attachment 128509 [details] the latest error message and traceback from the attached test case (Webkit r108593)
Øyvind Smestad
Comment 6 2012-12-10 04:22:49 PST
This issue seems to be duplicated in: https://bugs.webkit.org/show_bug.cgi?id=83267 and still occurs in Safari 6.0.2 (8536.26.17)
Timothy Hatcher
Comment 7 2013-03-21 15:03:53 PDT
*** Bug 83267 has been marked as a duplicate of this bug. ***
Timothy Hatcher
Comment 8 2013-03-21 15:17:54 PDT
Created attachment 194361 [details] Proposed Change
Geoffrey Garen
Comment 9 2013-03-21 15:21:51 PDT
Comment on attachment 194361 [details] Proposed Change View in context: https://bugs.webkit.org/attachment.cgi?id=194361&action=review r=me > Source/WebCore/ChangeLog:14 > + console to stay in strict mode. This also allows users to opt-into strict mode by prefixing s/stay in/stay out of/ -- we're evaluating inside a strict mode function, but then injecting a non-strict function.
Geoffrey Garen
Comment 10 2013-03-21 15:36:46 PDT
Comment on attachment 194361 [details] Proposed Change View in context: https://bugs.webkit.org/attachment.cgi?id=194361&action=review > Source/WebCore/inspector/InjectedScriptSource.js:584 > var result = evalFunction.call(object, expression); I think we should surround this case in an empty function expression. That way, the behavior of things like "var" won't change.
Build Bot
Comment 11 2013-03-21 15:57:45 PDT
Comment on attachment 194361 [details] Proposed Change Attachment 194361 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-commit-queue.appspot.com/results/17290116 New failing tests: inspector/debugger/debugger-pause-in-eval-script.html inspector/debugger/mutation-observer-suspend-while-paused.html inspector/console/console-eval-syntax-error.html inspector/console/console-eval-fake.html svg/custom/marker-orient-auto.html inspector/extensions/extensions-sidebar.html inspector/extensions/extensions-eval.html inspector/console/command-line-api.html
Build Bot
Comment 12 2013-03-21 15:57:47 PDT
Created attachment 194368 [details] Archive of layout-test-results from webkit-ews-11 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-11 Port: <class 'webkitpy.common.config.ports.MacWK2Port'> Platform: Mac OS X 10.8.2
WebKit Review Bot
Comment 13 2013-03-21 16:11:22 PDT
Comment on attachment 194361 [details] Proposed Change Attachment 194361 [details] did not pass chromium-ews (chromium-xvfb): Output: http://webkit-commit-queue.appspot.com/results/17207558 New failing tests: inspector/debugger/debugger-pause-in-eval-script.html http/tests/inspector/console-cd-completions.html inspector/debugger/mutation-observer-suspend-while-paused.html inspector/console/console-eval-syntax-error.html inspector/console/console-eval-fake.html inspector/extensions/extensions-sidebar.html inspector/extensions/extensions-eval.html inspector/console/command-line-api.html
WebKit Review Bot
Comment 14 2013-03-21 16:11:26 PDT
Created attachment 194373 [details] Archive of layout-test-results from gce-cr-linux-06 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-06 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-3.3.8-gcg-201212281604-x86_64-with-GCEL-10.04-gcel_10.04
Build Bot
Comment 15 2013-03-21 23:39:11 PDT
Comment on attachment 194361 [details] Proposed Change Attachment 194361 [details] did not pass mac-ews (mac): Output: http://webkit-commit-queue.appspot.com/results/17112655 New failing tests: inspector/debugger/debugger-pause-in-eval-script.html inspector/debugger/mutation-observer-suspend-while-paused.html inspector/console/console-eval-syntax-error.html inspector/console/console-eval-fake.html inspector/extensions/extensions-sidebar.html inspector/extensions/extensions-eval.html inspector/console/command-line-api.html
Build Bot
Comment 16 2013-03-21 23:39:14 PDT
Created attachment 194454 [details] Archive of layout-test-results from webkit-ews-04 The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-04 Port: <class 'webkitpy.common.config.ports.MacPort'> Platform: Mac OS X 10.8.2
Timothy Hatcher
Comment 17 2013-03-23 07:58:42 PDT
I have a better patch coming soon.
Timothy Hatcher
Comment 18 2013-03-23 14:32:03 PDT
Created attachment 194718 [details] Proposed Change (Take 2)
WebKit Review Bot
Comment 19 2013-03-23 18:16:02 PDT
Comment on attachment 194718 [details] Proposed Change (Take 2) Attachment 194718 [details] did not pass chromium-ews (chromium-xvfb): Output: http://webkit-commit-queue.appspot.com/results/17235424 New failing tests: inspector/console/command-line-api.html
WebKit Review Bot
Comment 20 2013-03-23 18:16:07 PDT
Created attachment 194725 [details] Archive of layout-test-results from gce-cr-linux-02 for chromium-linux-x86_64 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-02 Port: chromium-linux-x86_64 Platform: Linux-3.3.8-gcg-201212281604-x86_64-with-GCEL-10.04-gcel_10.04
Timothy Hatcher
Comment 21 2013-03-23 18:26:27 PDT
Created attachment 194726 [details] Proposed Change (Take 3)
Build Bot
Comment 22 2013-03-23 21:11:24 PDT
Comment on attachment 194726 [details] Proposed Change (Take 3) Attachment 194726 [details] did not pass mac-ews (mac): Output: http://webkit-commit-queue.appspot.com/results/17311055 New failing tests: http/tests/inspector/console-resource-errors.html
Build Bot
Comment 23 2013-03-23 21:11:27 PDT
Created attachment 194733 [details] Archive of layout-test-results from webkit-ews-05 for mac-future The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-05 Port: mac-future Platform: Mac OS X 10.8.2
Build Bot
Comment 24 2013-03-23 21:21:25 PDT
Comment on attachment 194726 [details] Proposed Change (Take 3) Attachment 194726 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-commit-queue.appspot.com/results/17304056 New failing tests: http/tests/inspector/console-resource-errors.html
Build Bot
Comment 25 2013-03-23 21:21:30 PDT
Created attachment 194734 [details] Archive of layout-test-results from webkit-ews-09 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-09 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.2
Timothy Hatcher
Comment 26 2013-03-24 08:00:30 PDT
Created attachment 194752 [details] Proposed Change (Take 4)
Pavel Feldman
Comment 27 2013-03-25 06:48:54 PDT
Comment on attachment 194752 [details] Proposed Change (Take 4) View in context: https://bugs.webkit.org/attachment.cgi?id=194752&action=review > Source/WebCore/inspector/InjectedScriptHost.h:109 > + bool evaluateReturnsEvalFunction() { return true; } So far we were hiding all the differences like this behind Script* boundary. Also, could we instead introduce evaluateFunction getter that v8 will fail to return instead of this boolean flag? That way InjectedScriptSource will be compiler friendly.
Timothy Hatcher
Comment 28 2013-03-25 08:49:18 PDT
(In reply to comment #27) > (From update of attachment 194752 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=194752&action=review > > > Source/WebCore/inspector/InjectedScriptHost.h:109 > > + bool evaluateReturnsEvalFunction() { return true; } > > So far we were hiding all the differences like this behind Script* boundary. Also, could we instead introduce evaluateFunction getter that v8 will fail to return instead of this boolean flag? That way InjectedScriptSource will be compiler friendly. How is this not patch not compiler friendly? I considered exposing evaluateFunction. But I didn't want both evaluate and evaluateFunction in the JSC path. We want to have only one way to evaluate.
WebKit Review Bot
Comment 29 2013-03-25 19:38:24 PDT
Comment on attachment 194752 [details] Proposed Change (Take 4) Clearing flags on attachment: 194752 Committed r146840: <http://trac.webkit.org/changeset/146840>
WebKit Review Bot
Comment 30 2013-03-25 19:38:31 PDT
All reviewed patches have been landed. Closing bug.
Mark S. Miller
Comment 31 2013-03-26 00:09:01 PDT
Created attachment 195019 [details] The bug still happens on the latest Nightly (part 1) I see that this bug is closed. But the attached screenshot shows that the latest Nightly still suffers from this bug.
Mark S. Miller
Comment 32 2013-03-26 00:10:41 PDT
Created attachment 195020 [details] The bug still happens on the latest Nightly (part 2)
Timothy Hatcher
Comment 33 2013-03-26 00:13:04 PDT
WebKit r146818 was built on 25 March 2013 and is a 47.5 MB download. This landed in r146840. Next build will have it.
Timothy Hatcher
Comment 34 2013-03-26 05:50:35 PDT
WebKit r146855 was built on 26 March 2013 and is a 47.4 MB download. Give it a try now.
Mark S. Miller
Comment 35 2013-03-26 12:15:58 PDT
Created attachment 195138 [details] Screenshot showing that the bug isn't fixed -- Part 1 (In reply to comment #34) > WebKit r146855 was built on 26 March 2013 and is a 47.4 MB download. > > Give it a try now. I just updated to the latest Nightly, which self-identifies as r146901 and 6.0.3 (8536.28.10, 537+). Attached is the first screenshot demonstrating that the bug still isn't fixed, but manifests differently. Second screenshot in next attachment
Mark S. Miller
Comment 36 2013-03-26 12:16:37 PDT
Created attachment 195139 [details] Screenshot showing that the bug isn't fixed -- Part 2
Timothy Hatcher
Comment 37 2013-03-26 13:04:01 PDT
Thanks Mark. Apparently my strict mode test stopped triggering strict mode due to a bug — and I totally missed this. I have a fix coming right up.
Timothy Hatcher
Comment 38 2013-03-26 13:05:21 PDT
Reopening.
Timothy Hatcher
Comment 39 2013-03-26 13:48:41 PDT
Created attachment 195156 [details] Proposed Additional Change
Joseph Pecoraro
Comment 40 2013-03-26 13:57:29 PDT
Comment on attachment 195156 [details] Proposed Additional Change r=me
Timothy Hatcher
Comment 41 2013-03-26 15:10:06 PDT
Comment on attachment 195156 [details] Proposed Additional Change https://trac.webkit.org/r146937
Blaze Burg
Comment 42 2014-01-25 15:43:55 PST
Migrating to new component. The patch has undoubtedly bitrotted.
Timothy Hatcher
Comment 43 2014-01-25 16:54:13 PST
This has been fixed in TOT and Safari 7 with a different approach.
Note You need to log in before you can comment on or make changes to this bug.