New issue
Advanced search Search tips

Issue 716306 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Can't change console context when debugger is paused

Project Member Reported by sdy@chromium.org, Apr 28 2017

Issue description

Chrome Version: 60.0.3082.3
OS: macOS 10.12.4

What steps will reproduce the problem?
(1) Visit this URI: data:text/html,<iframe src="data:text/html,<button onclick=debugger;>debugger;</button>"></iframe>
(2) Open the dev tools.
(3) Click the "debugger;" button on the page.
(4) Run "document" in the console.

What is the expected result?
`document` represents the top document, since "top" is selected in the dropdown above the console.

What happens instead?
`document` represents the iframe. Changing the selection in the dropdown doesn't change the console context.

When the debugger isn't paused, the context can be changed.
 

Comment 1 by sdy@chromium.org, Apr 28 2017

Summary: Can't change console context when debugger is paused in an iframe (was: Can't change console )

Comment 2 by sdy@chromium.org, Apr 28 2017

Cc: kozyatinskiy@chromium.org
Summary: Can't change console context when debugger is paused (was: Can't change console context when debugger is paused in an iframe)
Possibly related to  issue 498454 ?
Owner: dgozman@chromium.org
Status: Assigned (was: Untriaged)
While on pause, we evaluate everything in the context of selected call frame from Callstack pane. I think we should disable context selector in console to make it more obvious.
Patch from #c5 makes it impossible to select wrong context when on pause. That's not the best solution, but it will serve fine.
1. @4: The only time a context-selector even seems meaningful is when the code is paused, since DOM structure may not be static when code is running -- aside from all the program objects that are also constantly changing and going in and out of existence, and maybe even continuous program-status dumps flooding the console.

2. It is hard enough to follow complex code without having to repeatedly change source-code views (by changing call-frames) just to see the values of objects isolated in/from iframes.

3. Finally and MOST IMPORTANTLY, when paused in iframe code there may not even be any top-level-document call frames in the call stack to be selected, and when paused in top-level-document code there may not be call frames in the stack for any iframes, so simply selecting the needed call frame may not even be possible. Also remember, top.document may be blocked by cross-origin policy.


Ref: Try debugging pages like these:
http://www.gamesgames.com/game/sweet-candies
http://www.crunchyroll.com/no-game-no-life/episode-1-beginner-653163

---

TWIMC: Given all the closures, promises, proxy objects, deeply nested anonymous functions, dynamic bindings, applied and default parameters, minifying, and other such "hidden" and obscured connections there are now between local functions and the rest of the code, JS is now far worse to debug than even goto-style code is.

Cc: -kozyatinskiy@chromium.org
Owner: kozyatinskiy@chromium.org
Owner: kozy@chromium.org

Sign in to add a comment