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

Unified Diff: lib/appSupport.js

Issue 29322679: Issue 1730 - Fixed abp:subscribe functionality with e10s (Closed)
Patch Set: Created July 20, 2015, 3:19 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
Index: lib/appSupport.js
===================================================================
--- a/lib/appSupport.js
+++ b/lib/appSupport.js
@@ -207,58 +207,16 @@ exports.removeBrowserLocationListeners =
{
let listeners = progressListeners.get(window);
for (let i = 0; i < listeners.length; i++)
browser.removeProgressListener(listeners[i]);
}
progressListeners.delete(window);
};
-/**
- * Maps windows to a list of click listeners.
- */
-let clickListeners = new WeakMap();
-
-/**
- * Makes sure that a function is called whenever the user clicks inside the
- * browser's content area.
- */
-exports.addBrowserClickListener = function addBrowserClickListener(/**Window*/ window, /**Function*/ callback)
-{
- let browser = (exports.getBrowser ? exports.getBrowser(window) : null);
- if (browser)
- {
- browser.addEventListener("click", callback, true);
-
- if (clickListeners.has(window))
- clickListeners.get(window).push(callback);
- else
- clickListeners.set(window, [callback]);
- }
-};
-
-/**
- * Removes all click listeners registered for a window, to be called on
- * cleanup.
- */
-exports.removeBrowserClickListeners = function removeBrowserClickListeners(/**Window*/ window)
-{
- if (!clickListeners.has(window))
- return;
-
- let browser = (exports.getBrowser ? exports.getBrowser(window) : null);
- if (browser)
- {
- let listeners = clickListeners.get(window);
- for (let i = 0; i < listeners.length; i++)
- browser.removeEventListener("click", listeners[i], true);
- }
- clickListeners.delete(window);
-};
-
let {application} = require("info");
switch (application)
{
case "firefox":
{
exports.isKnownWindow = function ff_isKnownWindow(window)
{
return (window.document.documentElement.getAttribute("windowtype") == "navigator:browser");
@@ -354,17 +312,17 @@ switch (application)
}
}
else
{
let browser = exports.getBrowser(window);
return (browser ? browser.currentURI : null);
}
};
-
+
// for Seamonkey we have to ignore same document flag because of
// bug #1035171 (https://bugzilla.mozilla.org/show_bug.cgi?id=1035171)
let origAddBrowserLocationListener = exports.addBrowserLocationListener;
exports.addBrowserLocationListener = function sm_addBrowserLocationListener(window, callback, ignoreSameDoc)
{
origAddBrowserLocationListener(window, callback, false);
};
@@ -612,50 +570,16 @@ switch (application)
let index = ("gMessageListeners" in window ? window.gMessageListeners.indexOf(messageListener) : -1);
if (index >= 0)
window.gMessageListeners.splice(index, 1);
listener.detach();
progressListeners.delete(window);
};
- exports.addBrowserClickListener = function addBrowserClickListener(/**Window*/ window, /**Function*/ callback)
- {
- if (clickListeners.has(window))
- {
- clickListeners.get(window).callbacks.push(callback);
- return;
- }
-
- let callbacks = [callback];
- let listener = new BrowserChangeListener(window, function(oldBrowser, newBrowser)
- {
- if (oldBrowser)
- for (let i = 0; i < callbacks.length; i++)
- oldBrowser.removeEventListener("click", callbacks[i], true);
- if (newBrowser)
- for (let i = 0; i < callbacks.length; i++)
- newBrowser.addEventListener("click", callbacks[i], true);
- });
- listener.callbacks = callbacks;
-
- clickListeners.set(window, listener);
- };
-
- exports.removeBrowserClickListeners = function removeBrowserClickListeners(/**Window*/ window)
- {
- if (!clickListeners.has(window))
- return;
-
- let listener = clickListeners.get(window);
- listener.detach();
-
- clickListeners.delete(window);
- };
-
// Make sure to close/reopen list of blockable items when the user changes tabs
let {WindowObserver} = require("windowObserver");
new WindowObserver({
listeners: new WeakMap(),
applyToWindow: function(window)
{
if (!exports.isKnownWindow(window) || this.listeners.has(window))
return;
@@ -801,50 +725,16 @@ switch (application)
if (!progressListeners.has(window))
return;
let listener = progressListeners.get(window);
listener.detach();
progressListeners.delete(window);
};
- exports.addBrowserClickListener = function ffn_addBrowserClickListener(/**Window*/ window, /**Function*/ callback)
- {
- if (clickListeners.has(window))
- {
- clickListeners.get(window).callbacks.push(callback);
- return;
- }
-
- let callbacks = [callback];
- let listener = new BrowserChangeListener(window, function(oldBrowser, newBrowser)
- {
- if (oldBrowser)
- for (let i = 0; i < callbacks.length; i++)
- oldBrowser.removeEventListener("click", callbacks[i], true);
- if (newBrowser)
- for (let i = 0; i < callbacks.length; i++)
- newBrowser.addEventListener("click", callbacks[i], true);
- });
- listener.callbacks = callbacks;
-
- clickListeners.set(window, listener);
- };
-
- exports.removeBrowserClickListeners = function ffn_removeBrowserClickListeners(/**Window*/ window)
- {
- if (!clickListeners.has(window))
- return;
-
- let listener = clickListeners.get(window);
- listener.detach();
-
- clickListeners.delete(window);
- };
-
let {Filter} = require("filterClasses");
let {Prefs} = require("prefs");
let {Policy} = require("contentPolicy");
let {UI} = require("ui");
let {Utils} = require("utils");
let toggleWhitelist = function(window)
{

Powered by Google App Engine
This is Rietveld