DevTools and console code seem to share the same context. |
|||||
Issue description
Chrome Version: All
Running certain code in d8 and the DevConsole gives different results - sometimes surprisingly. e.g. setting Symbol.iterator on Array.prototype causes all sorts of strange behaviour - presumably because DevTools is iterating over things in order to print out values, inspect objects etc.
What steps will reproduce the problem?
(1) Run the attached code in the chromium console
(2) Look at the variable 'r'.
What is the expected result?
RestPoint {x: "a", y: "b", z: 20}
What happens instead?
RestPoint {a: undefined, b: undefined}
If you uncomment the commented line at the end of the file, this resets the array iterator right before inspecting the variable 'r'. Then the expected result is shown.
Is this intentional? It makes it quite tricky to debug some pieces of code.
,
Jan 30 2017
,
Jan 30 2017
,
Jan 30 2017
I think we use var .. of for arrays in injected-script-source.js and we should use var i = 0; i < a.length.. for them. Eric, please take a look.
,
Jan 31 2017
Are you sure that doesn't trigger potential getters? I.e. are the arrays non-holey always?
,
Jan 31 2017
It could definitely trigger getters. Would it be possible to use v8's C++ API to access the array elements?
,
Jan 31 2017
Ideally, injected script source could be migrated into native code. In the short term, kozy@'s suggestion sounds like the simplest solution without introducing a new InjectedScriptHost method.
,
Jan 31 2017
It triggers some getters. And yes, as Erik mentioned, we'd like to move our injected-script-source to native code to avoid possible side effects, but currently it's not our high priority and we prefer just fixing related issues.
,
Mar 3 2017
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/3a20c322bbc26b453ce9c3c3b83094af2fb722f2 commit 3a20c322bbc26b453ce9c3c3b83094af2fb722f2 Author: luoe <luoe@chromium.org> Date: Fri Mar 03 19:30:40 2017 [inspector] remove iterators and for...of loops from injected-script-source BUG= chromium:686003 Review-Url: https://codereview.chromium.org/2705533002 Cr-Commit-Position: refs/heads/master@{#43595} [modify] https://crrev.com/3a20c322bbc26b453ce9c3c3b83094af2fb722f2/src/inspector/injected-script-source.js [modify] https://crrev.com/3a20c322bbc26b453ce9c3c3b83094af2fb722f2/test/inspector/inspector-impl.cc [modify] https://crrev.com/3a20c322bbc26b453ce9c3c3b83094af2fb722f2/test/inspector/inspector-impl.h [modify] https://crrev.com/3a20c322bbc26b453ce9c3c3b83094af2fb722f2/test/inspector/inspector-test.cc [modify] https://crrev.com/3a20c322bbc26b453ce9c3c3b83094af2fb722f2/test/inspector/runtime/evaluate-with-generate-preview-expected.txt [modify] https://crrev.com/3a20c322bbc26b453ce9c3c3b83094af2fb722f2/test/inspector/runtime/evaluate-with-generate-preview.js [modify] https://crrev.com/3a20c322bbc26b453ce9c3c3b83094af2fb722f2/test/inspector/runtime/get-properties-expected.txt [modify] https://crrev.com/3a20c322bbc26b453ce9c3c3b83094af2fb722f2/test/inspector/runtime/get-properties.js
,
Mar 9 2017
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by yangguo@chromium.org
, Jan 27 2017