Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/ext/content.js

Issue 5186743326212096: Issue 1843 - Deactivate "Block element" dialog when extension is disabled/uninstalled/reloaded (Closed)
Patch Set: Created Jan. 23, 2015, 9:47 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) 1 chrome.runtime.onMessage.addListener(function(message, sender, sendResponse)
2 { 2 {
3 return ext.onMessage._dispatch(message, {}, sendResponse).indexOf(true) != -1; 3 return ext.onMessage._dispatch(message, {}, sendResponse).indexOf(true) != -1;
4 }); 4 });
5
6 ext.onExtensionUnloaded = (function()
7 {
8 var port = null;
9
10 return {
11 addListener: function(listener)
12 {
13 if (!port)
14 port = chrome.runtime.connect();
15
16 // When the extension is reloaded, disabled or uninstalled the
17 // background page dies and automatically disconnects all ports
18 port.onDisconnect.addListener(listener);
19 },
20 removeListener: function(listener)
21 {
22 if (port)
23 {
24 port.onDisconnect.removeListener(listener)
25
26 if (!port.onDisconnect.hasListeners())
27 {
28 port.disconnect();
29 port = null;
30 }
31 }
32 }
33 };
34 })();
OLDNEW
« chrome/ext/background.js ('K') | « chrome/ext/background.js ('k') | include.postload.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld