[Pkg-mozext-commits] [greasemonkey] 32/62: <tabbrowser>.addTab - it sometimes throws the error
David Prévot
taffit at moszumanska.debian.org
Sun Sep 13 22:10:22 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository greasemonkey.
commit 5f7754805b92257d4e952575e8b0beed0c8b6446
Author: janekptacijarabaci <janekptacijarabaci at seznam.cz>
Date: Sat Aug 22 12:48:33 2015 +0200
<tabbrowser>.addTab - it sometimes throws the error
---
modules/remoteScript.js | 10 +++++++++-
modules/scriptProtocol.js | 11 ++++++++++-
modules/util/getBinaryContents.js | 14 ++++++++++++--
modules/util/getContents.js | 12 +++++++++++-
4 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/modules/remoteScript.js b/modules/remoteScript.js
index 305d5a1..a0d5075 100644
--- a/modules/remoteScript.js
+++ b/modules/remoteScript.js
@@ -10,6 +10,7 @@ Components.utils.import('chrome://greasemonkey-modules/content/scriptIcon.js');
Components.utils.import('chrome://greasemonkey-modules/content/util.js');
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+Components.utils.import("resource://gre/modules/Services.jsm");
var GM_config = GM_util.getService().config;
var ioService = Cc['@mozilla.org/network/io-service;1']
@@ -578,7 +579,14 @@ RemoteScript.prototype._downloadFile = function(
}
}
- var channel = ioService.newChannelFromURI(aUri);
+ var channel = null;
+ if (ioService.newChannelFromURI2) {
+ channel = ioService.newChannelFromURI2(
+ aUri, null, Services.scriptSecurityManager.getSystemPrincipal(),
+ null, Ci.nsILoadInfo.SEC_NORMAL, Ci.nsIContentPolicy.TYPE_OTHER);
+ } else {
+ channel = ioService.newChannelFromURI(aUri);
+ }
channel.loadFlags |= channel.LOAD_BYPASS_CACHE;
this._channels.push(channel);
var dsl = new DownloadListener(
diff --git a/modules/scriptProtocol.js b/modules/scriptProtocol.js
index 28bf587..75861ff 100644
--- a/modules/scriptProtocol.js
+++ b/modules/scriptProtocol.js
@@ -1,6 +1,7 @@
var EXPORTED_SYMBOLS = ['initScriptProtocol'];
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import('chrome://greasemonkey-modules/content/util.js');
var Cc = Components.classes;
@@ -147,7 +148,15 @@ var ScriptProtocol = {
// In parent scope we have the raw script, with file intact.
uri = GM_util.getUriFromFile(resource.file);
}
- return ioService.newChannelFromURI(uri);
+ var channel = null;
+ if (ioService.newChannelFromURI2) {
+ channel = ioService.newChannelFromURI2(
+ uri, null, Services.scriptSecurityManager.getSystemPrincipal(),
+ null, Ci.nsILoadInfo.SEC_NORMAL, Ci.nsIContentPolicy.TYPE_OTHER);
+ } else {
+ channel = ioService.newChannelFromURI(uri);
+ }
+ return channel;
}
}
diff --git a/modules/util/getBinaryContents.js b/modules/util/getBinaryContents.js
index dc4cd0d..2c048fe 100644
--- a/modules/util/getBinaryContents.js
+++ b/modules/util/getBinaryContents.js
@@ -1,3 +1,4 @@
+Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import('chrome://greasemonkey-modules/content/util.js');
var EXPORTED_SYMBOLS = ['getBinaryContents'];
@@ -5,8 +6,17 @@ var EXPORTED_SYMBOLS = ['getBinaryContents'];
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
-function getBinaryContents(file) {
- var channel = ioService.newChannelFromURI(GM_util.getUriFromFile(file));
+function getBinaryContents(aFile) {
+ var channel = null;
+ if (ioService.newChannelFromURI2) {
+ channel = ioService.newChannelFromURI2(
+ GM_util.getUriFromFile(aFile), null,
+ Services.scriptSecurityManager.getSystemPrincipal(), null,
+ Components.interfaces.nsILoadInfo.SEC_NORMAL,
+ Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ } else {
+ channel = ioService.newChannelFromURI(GM_util.getUriFromFile(aFile));
+ }
var input = channel.open();
var bstream = Components.classes["@mozilla.org/binaryinputstream;1"]
diff --git a/modules/util/getContents.js b/modules/util/getContents.js
index a017efd..29802ba 100644
--- a/modules/util/getContents.js
+++ b/modules/util/getContents.js
@@ -1,3 +1,4 @@
+Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import('chrome://greasemonkey-modules/content/util.js');
var EXPORTED_SYMBOLS = ['getContents'];
@@ -18,7 +19,16 @@ function getContents(aFile, aCharset, aFatal) {
}
unicodeConverter.charset = aCharset || 'UTF-8';
- var channel = ioService.newChannelFromURI(GM_util.getUriFromFile(aFile));
+ var channel = null;
+ if (ioService.newChannelFromURI2) {
+ channel = ioService.newChannelFromURI2(
+ GM_util.getUriFromFile(aFile), null,
+ Services.scriptSecurityManager.getSystemPrincipal(), null,
+ Components.interfaces.nsILoadInfo.SEC_NORMAL,
+ Components.interfaces.nsIContentPolicy.TYPE_OTHER);
+ } else {
+ channel = ioService.newChannelFromURI(GM_util.getUriFromFile(aFile));
+ }
try {
var input = channel.open();
} catch (e) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git
More information about the Pkg-mozext-commits
mailing list