Issue metadata
Sign in to add a comment
|
CommandLineAPI methods doesn't work when they are redefined in page context
Reported by
nikhilv2...@gmail.com,
Jun 3 2016
|
||||||||||||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Steps to reproduce the problem: 1. Navigate to meetup.com 2. open devtools >> console tab 3. enter inspect(document.getElementById('mainNav')) and press enter key What is the expected behavior? should highlight the element on 'Elements' panel(tab) What went wrong? returns undefined Did this work before? N/A Chrome version: 51.0.2704.79 Channel: stable OS Version: 6.3 Flash Version: Shockwave Flash 21.0 r0 meetup is a site where inspect() doesn't seem to work
,
Jun 4 2016
Meetup.Global = function(){
if (typeof(IS_DEV) == 'undefined'){
this.IS_DEV = false;
}
if (typeof(IS_QA) == 'undefined'){
this.IS_QA = false;
}
if (typeof(LOG) == 'undefined'){
this.LOG = { 'info': function() { return; }, 'error':function() { return; } };
this.inspect = function(){};
}
};
meetup.com override inspect function on global object and we don't override it with CommandLineAPI one.
So works as intended. I think we can provide another way to call CommandLineAPI methods in console. I won't close it right now and wait some time to get more feedback from users.
,
Jun 11 2016
I'm using this cmd in one of my extension. If the site is overriding this cmd, the functionality breaks. what would be the workaround for me to avoid it.
,
Oct 20 2016
Issue 657700 has been merged into this issue.
,
Oct 20 2016
Please, add those methods and properties to the console namespace somehow. Also - var console = 0; Ruins things as well. There should be a way to call those regardless of page definitions.
,
Dec 2 2016
,
Oct 13 2017
Here is magic workaround, in console you can run following commands to get command line api method (inspect for example): > var pageInspect = inspect; delete inspect; > dtInspect = inspect; > inspect = pageInspect; delete pageInspect; > dtInspet(..element..); each line should be evaluated separately, pageInspect should not he defined in page context before evaluation (you can use any other variable name if it's defined), after running each command dtInspect will contains DevTools command line API inspect method.
,
Oct 13 2017
Kayce, do we have web page which describes command line API, can we put this workround there?
,
Oct 13 2017
Note that we could detect that some of command line api functions are overridden and show an info badge with a link.
,
Oct 13 2017
,
Oct 14 2017
Also, why are those not added to the console object as well (or some other umbrella object that is only available in the Developer Tools)? This way, you would get all of those APIs by just getting back that object instead of going over all of the separate APIs and using that workaround for each of them. Plus, developers could query that object and see all of the options that the API provides (that object and console, but better than console and window, where you have many global members that are unrelated to the Developer Tools). It could have a long name (commandLineAPI), because it would only be used as a workaround/a way to query the API.
,
Oct 14 2017
These methods are not designed to be available all the time (like in case if we expose them on console object) and there is no way to introduce something with guarantee that user won't override it since our code should be executed at the same environment as any script in page context - and anything can be defined there (including commandLineAPI object). We will detect that method is overriden and provide single click action which will return requested method in temporary variable.
,
Oct 15 2017
What about the second use case (enumerating the APIs)?
,
Oct 16 2017
,
Dec 5
Bulk-closing low priority bugs / feature requests with no action plan. |
|||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||
Comment 1 by jonathan.garbee@chromium.org
, Jun 3 2016Status: Untriaged (was: Unconfirmed)
Confirmed on 52.0.2743.19 as well. `inspect` seems to be an empty function in the console. While on crbug it provides the proper output `function inspect(object) { [Command Line API ] }`, but doing something like `inspect($('.issueheader'))` returns null and does nothing. Marking as a regression bug. Thanks for the great report.