Bug 756542 - Implement make files to include Add-on SDK modules in builds. r=gavin
--- a/toolkit/Makefile.in
+++ b/toolkit/Makefile.in
@@ -5,16 +5,17 @@
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
PARALLEL_DIRS = \
+ addon-sdk \
components \
content \
devtools \
identity \
locales \
mozapps/downloads \
mozapps/extensions \
mozapps/handling \
new file mode 100644
--- /dev/null
+++ b/toolkit/addon-sdk/Makefile.in
@@ -0,0 +1,23 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEPTH = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/config.mk
+
+DIRS += \
+ promise \
+ $(NULL)
+
+JS_MODULES_PATH := $(FINAL_TARGET)/modules/commonjs
+
+EXTRA_JS_MODULES := \
+ loader.js \
+ $(NULL)
+
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/addon-sdk/loader.js
+++ b/toolkit/addon-sdk/loader.js
@@ -4,29 +4,30 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
;(function(id, factory) { // Module boilerplate :(
if (typeof(define) === 'function') { // RequireJS
define(factory);
} else if (typeof(require) === 'function') { // CommonJS
factory.call(this, require, exports, module);
} else if (~String(this).indexOf('BackstagePass')) { // JSM
+ this[factory.name] = {};
factory(function require(uri) {
var imports = {};
this['Components'].utils.import(uri, imports);
return imports;
- }, this, { uri: __URI__, id: id });
- this.EXPORTED_SYMBOLS = Object.keys(this);
+ }, this[factory.name], { uri: __URI__, id: id });
+ this.EXPORTED_SYMBOLS = [factory.name];
} else { // Browser or alike
var globals = this
factory(function require(id) {
return globals[id];
}, (globals[id] = {}), { uri: document.location.href + '#' + id, id: id });
}
-}).call(this, 'loader', function(require, exports, module) {
+}).call(this, 'loader', function Loader(require, exports, module) {
'use strict';
const { classes: Cc, Constructor: CC, interfaces: Ci, utils: Cu,
results: Cr, manager: Cm } = Components;
const systemPrincipal = CC('@mozilla.org/systemprincipal;1', 'nsIPrincipal')();
const { loadSubScript } = Cc['@mozilla.org/moz/jssubscript-loader;1'].
getService(Ci.mozIJSSubScriptLoader);
new file mode 100644
--- /dev/null
+++ b/toolkit/addon-sdk/promise/Makefile.in
@@ -0,0 +1,19 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEPTH = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/config.mk
+
+JS_MODULES_PATH := $(FINAL_TARGET)/modules/commonjs/promise
+
+EXTRA_JS_MODULES := \
+ core.js \
+ $(NULL)
+
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/addon-sdk/promise/core.js
+++ b/toolkit/addon-sdk/promise/core.js
@@ -3,29 +3,30 @@
forin: true latedef: false */
/*global define: true, Cu: true, __URI__: true */
;(function(id, factory) { // Module boilerplate :(
if (typeof(define) === 'function') { // RequireJS
define(factory);
} else if (typeof(require) === 'function') { // CommonJS
factory.call(this, require, exports, module);
} else if (String(this).indexOf('BackstagePass') >= 0) { // JSM
+ this[factory.name] = {};
factory(function require(uri) {
var imports = {};
this['Components'].utils.import(uri, imports);
return imports;
- }, this, { uri: __URI__, id: id });
- this.EXPORTED_SYMBOLS = Object.keys(this);
+ }, this[factory.name], { uri: __URI__, id: id });
+ this.EXPORTED_SYMBOLS = [factory.name];
} else { // Browser or alike
var globals = this;
factory(function require(id) {
return globals[id];
}, (globals[id] = {}), { uri: document.location.href + '#' + id, id: id });
}
-}).call(this, 'promise/core', function(require, exports, module) {
+}).call(this, 'promise/core', function Promise(require, exports, module) {
'use strict';
/**
* Internal utility: Wraps given `value` into simplified promise, successfully
* fulfilled to a given `value`. Note the result is not a complete promise
* implementation, as its method `then` does not returns anything.
*/