|
1 | 1 | // TODO: This keeps around history across "clear history" events. Fix that. |
2 | | -var switchPlannerMode = true; |
| 2 | +var switchPlannerEnabledFor = {}; |
3 | 3 | var switchPlannerInfo = {}; |
4 | 4 | console.log("XXX TESTING XXX"); |
5 | 5 |
|
@@ -147,7 +147,7 @@ function onBeforeRequest(details) { |
147 | 147 |
|
148 | 148 | // In Switch Planner Mode, record any non-rewriteable |
149 | 149 | // HTTP URIs by parent hostname, along with the resource type. |
150 | | - if (switchPlannerMode && uri.protocol() !== "https") { |
| 150 | + if (uri.protocol() !== "https") { |
151 | 151 | // In order to figure out the document requesting this resource, |
152 | 152 | // have to get the tab. TODO: any cheaper way? |
153 | 153 | // XXX: Because this is async it's actually inaccurate during quick page |
@@ -406,3 +406,14 @@ chrome.tabs.onReplaced.addListener(function(addedTabId, removedTabId) { |
406 | 406 | // Listen for cookies set/updated and secure them if applicable. This function is async/nonblocking, |
407 | 407 | // so we also use onBeforeSendHeaders to prevent a small window where cookies could be stolen. |
408 | 408 | chrome.cookies.onChanged.addListener(onCookieChanged); |
| 409 | + |
| 410 | +// Listen for connection from the DevTools panel so we can set up communication. |
| 411 | +chrome.runtime.onMessage.addListener(function(message){ |
| 412 | + console.log(message); |
| 413 | + if (message.hasOwnProperty('enable')) { |
| 414 | + var enable = message.enable; |
| 415 | + switchPlannerEnabledFor[message.tabId] = enable; |
| 416 | + if (!enable) |
| 417 | + switchPlannerInfo = {}; |
| 418 | + } |
| 419 | +}); |
0 commit comments