arthurakay
arthurakay

Reputation: 5651

Chrome Extension - accessing chrome.devtools.inspectedWindow from a context menu

I am creating a context menu for my Chrome DevTools extension like so:

var CONTEXT_MENU = chrome.contextMenus.create({
    'title'    : 'My Context Menu',
    'contexts' : ['all'],

    'onclick' : function (info, tab) {
        alert(chrome.devtools); //[Object object]
        alert(chrome.devtools.inspectedWindow) //crashes the extension
    }
});

The idea here is that my extension caches some data in the inspected window (e.g. the last-clicked DOM element) and I'd like to do something with that data when the user clicks my context menu (namely pass that data into my devtools extension pane).

Whenever I try to access the inspectedWindow property from inside the context menu handler, my extension crashes. Is this property protected for some reason? How else might I achieve this?

Upvotes: 2

Views: 508

Answers (1)

Paul Irish
Paul Irish

Reputation: 49142

As this is a bug it's probably best to just file it at http://crbug.com and an engineer can address that. Thanks

Upvotes: 1

Related Questions