From 5df97c5063d758d1c817fab11ed87d1399281859 Mon Sep 17 00:00:00 2001 From: Infocatcher Date: Mon, 20 Feb 2017 23:33:10 +0300 Subject: [PATCH] =?UTF-8?q?Don't=20use=20io.newChannelFromURIWithLoadInfo(?= =?UTF-8?q?=E2=80=A6,=20null)=20in=20Firefox=2037-43=20Also=20see=20https:?= =?UTF-8?q?//bugzilla.mozilla.org/show=5Fbug.cgi=3Fid=3D1182571=20(closes?= =?UTF-8?q?=20#247)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocol.jsm | 3 ++- protocolRedirect.html | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/protocol.jsm b/protocol.jsm index f102276..7293aca 100644 --- a/protocol.jsm +++ b/protocol.jsm @@ -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); diff --git a/protocolRedirect.html b/protocolRedirect.html index 5df9116..03fb84c 100644 --- a/protocolRedirect.html +++ b/protocolRedirect.html @@ -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;