diff --git a/src/webview/js/generatedEs3.js b/src/webview/js/generatedEs3.js index bcd5acfe35a..3404fec6839 100644 --- a/src/webview/js/generatedEs3.js +++ b/src/webview/js/generatedEs3.js @@ -36,6 +36,55 @@ var compiledWebviewJs = (function (exports) { return Constructor; } + function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; + } + + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) symbols = symbols.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); + } + + return keys; + } + + function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + + if (i % 2) { + ownKeys(Object(source), true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + + return target; + } + var sendMessage = (function (msg) { window.ReactNativeWebView.postMessage(JSON.stringify(msg)); }); @@ -610,7 +659,11 @@ var compiledWebviewJs = (function (exports) { sendScrollMessageIfListShort(); }; - var handleInitialLoad = function handleInitialLoad(platformOS, scrollMessageId, auth) { + var handleInitialLoad = function handleInitialLoad(platformOS, scrollMessageId, rawAuth) { + var auth = _objectSpread2(_objectSpread2({}, rawAuth), {}, { + realm: rawAuth.realm + }); + if (platformOS === 'ios') { window.addEventListener('message', handleMessageEvent); } else { diff --git a/src/webview/js/js.js b/src/webview/js/js.js index 30621d659f9..f31adfaeea2 100644 --- a/src/webview/js/js.js +++ b/src/webview/js/js.js @@ -544,8 +544,11 @@ const handleUpdateEventContent = (uevent: WebViewUpdateEventContent) => { export const handleInitialLoad = ( platformOS: string, scrollMessageId: number | null, - auth: Auth, + // In an upcoming commit, the `realm` part of an `Auth` object will + // be a URL object. It'll be passed here in its stringified form. + rawAuth: {| ...$Diff, realm: string |}, ) => { + const auth: Auth = { ...rawAuth, realm: rawAuth.realm }; // Since its version 5.x, the `react-native-webview` library dispatches our // `message` events at `window` on iOS but `document` on Android. if (platformOS === 'ios') {