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

Unified Diff: chrome/content/ui/sidebar.js

Issue 29333172: Issue 3259 - Store blockable items selection in the content process (Closed)
Patch Set: Created Jan. 4, 2016, 8:08 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/child/requestNotifier.js » ('j') | lib/requestNotifier.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/ui/sidebar.js
===================================================================
--- a/chrome/content/ui/sidebar.js
+++ b/chrome/content/ui/sidebar.js
@@ -84,19 +84,18 @@ function init() {
defaults = params.position;
let wnd = parent.document.documentElement;
for (let attr in defaults)
if (!wnd.hasAttribute(attr))
wnd.setAttribute(attr, defaults[attr]);
}
- let {getBrowser, addBrowserLocationListener} = require("appSupport");
+ let {addBrowserLocationListener} = require("appSupport");
updateContentLocation();
- Object.defineProperty(window, "content", { get: () => getBrowser(mainWin).contentWindow });
// Initialize matcher for disabled filters
reloadDisabledFilters();
FilterNotifier.addListener(reloadDisabledFilters);
Prefs.addListener(onPrefChange);
// Activate flasher
list.addEventListener("select", onSelectionChange, false);
@@ -121,16 +120,25 @@ function updateContentLocation()
{
let {getCurrentLocation} = require("appSupport");
let location = getCurrentLocation(mainWin);
if (location instanceof Ci.nsIURI)
location = location.spec;
contentLocation = location;
}
+function getOuterWindowID()
+{
+ let {getBrowser} = require("appSupport");
+ let browser = getBrowser(mainWin);
+ if ("selectedBrowser" in browser)
+ browser = browser.selectedBrowser;
+ return browser.outerWindowID;
+}
+
function getFilter(item)
{
if ("filter" in item && item.filter)
return Filter.fromText(item.filter);
else
return null;
}
@@ -197,43 +205,41 @@ function reloadDisabledFiltersInternal()
// Called whenever list selection changes - triggers flasher
function onSelectionChange() {
var item = treeView.getSelectedItem();
if (item)
E("copy-command").removeAttribute("disabled");
else
E("copy-command").setAttribute("disabled", "true");
- if (item && window.content)
+ if (item)
{
let key = item.location + " " + item.type + " " + item.docDomain;
- RequestNotifier.storeSelection(window.content, key);
+ RequestNotifier.storeWindowData(getOuterWindowID(), key);
treeView.itemToSelect = null;
}
if (requestNotifier)
requestNotifier.flashNodes(item ? item.ids : null, Prefs.flash_scrolltoitem);
}
function handleLocationChange()
{
if (requestNotifier)
requestNotifier.shutdown();
updateContentLocation();
treeView.clearData();
- let {getBrowser, addBrowserLocationListener} = require("appSupport");
- let browser = getBrowser(mainWin);
- if ("selectedBrowser" in browser)
- browser = browser.selectedBrowser;
- let outerWindowID = browser.outerWindowID;
- if (window.content)
- treeView.itemToSelect = RequestNotifier.getSelection(window.content);
- requestNotifier = new RequestNotifier(outerWindowID, function(item, scanComplete)
+ let outerWindowID = getOuterWindowID();
+ RequestNotifier.retrieveWindowData(outerWindowID, key =>
+ {
+ treeView.itemToSelect = key;
+ });
+ requestNotifier = new RequestNotifier(outerWindowID, (item, scanComplete) =>
{
if (item)
treeView.addItem(item, scanComplete);
});
cacheStorage = null;
}
// Fills a box with text splitting it up into multiple lines if necessary
« no previous file with comments | « no previous file | lib/child/requestNotifier.js » ('j') | lib/requestNotifier.js » ('J')

Powered by Google App Engine
This is Rietveld