From c73d5336518307c6c5c16ee0f502b80a7bae001d Mon Sep 17 00:00:00 2001 From: Brandon Siegel Date: Tue, 12 Apr 2016 11:45:30 -0400 Subject: [PATCH 1/3] Fixes to support e10s Firefox --- chrome/content/indicator.jsm | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/chrome/content/indicator.jsm b/chrome/content/indicator.jsm index a974db6..6067ec0 100644 --- a/chrome/content/indicator.jsm +++ b/chrome/content/indicator.jsm @@ -21,8 +21,7 @@ function getLoadContext(request) { } catch (e) {} } - if (!loadContext) return null; - return loadContext.associatedWindow; + return loadContext; } // get the chrome window from a content window @@ -93,7 +92,19 @@ var SPDYManager = { if (!spdyHeader || !spdyHeader.length) return; // find the browser which this request originated from - let domWindow = getLoadContext(subject); + let loadContext = getLoadContext(subject); + if (!loadContext) return; + + let browser = loadContext.topFrameElement; + let domWindow = null; + + if (browser) { + domWindow = browser.contentWindow + .QueryInterface(Ci.nsISupports); + } else { + domWindow = loadContext.associatedWindow; + } + if (!domWindow) return; let window = getChromeWindow(domWindow); @@ -108,7 +119,7 @@ var SPDYManager = { if (!indicator) { debug("Could not find indicator from chrome window for request"); } else { - indicator.spdyRequested(domWindow, subject.URI, spdyHeader); + indicator.spdyRequested(domWindow, browser, subject.URI, spdyHeader); } break; } @@ -314,11 +325,13 @@ SPDYIndicator.prototype = { }, _update_bound: null, - spdyRequested: function (domWindow, uri, version) { + spdyRequested: function (domWindow, browser, uri, version) { debug("Requested " + uri.asciiSpec); debug("SPDY Version " + version); - let browser = this.browser.getBrowserForDocument(domWindow.top.document); + if (!browser) { + browser = this.browser.getBrowserForDocument(domWindow.top.document); + } if (!browser) return; let spdyRequests = browser.getUserData("__spdyindicator_spdyrequests") || []; From 9a97622d1a7f20024bf82167c9189b8be09605bd Mon Sep 17 00:00:00 2001 From: Brandon Siegel Date: Tue, 12 Apr 2016 12:45:01 -0400 Subject: [PATCH 2/3] Fix discovered issues --- chrome/content/indicator.jsm | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/chrome/content/indicator.jsm b/chrome/content/indicator.jsm index 6067ec0..683838d 100644 --- a/chrome/content/indicator.jsm +++ b/chrome/content/indicator.jsm @@ -102,7 +102,9 @@ var SPDYManager = { domWindow = browser.contentWindow .QueryInterface(Ci.nsISupports); } else { - domWindow = loadContext.associatedWindow; + try { + domWindow = loadContext.associatedWindow; + } catch (e) {} } if (!domWindow) return; @@ -278,7 +280,7 @@ SPDYIndicator.prototype = { }, setState: function (browser, newState) { browser.setUserData("__spdyindicator_state", newState, null); - this.update(); + this.updateIndicator(browser); }, updateState: function (browser, newState) { let oldState = this.getState(browser); @@ -315,13 +317,21 @@ SPDYIndicator.prototype = { }, update: function () { - let state = this.getState(this.browser.selectedBrowser); + this.updateIndicator(this.browser.selectedBrowser); + }, + + updateIndicator: function(browser) { // change indicator state let indicator = this.window.document.getElementById("spdyindicator-icon"); - let indicatorState = SPDYManager.indicatorStates[state]; - indicator.setAttribute("hidden", state < SPDYManager.getMinShowState()); - indicator.setAttribute("state", indicatorState.name); - indicator.setAttribute("tooltiptext", indicatorState.tooltip); + if (indicator) { + let state = this.getState(browser); + let indicatorState = SPDYManager.indicatorStates[state]; + indicator.setAttribute("hidden", state < SPDYManager.getMinShowState()); + indicator.setAttribute("state", indicatorState.name); + indicator.setAttribute("tooltiptext", indicatorState.tooltip); + } else { + debug("SPDYIndicator could not find icon element"); + } }, _update_bound: null, From 080df485b726dc2f704a32c2fdbb61eff32ecbe0 Mon Sep 17 00:00:00 2001 From: Brandon Siegel Date: Tue, 12 Apr 2016 12:19:36 -0400 Subject: [PATCH 3/3] Update metadata for version 2.3 --- install.rdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.rdf b/install.rdf index c839dd3..4795024 100644 --- a/install.rdf +++ b/install.rdf @@ -3,7 +3,7 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#"> spdyindicator@chengsun.github.com - 2.2 + 2.3 2 true