@@ -7584,28 +7584,17 @@ Copyright (c) 2017, 2018, Tetsuya Mori <
[email protected] >. All rights reserv
7584
7584
const origin = location . origin ;
7585
7585
const noHookAuthorization = hook . parameters . noHookAuthorizationParameter ;
7586
7586
[
7587
- `at _iframeContentWindowAcl (${ origin } /components/thin-hook/demo/hook-callback.js?no-hook=true:2117:54)` ,
7588
- `at write2 (${ origin } /components/thin-hook/demo/:129:14355)` ,
7589
- `at write4 (${ origin } /components/thin-hook/demo/:129:15472)` ,
7590
- `at writeln2 (${ origin } /components/thin-hook/demo/:131:40)` ,
7591
- `at writeln4 (${ origin } /components/thin-hook/demo/:133:45)` ,
7592
- `at ${ origin } /components/thin-hook/demo/webpack-es6-module.js?no-hook=true:445:3` ,
7593
- `at ${ origin } /components/thin-hook/demo/webpack-es6-module.js?no-hook=true:66:10` ,
7594
- `at https://www.gstatic.com/charts/loader.js:226:323` ,
7595
- `at https://cdnjs.cloudflare.com/ajax/libs/vis/4.18.1/vis.min.js?cors=true&no-hook=true:25:200` ,
7596
- `at https://cdnjs.cloudflare.com/ajax/libs/vis/4.18.1/vis.min.js?cors=true&no-hook=true:41:2497` ,
7597
- `at https://cdnjs.cloudflare.com/ajax/libs/vis/4.18.1/vis.min.js?cors=true&no-hook=true:42:4192` ,
7598
- `at HTMLCanvasElement.<anonymous> (https://cdnjs.cloudflare.com/ajax/libs/vis/4.18.1/vis.min.js?cors=true&no-hook=true:42:8417)` ,
7599
7587
] . forEach ( url => whitelist . add ( url ) ) ;
7600
7588
const wildcardWhitelist = [
7601
7589
new RegExp ( '^at ([^(]* [(])?' + 'https://cdnjs.cloudflare.com/ajax/libs/vis/4[.]18[.]1/vis[.]min[.]js' ) ,
7602
- new RegExp ( '^at ([^(]* [(])?' + origin + '/components/thin-hook/demo/hook-callback[.]js' ) ,
7603
- new RegExp ( '^at ([^(]* [(])?' + origin + '/components/thin-hook/hook[.]min[.]js' ) ,
7604
- new RegExp ( '^at ([^(]* [(])?' + origin + '/components/thin-hook/demo/view3:1:' ) ,
7605
- new RegExp ( '^at ([^(]* [(])?' + origin + '/components/thin-hook/demo/disable-devtools[.]js' ) ,
7606
- new RegExp ( '^at ([^(]* [(])?' + origin + '/components/thin-hook/demo/cache-bundle[.]js' ) ,
7590
+ new RegExp ( '^at ([^(]* [(])?' + 'https://www.gstatic.com/charts/loader[.]js' ) ,
7591
+ new RegExp ( '^at ([^(]* [(])?' + origin + '/components/thin-hook/demo/' ) , // trust the site contents
7592
+ new RegExp ( '^at ([^(]* [(])?' + origin + '/components/thin-hook/hook[.]min[.]js' ) , // trust thin-hook
7607
7593
] ;
7608
- //console.error(whitelist);
7594
+ const excludes = new Set ( ) ;
7595
+ [
7596
+ 'Math' , // for vis.min.js to work in decent speed
7597
+ ] . forEach ( name => excludes . add ( name ) ) ;
7609
7598
if ( typeof window === 'object' ) {
7610
7599
const _Object = Object ;
7611
7600
const _window = window ;
@@ -7617,16 +7606,17 @@ Copyright (c) 2017, 2018, Tetsuya Mori <
[email protected] >. All rights reserv
7617
7606
return true ;
7618
7607
}
7619
7608
for ( let i = 0 ; i < wildcardWhitelist . length ; i ++ ) {
7620
- if ( top . match ( wildcardWhitelist [ i ] ) || bottom . match ( wildcardWhitelist ) ) {
7609
+ if ( top . match ( wildcardWhitelist [ i ] ) ) {
7610
+ whitelist . add ( top ) ; // cache whitelist result
7611
+ return true ;
7612
+ }
7613
+ else if ( bottom . match ( wildcardWhitelist [ i ] ) ) {
7614
+ whitelist . add ( bottom ) ; // cache whitelist result
7621
7615
return true ;
7622
7616
}
7623
7617
}
7624
7618
return false ;
7625
7619
} ;
7626
- const excludes = new Set ( ) ;
7627
- [
7628
- 'Math' , // for vis.min.js to work in a decent speed
7629
- ] . forEach ( name => excludes . add ( name ) ) ;
7630
7620
_Object . getOwnPropertyNames ( _window ) . forEach ( name => {
7631
7621
if ( excludes . has ( name ) ) {
7632
7622
return ;
@@ -7725,29 +7715,5 @@ Copyright (c) 2017, 2018, Tetsuya Mori <
[email protected] >. All rights reserv
7725
7715
// window.name is not configurable
7726
7716
}
7727
7717
} ) ;
7728
-
7729
- }
7730
- /*
7731
- if (typeof navigator === 'object' && typeof window === 'object') {
7732
- let desc = _Object.getOwnPropertyDescriptor(window, 'navigator');
7733
- _Object.defineProperty(window, 'navigator', {
7734
- configurable: true,
7735
- enumerable: desc.enumerable,
7736
- get: function get() {
7737
- if (contextStack.isEmpty()) {
7738
- Error.stackTraceLimit = Infinity;
7739
- let error = new Error();
7740
- let bottom = error.stack.split(/\n/).pop().trim();
7741
- if (!whitelist.has(bottom)) {
7742
- console.error('access to window.navigator \n', 'this = ', this, '\n', error.stack, '\n', 'bottom = ', '"' + bottom + '"', '\n', contextStack.toString(2));
7743
- }
7744
- else {
7745
- console.error('bottom = ', bottom);
7746
- }
7747
- }
7748
- return desc.get.call(this);
7749
- }
7750
- })
7751
7718
}
7752
- */
7753
7719
}
0 commit comments