Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4d41ca9

Browse files
committedNov 20, 2013
replaced deprecated methods in background.js
1 parent cf469fd commit 4d41ca9

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed
 

‎build/chrome-extension-beta/background.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function handleIconClick(tab)
2121

2222
var isContentScriptActive = false;
2323

24-
chrome.tabs.sendRequest( tab.id, {name: "FB_isActive"},
24+
chrome.tabs.sendMessage( tab.id, {name: "FB_isActive"},
2525

2626
function(response)
2727
{
@@ -34,7 +34,7 @@ function handleIconClick(tab)
3434
else
3535
{
3636
setActivationStorage(tab);
37-
chrome.tabs.sendRequest(tab.id, {name: "FB_loadFirebug"});
37+
chrome.tabs.sendMessage(tab.id, {name: "FB_loadFirebug"});
3838
}
3939
}
4040
);
@@ -67,7 +67,7 @@ function handleTabChange(tabId, selectInfo)
6767
{
6868
var isUpdated = false;
6969

70-
chrome.tabs.sendRequest(tabId, {name: "FB_isActive"},
70+
chrome.tabs.sendMessage(tabId, {name: "FB_isActive"},
7171

7272
function(response)
7373
{
@@ -120,7 +120,7 @@ function handleUpdateTab(tabId, updateInfo, tab)
120120

121121
// *************************************************************************************************
122122

123-
chrome.extension.onRequest.addListener
123+
chrome.runtime.onMessage.addListener
124124
(
125125
function(request, sender, sendResponse)
126126
{
@@ -133,10 +133,10 @@ chrome.extension.onRequest.addListener
133133
else if (request.name == "FB_deactivate")
134134
{
135135
disableBrowserActionIcon();
136-
chrome.tabs.getSelected(null, function(tab){
137-
unsetActivationStorage(tab);
136+
chrome.tabs.query({currentWindow: true}, function(tab){
137+
unsetActivationStorage(tab[0].id);
138138

139-
chrome.tabs.sendRequest(tab.id, {name: "FB_deactivate"});
139+
chrome.tabs.sendMessage(tab[0].id, {name: "FB_deactivate"});
140140
});
141141
}
142142

@@ -150,7 +150,9 @@ chrome.contextMenus.create({
150150
title: "Inspect with Firebug Lite",
151151
"contexts": ["all"],
152152
onclick: function(info, tab) {
153-
chrome.tabs.sendRequest(tab.id, {name: "FB_contextMenuClick"});
153+
chrome.tabs.query({currentWindow: true}, function(tabs) {
154+
chrome.tabs.sendMessage(tabs[0].id, {name: "FB_contextMenuClick"});
155+
});
154156
}
155157
});
156158

0 commit comments

Comments
 (0)
Please sign in to comment.