New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 686003 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

DevTools and console code seem to share the same context.

Project Member Reported by petermarshall@chromium.org, Jan 27 2017

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.
 
iterator-bug.js
533 bytes View Download
probably due to debug-evaluate having slightly different behavior. will investigate.
Cc: yangguo@chromium.org
Owner: kozyatinskiy@chromium.org
Status: Assigned (was: Untriaged)
Description: Show this description
Cc: kozyatinskiy@chromium.org
Owner: l...@chromium.org
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.
Are you sure that doesn't trigger potential getters? I.e. are the arrays non-holey always?
It could definitely trigger getters. Would it be possible to use v8's C++ API to access the array elements?

Comment 7 by l...@chromium.org, 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.
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.

Comment 10 by l...@chromium.org, Mar 9 2017

Status: Fixed (was: Assigned)

Sign in to add a comment