Skip to content
This repository has been archived by the owner on Sep 12, 2019. It is now read-only.

Commit

Permalink
Merge pull request #20 from bsiegel/master
Browse files Browse the repository at this point in the history
Fixes to support e10s Firefox
  • Loading branch information
chengsun committed Apr 28, 2016
2 parents 3dbc2a2 + 080df48 commit 90545ac
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
47 changes: 35 additions & 12 deletions chrome/content/indicator.jsm
Expand Up @@ -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
Expand Down Expand Up @@ -93,7 +92,21 @@ 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 {
try {
domWindow = loadContext.associatedWindow;
} catch (e) {}
}

if (!domWindow) return;
let window = getChromeWindow(domWindow);

Expand All @@ -108,7 +121,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;
}
Expand Down Expand Up @@ -267,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);
Expand Down Expand Up @@ -304,21 +317,31 @@ 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,

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") || [];
Expand Down
2 changes: 1 addition & 1 deletion install.rdf
Expand Up @@ -3,7 +3,7 @@
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>spdyindicator@chengsun.github.com</em:id>
<em:version>2.2</em:version>
<em:version>2.3</em:version>
<em:type>2</em:type>
<em:bootstrap>true</em:bootstrap>

Expand Down

0 comments on commit 90545ac

Please sign in to comment.