mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge pull request #7569 from meteor/fix-misbehaving-promise-polyfill
Fix misbehaving promise polyfill.
This commit is contained in:
@@ -1,10 +1,24 @@
|
||||
// Install a global ES2015-compliant Promise constructor that knows how to
|
||||
// run all its callbacks in Fibers.
|
||||
|
||||
var Promise = global.Promise = global.Promise ||
|
||||
var Promise = global.Promise ||
|
||||
require("promise/lib/es6-extensions");
|
||||
|
||||
require("meteor-promise").makeCompatible(
|
||||
Promise,
|
||||
require("fibers")
|
||||
);
|
||||
function makeCompatible(newPromise) {
|
||||
require("meteor-promise").makeCompatible(
|
||||
newPromise,
|
||||
require("fibers")
|
||||
);
|
||||
}
|
||||
|
||||
makeCompatible(Promise);
|
||||
|
||||
Object.defineProperty(global, "Promise", {
|
||||
get: function () {
|
||||
return Promise;
|
||||
},
|
||||
|
||||
// Make the new Promise compatible with Fibers, but do not allow further
|
||||
// modifications to global.Promise, e.g. by misbehaving polyfills.
|
||||
set: makeCompatible
|
||||
});
|
||||
|
||||
@@ -27,8 +27,10 @@ var release = require('../packaging/release.js');
|
||||
var projectContextModule = require('../project-context.js');
|
||||
var upgraders = require('../upgraders.js');
|
||||
|
||||
require("../tool-env/install-runtime.js");
|
||||
|
||||
try {
|
||||
var phantomjs = require('phantomjs-prebuilt');
|
||||
var phantomPath = require.resolve('phantomjs-prebuilt');
|
||||
} catch (e) {
|
||||
throw new Error([
|
||||
"Please install PhantomJS by running the following command:",
|
||||
@@ -40,6 +42,8 @@ try {
|
||||
].join("\n"));
|
||||
}
|
||||
|
||||
var phantomjs = require(phantomPath);
|
||||
|
||||
// To allow long stack traces that cross async boundaries
|
||||
require('longjohn');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user