[Pkg-mozext-commits] [adblock-plus] 399/464: Provide an XMLHttpRequest constructor if used in JS modules
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:44:37 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 69f3d0a11b967da6f590e1f864b44ae4624a9fa0
Author: Wladimir Palant <trev at adblockplus.org>
Date: Thu Jul 25 14:34:58 2013 +0200
Provide an XMLHttpRequest constructor if used in JS modules
---
bootstrap.js.tmpl | 7 +++++++
packagerGecko.py | 3 +++
2 files changed, 10 insertions(+)
diff --git a/bootstrap.js.tmpl b/bootstrap.js.tmpl
index 704d26a..2284641 100644
--- a/bootstrap.js.tmpl
+++ b/bootstrap.js.tmpl
@@ -22,6 +22,10 @@ const Cu = Components.utils;
let {Services, atob, btoa, File} = Cu.import("resource://gre/modules/Services.jsm", null);
+{%- if hasXMLHttpRequest %}
+let XMLHttpRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1", "nsIXMLHttpRequest");
+{%- endif %}
+
let addonData = null;
function startup(params, reason)
@@ -159,6 +163,9 @@ function require(module)
{% if hasShutdownHandlers %}
onShutdown: onShutdown,
{% endif %}
+ {%- if hasXMLHttpRequest %}
+ XMLHttpRequest: XMLHttpRequest,
+ {% endif %}
exports: {}};
{%- if multicompartment %}
let principal = Cc["@mozilla.org/systemprincipal;1"].getService(Ci.nsIPrincipal);
diff --git a/packagerGecko.py b/packagerGecko.py
index 0ec8cc2..34b6c03 100644
--- a/packagerGecko.py
+++ b/packagerGecko.py
@@ -192,6 +192,7 @@ def addMissingFiles(params, files):
'hasChrome': False,
'hasChromeRequires': False,
'hasShutdownHandlers': False,
+ 'hasXMLHttpRequest': False,
'hasVersionPref': False,
'chromeWindows': [],
'requires': {},
@@ -206,6 +207,8 @@ def addMissingFiles(params, files):
templateData['requires'][match.group(1)] = True
if name.startswith('chrome/content/'):
templateData['hasChromeRequires'] = True
+ if name.startswith('lib/') and re.search(r'\bXMLHttpRequest\b', content):
+ templateData['hasXMLHttpRequest'] = True
if name == 'defaults/prefs.js':
if re.search(r'\.currentVersion"', content):
templateData['hasVersionPref'] = True
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list