File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export default platform.hasStandardBrowserEnv ?
88// Standard browser envs have full support of the APIs needed to test
99// whether the request URL is of the same origin as current location.
1010 ( function standardBrowserEnv ( ) {
11- const msie = / ( m s i e | t r i d e n t ) / i. test ( navigator . userAgent ) ;
11+ const msie = platform . navigator && / ( m s i e | t r i d e n t ) / i. test ( platform . navigator . userAgent ) ;
1212 const urlParsingNode = document . createElement ( 'a' ) ;
1313 let originURL ;
1414
Original file line number Diff line number Diff line change 11const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined' ;
22
3+ const _navigator = typeof navigator === 'object' && navigator || undefined ;
4+
35/**
46 * Determine if we're running in a standard browser environment
57 *
@@ -17,10 +19,8 @@ const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'unde
1719 *
1820 * @returns {boolean }
1921 */
20- const hasStandardBrowserEnv = (
21- ( product ) => {
22- return hasBrowserEnv && [ 'ReactNative' , 'NativeScript' , 'NS' ] . indexOf ( product ) < 0
23- } ) ( typeof navigator !== 'undefined' && navigator . product ) ;
22+ const hasStandardBrowserEnv = hasBrowserEnv &&
23+ ( ! _navigator || [ 'ReactNative' , 'NativeScript' , 'NS' ] . indexOf ( _navigator . product ) < 0 ) ;
2424
2525/**
2626 * Determine if we're running in a standard browser webWorker environment
@@ -46,5 +46,6 @@ export {
4646 hasBrowserEnv ,
4747 hasStandardBrowserWebWorkerEnv ,
4848 hasStandardBrowserEnv ,
49+ _navigator as navigator ,
4950 origin
5051}
You can’t perform that action at this time.
0 commit comments