yeonsh / smoothgestures-chromium

Automatically exported from code.google.com/p/smoothgestures-chromium
Other
0 stars 0 forks source link

chrome.tabs api only works on the options page #643

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Define custom action using the chrome.tabs api.
2.Attempt to use that action.
3.

What is the expected output? What do you see instead?
Should perform the actions requested. In this example, it should close the tab 
and select the one to the right.

Instead:
Nothing visible happens, but the following shows in the console (for the 
example below):

Error in event handler for (unknown): TypeError: Cannot call method 'query' of 
undefined
    at eval (eval at <anonymous> (chrome-extension://lfkgmnnajiljnolcgolmmgnecgldgeld/lib/gestures.js:130:32), <anonymous>:3:13)
    at receiveMessage (chrome-extension://lfkgmnnajiljnolcgolmmgnecgldgeld/lib/gestures.js:130:39)
    at Function.target.(anonymous function) (extensions::SafeBuiltins:19:14)
    at Event.dispatchToListener (event_bindings:382:22)
    at Event.dispatch_ (event_bindings:367:27)
    at Event.dispatch (event_bindings:388:17)
    at dispatchOnMessage (messaging:293:22)

What version of the product are you using? On what operating system?
Smooth Gestures 0.17.13
Chrome Version 30.0.1599.101
Linux Ubuntu 12.04 (kubuntu environment)

Please provide any additional information below.

Example action (should close tab and select the tab to the right):

chrome.tabs.query({lastFocusedWindow: true}, function(allTabs) {
    chrome.tabs.query({lastFocusedWindow: true, active: true}, function(activeTabArray) {
        var activeTab = activeTabArray[0]
        var newIndex = activeTab.index + 1
        if (newIndex == allTabs.length) {
            newIndex = 0
        }
        chrome.tabs.remove(activeTab.id)
        chrome.tabs.update(allTabs[newIndex].id, {selected: true});
    })
})

Original issue reported on code.google.com by Alex.S.H...@gmail.com on 31 Oct 2013 at 6:28

GoogleCodeExporter commented 8 years ago
For the record, this example works perfectly from the smooth gestures options 
page, but no where else.

Original comment by Alex.S.H...@gmail.com on 31 Oct 2013 at 6:31