Skip to content

Commit

Permalink
[ReactNative] Remove global MutationObserver to fix Bluebird feature …
Browse files Browse the repository at this point in the history
…detection

Summary:
Bluebird is checking if MutationObserver exists and if it does, uses it and instant crashes. Since we don't have the DOM, MutationObserver doesn't make sense.

Also, pretty cool thing, the bluebird maintainer updated the feature detection to fallback to setImmediate before checking setTimeout. He committed and made a new version in less than 5 minutes!

facebook#335 (comment)

Test Plan: Run bluebird and make sure it runs with setImmediate
  • Loading branch information
vjeux authored and oss sync committed Apr 12, 2015
1 parent 8fbc6fb commit 8ecf397
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ function setupDocumentShim() {
if (GLOBAL.document) {
GLOBAL.document.createElement = null;
}

// There is no DOM so MutationObserver doesn't make sense. It is used
// as feature detection in Bluebird Promise implementation
GLOBAL.MutationObserver = undefined;
}

function handleErrorWithRedBox(e) {
Expand Down

0 comments on commit 8ecf397

Please sign in to comment.