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

Issue 682916 link

Starred by 9 users

Issue metadata

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



Sign in to add a comment

Calling console.clear() from iFrame also removes messages from parent document

Reported by nikhil...@gmail.com, Jan 20 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36

Steps to reproduce the problem:
1. Unzip the file attached.
2. Open index.html
3. View source for both HTML files
4. Check the console in dev tools. The iFrame clears messages of parent frame from the console.

What is the expected behavior?
When an iFrame calls console.clear() only those messages should get cleared from the console that were logged by that particular iFrame. An iFrame should not have permissions to clear console messages of parent document.

What went wrong?
Calling console.clear() on an iFramed document cleared the console completely, including for parent.

Did this work before? N/A 

Does this work in other browsers? No
 Firefox also  behaves in this way i.e., calling console.clear() from an iFrame clears the entire console, including messages from parent document.

Chrome version: 55.0.2883.95  Channel: stable
OS Version: OS X 10.12.2
Flash Version: Shockwave Flash 24.0 r0
 
iframe-console-clear-demo.zip
1.2 KB Download
Components: Blink>HTML>IFrame
Cc: rbasuvula@chromium.org
Labels: M-57
Status: Untriaged (was: Unconfirmed)
Tested the issue on chrome Stable #55.0.2883.95, Canary 57.0.2976.0 in Mac 10.12.2 and was able to reproduce the issue.

This is a Non-Regression issue since seeing this from M30 #30.0.1549.0, Making the status to Untriaged so that the issue would get addressed.

Note : Unable to test in Ubuntu 14.04 & win 10.0 with provided files.

Thank you!

Components: -Blink>HTML>IFrame Platform>DevTools Blink>JavaScript>API
Not sure exactly how console is wired up, but IIRC it's via V8 and there you're not dealing with iframes so much as contexts? Hopefully one of these labels gets the right engineer.
Owner: einbinder@chromium.org
Cc: yangguo@chromium.org
Components: -Blink>JavaScript>API
I think this is purely DevTools.
I just ran into an ad using this to cover up their code errors (and wiping out devtools coverage of the rest of the website).
Cc: einbinder@chromium.org dgozman@chromium.org
Owner: kozyatinskiy@chromium.org
Status: Assigned (was: Untriaged)
Yes, it's part of current inspector behavior. We can improve it and then console.clear will cleanup only message from current context, it sounds reasonable to me.
Dmitry, WDYT?
It worked like this for a long time. We should study how people use it before deciding.
3rd party content (usually ads) are the biggest problem as @orangewi... discovered. That is what originally led me to discover and report this bug.

But @dgozman's concern is also valid so I propose this: 
If the user opens devtools and types in console.clear() in any context, it clears the entire console for all contexts. But if a 3rd party script within an iFrame invokes console.clear() then it should only be allowed access to its own context.
Owner: kozy@chromium.org

Comment 12 by l...@chromium.org, Feb 1 2018

Cc: kozy@chromium.org vamshi.k...@techmahindra.com
 Issue 807329  has been merged into this issue.

Comment 13 by l...@chromium.org, May 29 2018

Cc: l...@chromium.org
 Issue 835841  has been merged into this issue.

Sign in to add a comment