mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-05 03:21:16 +08:00
- Update Sinon (breaking change does not affect us) - Update Mocha - Update Karma R=jacktfranklin@chromium.org Bug: none Change-Id: Ieb50ba55ce7a9e01e32ee553a6741e6323fcaaab Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3158223 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org> Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
22 lines
913 B
JavaScript
22 lines
913 B
JavaScript
// Load in our dependencies
|
|
var ContextKarma = require('./karma')
|
|
|
|
// Resolve our parent window
|
|
var parentWindow = window.opener || window.parent
|
|
|
|
// Define a remote call method for Karma
|
|
var callParentKarmaMethod = ContextKarma.getDirectCallParentKarmaMethod(parentWindow)
|
|
|
|
// If we don't have access to the window, then use `postMessage`
|
|
// DEV: In Electron, we don't have access to the parent window due to it being in a separate process
|
|
// DEV: We avoid using this in Internet Explorer as they only support strings
|
|
// https://caniuse.com/?search=postmessage
|
|
var haveParentAccess = false
|
|
try { haveParentAccess = !!parentWindow.window } catch (err) { /* Ignore errors (likely permisison errors) */ }
|
|
if (!haveParentAccess) {
|
|
callParentKarmaMethod = ContextKarma.getPostMessageCallParentKarmaMethod(parentWindow)
|
|
}
|
|
|
|
// Define a window-scoped Karma
|
|
window.__karma__ = new ContextKarma(callParentKarmaMethod)
|