Skip to content

Commit

Permalink
Don't use io.newChannelFromURIWithLoadInfo(…, null) in Firefox 37-43
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Feb 20, 2017
1 parent f713005 commit 5df97c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion protocol.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ var privateProtocol = {
// Also we can't use nsIPrivateBrowsingChannel.setPrivate(true) for chrome:// URI
var redirect = "chrome://privatetab/content/protocolRedirect.html#" + newSpec;
var channel = "newChannelFromURIWithLoadInfo" in Services.io // Firefox 37+
&& (loadInfo || parseFloat(Services.appinfo.platformVersion) >= 44) // Throws in Firefox 37-43 with null nsILoadInfo
? Services.io.newChannelFromURIWithLoadInfo(
Services.io.newURI(redirect, null, null),
loadInfo
)
: Services.io.newChannel(redirect, null, null); // Removed in Firefox 48+
: Services.io.newChannel(redirect, null, null); // Deprecated in Firefox 48+
var ensurePrivate = function(reason) {
_log(reason + " => ensurePrivate()");
this.makeChannelPrivate(channel);
Expand Down
1 change: 1 addition & 0 deletions protocolRedirect.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
// Validate URI
var uri = Services.io.newURI(spec, null, null);
var testChannel = "newChannelFromURIWithLoadInfo" in Services.io // Firefox 37+
&& parseFloat(Services.appinfo.platformVersion) >= 44 // Throws in Firefox 37-43 with null nsILoadInfo
? Services.io.newChannelFromURIWithLoadInfo(uri, null)
: Services.io.newChannelFromURI(uri); // Deprecated in Firefox 48+
document.title = getLoadingTitle() || spec;
Expand Down

0 comments on commit 5df97c5

Please sign in to comment.