ofs | hex dump | ascii |
---|
0000 | 04 00 00 00 04 12 00 00 00 12 00 00 fb 11 00 00 7b 22 66 69 6c 65 73 22 3a 7b 22 62 72 6f 77 73 | ................{"files":{"brows |
0020 | 65 72 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 61 70 69 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 61 | er":{"files":{"api":{"files":{"a |
0040 | 70 70 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 39 31 38 2c 22 6f 66 66 73 65 74 22 3a 22 30 22 | pp.js":{"size":2918,"offset":"0" |
0060 | 7d 2c 22 61 75 74 6f 2d 75 70 64 61 74 65 72 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 61 75 74 6f | },"auto-updater":{"files":{"auto |
0080 | 2d 75 70 64 61 74 65 72 2d 6e 61 74 69 76 65 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 33 30 35 2c | -updater-native.js":{"size":305, |
00a0 | 22 6f 66 66 73 65 74 22 3a 22 33 31 36 34 22 7d 2c 22 61 75 74 6f 2d 75 70 64 61 74 65 72 2d 77 | "offset":"3164"},"auto-updater-w |
00c0 | 69 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 31 37 33 2c 22 6f 66 66 73 65 74 22 3a 22 33 34 | in.js":{"size":2173,"offset":"34 |
00e0 | 36 39 22 7d 2c 22 73 71 75 69 72 72 65 6c 2d 75 70 64 61 74 65 2d 77 69 6e 2e 6a 73 22 3a 7b 22 | 69"},"squirrel-update-win.js":{" |
0100 | 73 69 7a 65 22 3a 33 37 33 36 2c 22 6f 66 66 73 65 74 22 3a 22 35 36 34 32 22 7d 7d 7d 2c 22 61 | size":3736,"offset":"5642"}}},"a |
0120 | 75 74 6f 2d 75 70 64 61 74 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 34 36 2c 22 6f 66 66 | uto-updater.js":{"size":246,"off |
0140 | 73 65 74 22 3a 22 32 39 31 38 22 7d 2c 22 62 72 6f 77 73 65 72 2d 76 69 65 77 2e 6a 73 22 3a 7b | set":"2918"},"browser-view.js":{ |
0160 | 22 73 69 7a 65 22 3a 33 39 35 2c 22 6f 66 66 73 65 74 22 3a 22 39 33 37 38 22 7d 2c 22 62 72 6f | "size":395,"offset":"9378"},"bro |
0180 | 77 73 65 72 2d 77 69 6e 64 6f 77 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 35 34 39 37 2c 22 6f 66 | wser-window.js":{"size":5497,"of |
01a0 | 66 73 65 74 22 3a 22 39 37 37 33 22 7d 2c 22 63 6f 6e 74 65 6e 74 2d 74 72 61 63 69 6e 67 2e 6a | fset":"9773"},"content-tracing.j |
01c0 | 73 22 3a 7b 22 73 69 7a 65 22 3a 37 30 2c 22 6f 66 66 73 65 74 22 3a 22 31 35 32 37 30 22 7d 2c | s":{"size":70,"offset":"15270"}, |
01e0 | 22 63 72 61 73 68 2d 72 65 70 6f 72 74 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 33 33 30 2c | "crash-reporter.js":{"size":330, |
0200 | 22 6f 66 66 73 65 74 22 3a 22 31 35 33 34 30 22 7d 2c 22 64 69 61 6c 6f 67 2e 6a 73 22 3a 7b 22 | "offset":"15340"},"dialog.js":{" |
0220 | 73 69 7a 65 22 3a 38 37 36 38 2c 22 6f 66 66 73 65 74 22 3a 22 31 35 36 37 30 22 7d 2c 22 65 78 | size":8768,"offset":"15670"},"ex |
0240 | 70 6f 72 74 73 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 65 6c 65 63 74 72 6f 6e 2e 6a 73 22 3a 7b | ports":{"files":{"electron.js":{ |
0260 | 22 73 69 7a 65 22 3a 35 31 35 2c 22 6f 66 66 73 65 74 22 3a 22 32 34 34 33 38 22 7d 7d 7d 2c 22 | "size":515,"offset":"24438"}}}," |
0280 | 67 6c 6f 62 61 6c 2d 73 68 6f 72 74 63 75 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 38 35 2c 22 | global-shortcut.js":{"size":85," |
02a0 | 6f 66 66 73 65 74 22 3a 22 32 34 39 35 33 22 7d 2c 22 69 6e 2d 61 70 70 2d 70 75 72 63 68 61 73 | offset":"24953"},"in-app-purchas |
02c0 | 65 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 35 39 39 2c 22 6f 66 66 73 65 74 22 3a 22 32 35 30 33 | e.js":{"size":599,"offset":"2503 |
02e0 | 38 22 7d 2c 22 69 70 63 2d 6d 61 69 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 30 36 2c 22 6f | 8"},"ipc-main.js":{"size":206,"o |
0300 | 66 66 73 65 74 22 3a 22 32 35 36 33 37 22 7d 2c 22 6d 65 6e 75 2d 69 74 65 6d 2d 72 6f 6c 65 73 | ffset":"25637"},"menu-item-roles |
0320 | 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 36 34 39 38 2c 22 6f 66 66 73 65 74 22 3a 22 32 35 38 34 | .js":{"size":6498,"offset":"2584 |
0340 | 33 22 7d 2c 22 6d 65 6e 75 2d 69 74 65 6d 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 37 31 38 2c | 3"},"menu-item.js":{"size":2718, |
0360 | 22 6f 66 66 73 65 74 22 3a 22 33 32 33 34 31 22 7d 2c 22 6d 65 6e 75 2d 75 74 69 6c 73 2e 6a 73 | "offset":"32341"},"menu-utils.js |
0380 | 22 3a 7b 22 73 69 7a 65 22 3a 34 34 31 30 2c 22 6f 66 66 73 65 74 22 3a 22 33 35 30 35 39 22 7d | ":{"size":4410,"offset":"35059"} |
03a0 | 2c 22 6d 65 6e 75 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 38 34 39 33 2c 22 6f 66 66 73 65 74 22 | ,"menu.js":{"size":8493,"offset" |
03c0 | 3a 22 33 39 34 36 39 22 7d 2c 22 6d 6f 64 75 6c 65 2d 6c 69 73 74 2e 6a 73 22 3a 7b 22 73 69 7a | :"39469"},"module-list.js":{"siz |
03e0 | 65 22 3a 31 38 36 32 2c 22 6f 66 66 73 65 74 22 3a 22 34 37 39 36 32 22 7d 2c 22 6e 61 76 69 67 | e":1862,"offset":"47962"},"navig |
0400 | 61 74 69 6f 6e 2d 63 6f 6e 74 72 6f 6c 6c 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 35 34 38 | ation-controller.js":{"size":548 |
0420 | 32 2c 22 6f 66 66 73 65 74 22 3a 22 34 39 38 32 34 22 7d 2c 22 6e 65 74 2d 6c 6f 67 2e 6a 73 22 | 2,"offset":"49824"},"net-log.js" |
0440 | 3a 7b 22 73 69 7a 65 22 3a 39 35 30 2c 22 6f 66 66 73 65 74 22 3a 22 35 35 33 30 36 22 7d 2c 22 | :{"size":950,"offset":"55306"}," |
0460 | 6e 65 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 39 39 30 39 2c 22 6f 66 66 73 65 74 22 3a 22 35 | net.js":{"size":9909,"offset":"5 |
0480 | 36 32 35 36 22 7d 2c 22 6e 6f 74 69 66 69 63 61 74 69 6f 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 | 6256"},"notification.js":{"size" |
04a0 | 3a 32 37 33 2c 22 6f 66 66 73 65 74 22 3a 22 36 36 31 36 35 22 7d 2c 22 70 6f 77 65 72 2d 6d 6f | :273,"offset":"66165"},"power-mo |
04c0 | 6e 69 74 6f 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 37 36 38 2c 22 6f 66 66 73 65 74 22 3a 22 | nitor.js":{"size":768,"offset":" |
04e0 | 36 36 34 33 38 22 7d 2c 22 70 6f 77 65 72 2d 73 61 76 65 2d 62 6c 6f 63 6b 65 72 2e 6a 73 22 3a | 66438"},"power-save-blocker.js": |
0500 | 7b 22 73 69 7a 65 22 3a 39 30 2c 22 6f 66 66 73 65 74 22 3a 22 36 37 32 30 36 22 7d 2c 22 70 72 | {"size":90,"offset":"67206"},"pr |
0520 | 6f 74 6f 63 6f 6c 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 37 39 31 2c 22 6f 66 66 73 65 74 22 3a | otocol.js":{"size":791,"offset": |
0540 | 22 36 37 32 39 36 22 7d 2c 22 73 63 72 65 65 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 36 30 | "67296"},"screen.js":{"size":260 |
0560 | 2c 22 6f 66 66 73 65 74 22 3a 22 36 38 30 38 37 22 7d 2c 22 73 65 73 73 69 6f 6e 2e 6a 73 22 3a | ,"offset":"68087"},"session.js": |
0580 | 7b 22 73 69 7a 65 22 3a 35 38 39 2c 22 6f 66 66 73 65 74 22 3a 22 36 38 33 34 37 22 7d 2c 22 73 | {"size":589,"offset":"68347"},"s |
05a0 | 79 73 74 65 6d 2d 70 72 65 66 65 72 65 6e 63 65 73 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 33 33 | ystem-preferences.js":{"size":33 |
05c0 | 38 2c 22 6f 66 66 73 65 74 22 3a 22 36 38 39 33 36 22 7d 2c 22 74 6f 70 2d 6c 65 76 65 6c 2d 77 | 8,"offset":"68936"},"top-level-w |
05e0 | 69 6e 64 6f 77 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 36 37 35 2c 22 6f 66 66 73 65 74 22 3a 22 | indow.js":{"size":675,"offset":" |
0600 | 36 39 32 37 34 22 7d 2c 22 74 6f 75 63 68 2d 62 61 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 | 69274"},"touch-bar.js":{"size":1 |
0620 | 30 34 32 35 2c 22 6f 66 66 73 65 74 22 3a 22 36 39 39 34 39 22 7d 2c 22 74 72 61 79 2e 6a 73 22 | 0425,"offset":"69949"},"tray.js" |
0640 | 3a 7b 22 73 69 7a 65 22 3a 31 38 38 2c 22 6f 66 66 73 65 74 22 3a 22 38 30 33 37 34 22 7d 2c 22 | :{"size":188,"offset":"80374"}," |
0660 | 76 69 65 77 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 32 38 2c 22 6f 66 66 73 65 74 22 3a 22 38 | view.js":{"size":228,"offset":"8 |
0680 | 30 35 36 32 22 7d 2c 22 77 65 62 2d 63 6f 6e 74 65 6e 74 73 2d 76 69 65 77 2e 6a 73 22 3a 7b 22 | 0562"},"web-contents-view.js":{" |
06a0 | 73 69 7a 65 22 3a 33 36 34 2c 22 6f 66 66 73 65 74 22 3a 22 38 30 37 39 30 22 7d 2c 22 77 65 62 | size":364,"offset":"80790"},"web |
06c0 | 2d 63 6f 6e 74 65 6e 74 73 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 35 30 37 36 2c 22 6f 66 66 | -contents.js":{"size":15076,"off |
06e0 | 73 65 74 22 3a 22 38 31 31 35 34 22 7d 7d 7d 2c 22 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f | set":"81154"}}},"chrome-extensio |
0700 | 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 34 33 30 35 2c 22 6f 66 66 73 65 74 22 3a 22 39 36 | n.js":{"size":14305,"offset":"96 |
0720 | 32 33 30 22 7d 2c 22 63 72 61 73 68 2d 72 65 70 6f 72 74 65 72 2d 69 6e 69 74 2e 6a 73 22 3a 7b | 230"},"crash-reporter-init.js":{ |
0740 | 22 73 69 7a 65 22 3a 31 30 33 37 2c 22 6f 66 66 73 65 74 22 3a 22 31 31 30 35 33 35 22 7d 2c 22 | "size":1037,"offset":"110535"}," |
0760 | 64 65 73 6b 74 6f 70 2d 63 61 70 74 75 72 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 33 38 | desktop-capturer.js":{"size":238 |
0780 | 32 2c 22 6f 66 66 73 65 74 22 3a 22 31 31 31 35 37 32 22 7d 2c 22 67 75 65 73 74 2d 76 69 65 77 | 2,"offset":"111572"},"guest-view |
07a0 | 2d 6d 61 6e 61 67 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 34 35 33 33 2c 22 6f 66 66 73 | -manager.js":{"size":14533,"offs |
07c0 | 65 74 22 3a 22 31 31 33 39 35 34 22 7d 2c 22 67 75 65 73 74 2d 77 69 6e 64 6f 77 2d 6d 61 6e 61 | et":"113954"},"guest-window-mana |
07e0 | 67 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 32 37 36 35 2c 22 6f 66 66 73 65 74 22 3a 22 | ger.js":{"size":12765,"offset":" |
0800 | 31 32 38 34 38 37 22 7d 2c 22 69 6e 69 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 35 37 35 37 2c | 128487"},"init.js":{"size":5757, |
0820 | 22 6f 66 66 73 65 74 22 3a 22 31 34 31 32 35 32 22 7d 2c 22 69 70 63 2d 6d 61 69 6e 2d 69 6e 74 | "offset":"141252"},"ipc-main-int |
0840 | 65 72 6e 61 6c 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 30 36 2c 22 6f 66 66 73 65 74 22 3a 22 | ernal.js":{"size":206,"offset":" |
0860 | 31 34 37 30 30 39 22 7d 2c 22 6f 62 6a 65 63 74 73 2d 72 65 67 69 73 74 72 79 2e 6a 73 22 3a 7b | 147009"},"objects-registry.js":{ |
0880 | 22 73 69 7a 65 22 3a 33 32 39 35 2c 22 6f 66 66 73 65 74 22 3a 22 31 34 37 32 31 35 22 7d 2c 22 | "size":3295,"offset":"147215"}," |
08a0 | 72 70 63 2d 73 65 72 76 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 37 34 33 30 2c 22 6f 66 | rpc-server.js":{"size":17430,"of |
08c0 | 66 73 65 74 22 3a 22 31 35 30 35 31 30 22 7d 7d 7d 2c 22 63 6f 6d 6d 6f 6e 22 3a 7b 22 66 69 6c | fset":"150510"}}},"common":{"fil |
08e0 | 65 73 22 3a 7b 22 61 70 69 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 63 6c 69 70 62 6f 61 72 64 2e | es":{"api":{"files":{"clipboard. |
0900 | 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 31 35 31 2c 22 6f 66 66 73 65 74 22 3a 22 31 36 37 39 34 | js":{"size":1151,"offset":"16794 |
0920 | 30 22 7d 2c 22 64 65 70 72 65 63 61 74 65 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 35 31 31 2c | 0"},"deprecate.js":{"size":2511, |
0940 | 22 6f 66 66 73 65 74 22 3a 22 31 36 39 30 39 31 22 7d 2c 22 64 65 70 72 65 63 61 74 69 6f 6e 73 | "offset":"169091"},"deprecations |
0960 | 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 33 31 2c 22 6f 66 66 73 65 74 22 3a 22 31 37 31 36 30 | .js":{"size":231,"offset":"17160 |
0980 | 32 22 7d 2c 22 65 78 70 6f 72 74 73 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 65 6c 65 63 74 72 6f | 2"},"exports":{"files":{"electro |
09a0 | 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 38 38 39 2c 22 6f 66 66 73 65 74 22 3a 22 31 37 31 38 | n.js":{"size":889,"offset":"1718 |
09c0 | 33 33 22 7d 7d 7d 2c 22 69 73 2d 70 72 6f 6d 69 73 65 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 33 | 33"}}},"is-promise.js":{"size":3 |
09e0 | 32 30 2c 22 6f 66 66 73 65 74 22 3a 22 31 37 32 37 32 32 22 7d 2c 22 6d 6f 64 75 6c 65 2d 6c 69 | 20,"offset":"172722"},"module-li |
0a00 | 73 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 34 35 39 2c 22 6f 66 66 73 65 74 22 3a 22 31 37 33 | st.js":{"size":459,"offset":"173 |
0a20 | 30 34 32 22 7d 2c 22 6e 61 74 69 76 65 2d 69 6d 61 67 65 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a | 042"},"native-image.js":{"size": |
0a40 | 36 37 2c 22 6f 66 66 73 65 74 22 3a 22 31 37 33 35 30 31 22 7d 2c 22 73 68 65 6c 6c 2e 6a 73 22 | 67,"offset":"173501"},"shell.js" |
0a60 | 3a 7b 22 73 69 7a 65 22 3a 36 30 2c 22 6f 66 66 73 65 74 22 3a 22 31 37 33 35 36 38 22 7d 7d 7d | :{"size":60,"offset":"173568"}}} |
0a80 | 2c 22 61 74 6f 6d 2d 62 69 6e 64 69 6e 67 2d 73 65 74 75 70 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 | ,"atom-binding-setup.js":{"size" |
0aa0 | 3a 33 35 36 2c 22 6f 66 66 73 65 74 22 3a 22 31 37 33 36 32 38 22 7d 2c 22 62 75 66 66 65 72 2d | :356,"offset":"173628"},"buffer- |
0ac0 | 75 74 69 6c 73 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 34 34 33 2c 22 6f 66 66 73 65 74 22 3a | utils.js":{"size":1443,"offset": |
0ae0 | 22 31 37 33 39 38 34 22 7d 2c 22 63 72 61 73 68 2d 72 65 70 6f 72 74 65 72 2e 6a 73 22 3a 7b 22 | "173984"},"crash-reporter.js":{" |
0b00 | 73 69 7a 65 22 3a 32 36 37 31 2c 22 6f 66 66 73 65 74 22 3a 22 31 37 35 34 32 37 22 7d 2c 22 65 | size":2671,"offset":"175427"},"e |
0b20 | 72 72 6f 72 2d 75 74 69 6c 73 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 31 36 30 2c 22 6f 66 66 | rror-utils.js":{"size":1160,"off |
0b40 | 73 65 74 22 3a 22 31 37 38 30 39 38 22 7d 2c 22 69 6e 69 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 | set":"178098"},"init.js":{"size" |
0b60 | 3a 32 30 30 39 2c 22 6f 66 66 73 65 74 22 3a 22 31 37 39 32 35 38 22 7d 2c 22 70 61 72 73 65 2d | :2009,"offset":"179258"},"parse- |
0b80 | 66 65 61 74 75 72 65 73 2d 73 74 72 69 6e 67 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 37 32 36 2c | features-string.js":{"size":726, |
0ba0 | 22 6f 66 66 73 65 74 22 3a 22 31 38 31 32 36 37 22 7d 2c 22 72 65 73 65 74 2d 73 65 61 72 63 68 | "offset":"181267"},"reset-search |
0bc0 | 2d 70 61 74 68 73 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 36 39 39 2c 22 6f 66 66 73 65 74 22 | -paths.js":{"size":1699,"offset" |
0be0 | 3a 22 31 38 31 39 39 33 22 7d 2c 22 77 65 62 2d 76 69 65 77 2d 6d 65 74 68 6f 64 73 2e 6a 73 22 | :"181993"},"web-view-methods.js" |
0c00 | 3a 7b 22 73 69 7a 65 22 3a 31 31 38 33 2c 22 6f 66 66 73 65 74 22 3a 22 31 38 33 36 39 32 22 7d | :{"size":1183,"offset":"183692"} |
0c20 | 7d 7d 2c 22 72 65 6e 64 65 72 65 72 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 61 70 69 22 3a 7b 22 | }},"renderer":{"files":{"api":{" |
0c40 | 66 69 6c 65 73 22 3a 7b 22 63 72 61 73 68 2d 72 65 70 6f 72 74 65 72 2e 6a 73 22 3a 7b 22 73 69 | files":{"crash-reporter.js":{"si |
0c60 | 7a 65 22 3a 36 31 32 2c 22 6f 66 66 73 65 74 22 3a 22 31 38 34 38 37 35 22 7d 2c 22 64 65 73 6b | ze":612,"offset":"184875"},"desk |
0c80 | 74 6f 70 2d 63 61 70 74 75 72 65 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 33 37 33 2c 22 6f | top-capturer.js":{"size":1373,"o |
0ca0 | 66 66 73 65 74 22 3a 22 31 38 35 34 38 37 22 7d 2c 22 65 78 70 6f 72 74 73 22 3a 7b 22 66 69 6c | ffset":"185487"},"exports":{"fil |
0cc0 | 65 73 22 3a 7b 22 65 6c 65 63 74 72 6f 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 35 31 38 2c 22 | es":{"electron.js":{"size":518," |
0ce0 | 6f 66 66 73 65 74 22 3a 22 31 38 36 38 36 30 22 7d 7d 7d 2c 22 69 70 63 2d 72 65 6e 64 65 72 65 | offset":"186860"}}},"ipc-rendere |
0d00 | 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 38 30 34 2c 22 6f 66 66 73 65 74 22 3a 22 31 38 37 33 | r.js":{"size":804,"offset":"1873 |
0d20 | 37 38 22 7d 2c 22 6d 6f 64 75 6c 65 2d 6c 69 73 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 37 31 | 78"},"module-list.js":{"size":71 |
0d40 | 34 2c 22 6f 66 66 73 65 74 22 3a 22 31 38 38 31 38 32 22 7d 2c 22 72 65 6d 6f 74 65 2e 6a 73 22 | 4,"offset":"188182"},"remote.js" |
0d60 | 3a 7b 22 73 69 7a 65 22 3a 31 31 33 36 38 2c 22 6f 66 66 73 65 74 22 3a 22 31 38 38 38 39 36 22 | :{"size":11368,"offset":"188896" |
0d80 | 7d 2c 22 73 63 72 65 65 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 34 32 2c 22 6f 66 66 73 65 | },"screen.js":{"size":142,"offse |
0da0 | 74 22 3a 22 32 30 30 32 36 34 22 7d 2c 22 77 65 62 2d 66 72 61 6d 65 2e 6a 73 22 3a 7b 22 73 69 | t":"200264"},"web-frame.js":{"si |
0dc0 | 7a 65 22 3a 31 36 32 39 2c 22 6f 66 66 73 65 74 22 3a 22 32 30 30 34 30 36 22 7d 7d 7d 2c 22 63 | ze":1629,"offset":"200406"}}},"c |
0de0 | 61 6c 6c 62 61 63 6b 73 2d 72 65 67 69 73 74 72 79 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 34 | allbacks-registry.js":{"size":14 |
0e00 | 35 31 2c 22 6f 66 66 73 65 74 22 3a 22 32 30 32 30 33 35 22 7d 2c 22 63 68 72 6f 6d 65 2d 61 70 | 51,"offset":"202035"},"chrome-ap |
0e20 | 69 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 35 38 36 36 2c 22 6f 66 66 73 65 74 22 3a 22 32 30 33 | i.js":{"size":5866,"offset":"203 |
0e40 | 34 38 36 22 7d 2c 22 63 6f 6e 74 65 6e 74 2d 73 63 72 69 70 74 73 2d 69 6e 6a 65 63 74 6f 72 2e | 486"},"content-scripts-injector. |
0e60 | 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 33 32 35 39 2c 22 6f 66 66 73 65 74 22 3a 22 32 30 39 33 35 | js":{"size":3259,"offset":"20935 |
0e80 | 32 22 7d 2c 22 65 78 74 65 6e 73 69 6f 6e 73 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 65 76 65 6e | 2"},"extensions":{"files":{"even |
0ea0 | 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 34 32 30 2c 22 6f 66 66 73 65 74 22 3a 22 32 31 32 36 | t.js":{"size":420,"offset":"2126 |
0ec0 | 31 31 22 7d 2c 22 69 31 38 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 32 35 39 35 2c 22 6f 66 66 | 11"},"i18n.js":{"size":2595,"off |
0ee0 | 73 65 74 22 3a 22 32 31 33 30 33 31 22 7d 2c 22 73 74 6f 72 61 67 65 2e 6a 73 22 3a 7b 22 73 69 | set":"213031"},"storage.js":{"si |
0f00 | 7a 65 22 3a 33 35 39 33 2c 22 6f 66 66 73 65 74 22 3a 22 32 31 35 36 32 36 22 7d 2c 22 77 65 62 | ze":3593,"offset":"215626"},"web |
0f20 | 2d 6e 61 76 69 67 61 74 69 6f 6e 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 35 39 38 2c 22 6f 66 66 | -navigation.js":{"size":598,"off |
0f40 | 73 65 74 22 3a 22 32 31 39 32 31 39 22 7d 7d 7d 2c 22 69 6e 69 74 2e 6a 73 22 3a 7b 22 73 69 7a | set":"219219"}}},"init.js":{"siz |
0f60 | 65 22 3a 35 39 37 33 2c 22 6f 66 66 73 65 74 22 3a 22 32 31 39 38 31 37 22 7d 2c 22 69 6e 73 70 | e":5973,"offset":"219817"},"insp |
0f80 | 65 63 74 6f 72 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 33 33 31 39 2c 22 6f 66 66 73 65 74 22 3a | ector.js":{"size":3319,"offset": |
0fa0 | 22 32 32 35 37 39 30 22 7d 2c 22 69 70 63 2d 72 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 6e 61 6c | "225790"},"ipc-renderer-internal |
0fc0 | 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 37 33 33 2c 22 6f 66 66 73 65 74 22 3a 22 32 32 39 31 30 | .js":{"size":733,"offset":"22910 |
0fe0 | 39 22 7d 2c 22 6f 76 65 72 72 69 64 65 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 37 36 35 2c 22 6f | 9"},"override.js":{"size":765,"o |
1000 | 66 66 73 65 74 22 3a 22 32 32 39 38 34 32 22 7d 2c 22 72 65 6d 6f 74 65 2e 6a 73 22 3a 7b 22 73 | ffset":"229842"},"remote.js":{"s |
1020 | 69 7a 65 22 3a 32 31 30 2c 22 6f 66 66 73 65 74 22 3a 22 32 33 30 36 30 37 22 7d 2c 22 73 65 63 | ize":210,"offset":"230607"},"sec |
1040 | 75 72 69 74 79 2d 77 61 72 6e 69 6e 67 73 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 31 36 34 36 | urity-warnings.js":{"size":11646 |
1060 | 2c 22 6f 66 66 73 65 74 22 3a 22 32 33 30 38 31 37 22 7d 2c 22 77 65 62 2d 66 72 61 6d 65 2d 69 | ,"offset":"230817"},"web-frame-i |
1080 | 6e 69 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 38 32 33 2c 22 6f 66 66 73 65 74 22 3a 22 32 34 | nit.js":{"size":823,"offset":"24 |
10a0 | 32 34 36 33 22 7d 2c 22 77 65 62 2d 76 69 65 77 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 67 75 65 | 2463"},"web-view":{"files":{"gue |
10c0 | 73 74 2d 76 69 65 77 2d 69 6e 74 65 72 6e 61 6c 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 34 32 35 | st-view-internal.js":{"size":425 |
10e0 | 34 2c 22 6f 66 66 73 65 74 22 3a 22 32 34 33 32 38 36 22 7d 2c 22 77 65 62 2d 76 69 65 77 2d 61 | 4,"offset":"243286"},"web-view-a |
1100 | 74 74 72 69 62 75 74 65 73 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 39 35 33 39 2c 22 6f 66 66 73 | ttributes.js":{"size":9539,"offs |
1120 | 65 74 22 3a 22 32 34 37 35 34 30 22 7d 2c 22 77 65 62 2d 76 69 65 77 2d 63 6f 6e 73 74 61 6e 74 | et":"247540"},"web-view-constant |
1140 | 73 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 31 32 32 2c 22 6f 66 66 73 65 74 22 3a 22 32 35 37 | s.js":{"size":1122,"offset":"257 |
1160 | 30 37 39 22 7d 2c 22 77 65 62 2d 76 69 65 77 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 32 30 31 | 079"},"web-view.js":{"size":1201 |
1180 | 32 2c 22 6f 66 66 73 65 74 22 3a 22 32 35 38 32 30 31 22 7d 7d 7d 2c 22 77 69 6e 64 6f 77 2d 73 | 2,"offset":"258201"}}},"window-s |
11a0 | 65 74 75 70 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 35 39 38 37 2c 22 6f 66 66 73 65 74 22 3a 22 | etup.js":{"size":5987,"offset":" |
11c0 | 32 37 30 32 31 33 22 7d 7d 7d 2c 22 77 6f 72 6b 65 72 22 3a 7b 22 66 69 6c 65 73 22 3a 7b 22 69 | 270213"}}},"worker":{"files":{"i |
11e0 | 6e 69 74 2e 6a 73 22 3a 7b 22 73 69 7a 65 22 3a 31 32 30 37 2c 22 6f 66 66 73 65 74 22 3a 22 32 | nit.js":{"size":1207,"offset":"2 |
1200 | 37 36 32 30 30 22 7d 7d 7d 7d 7d 00 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 | 76200"}}}}}.'use.strict'..const. |
1220 | 62 69 6e 64 69 6e 67 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 | bindings.=.process.atomBinding(' |
1240 | 61 70 70 27 29 0a 63 6f 6e 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 74 68 | app').const.path.=.require('path |
1260 | 27 29 0a 63 6f 6e 73 74 20 7b 20 61 70 70 2c 20 41 70 70 20 7d 20 3d 20 62 69 6e 64 69 6e 67 73 | ').const.{.app,.App.}.=.bindings |
1280 | 0a 0a 2f 2f 20 4f 6e 6c 79 20 6f 6e 65 20 61 70 70 20 6f 62 6a 65 63 74 20 70 65 72 6d 69 74 74 | ..//.Only.one.app.object.permitt |
12a0 | 65 64 2e 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 61 70 70 0a 0a 63 6f 6e 73 74 20 | ed..module.exports.=.app..const. |
12c0 | 65 6c 65 63 74 72 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 | electron.=.require('electron').c |
12e0 | 6f 6e 73 74 20 7b 20 64 65 70 72 65 63 61 74 65 2c 20 4d 65 6e 75 20 7d 20 3d 20 65 6c 65 63 74 | onst.{.deprecate,.Menu.}.=.elect |
1300 | 72 6f 6e 0a 63 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7d 20 3d 20 72 65 71 | ron.const.{.EventEmitter.}.=.req |
1320 | 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 0a 6c 65 74 20 64 6f 63 6b 4d 65 6e 75 20 3d 20 6e | uire('events')..let.dockMenu.=.n |
1340 | 75 6c 6c 0a 0a 2f 2f 20 41 70 70 20 69 73 20 61 6e 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 0a | ull..//.App.is.an.EventEmitter.. |
1360 | 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 41 70 70 2e 70 72 6f 74 6f 74 | Object.setPrototypeOf(App.protot |
1380 | 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 45 76 65 | ype,.EventEmitter.prototype).Eve |
13a0 | 6e 74 45 6d 69 74 74 65 72 2e 63 61 6c 6c 28 61 70 70 29 0a 0a 4f 62 6a 65 63 74 2e 61 73 73 69 | ntEmitter.call(app)..Object.assi |
13c0 | 67 6e 28 61 70 70 2c 20 7b 0a 20 20 73 65 74 41 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 20 28 | gn(app,.{...setApplicationMenu.( |
13e0 | 6d 65 6e 75 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 4d 65 6e 75 2e 73 65 74 41 70 70 6c 69 | menu).{.....return.Menu.setAppli |
1400 | 63 61 74 69 6f 6e 4d 65 6e 75 28 6d 65 6e 75 29 0a 20 20 7d 2c 0a 20 20 67 65 74 41 70 70 6c 69 | cationMenu(menu)...},...getAppli |
1420 | 63 61 74 69 6f 6e 4d 65 6e 75 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 4d 65 6e 75 2e | cationMenu.().{.....return.Menu. |
1440 | 67 65 74 41 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 28 29 0a 20 20 7d 2c 0a 20 20 63 6f 6d 6d | getApplicationMenu()...},...comm |
1460 | 61 6e 64 4c 69 6e 65 3a 20 7b 0a 20 20 20 20 61 70 70 65 6e 64 53 77 69 74 63 68 20 28 2e 2e 2e | andLine:.{.....appendSwitch.(... |
1480 | 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 63 61 73 74 65 64 41 72 67 73 20 3d | args).{.......const.castedArgs.= |
14a0 | 20 61 72 67 73 2e 6d 61 70 28 28 61 72 67 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 | .args.map((arg).=>.{.........ret |
14c0 | 75 72 6e 20 74 79 70 65 6f 66 20 61 72 67 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 20 3f 20 60 24 | urn.typeof.arg.!==.'string'.?.`$ |
14e0 | 7b 61 72 67 7d 60 20 3a 20 61 72 67 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 72 65 74 75 | {arg}`.:.arg.......}).......retu |
1500 | 72 6e 20 62 69 6e 64 69 6e 67 73 2e 61 70 70 65 6e 64 53 77 69 74 63 68 28 2e 2e 2e 63 61 73 74 | rn.bindings.appendSwitch(...cast |
1520 | 65 64 41 72 67 73 29 0a 20 20 20 20 7d 2c 0a 20 20 20 20 61 70 70 65 6e 64 41 72 67 75 6d 65 6e | edArgs).....},.....appendArgumen |
1540 | 74 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 63 61 73 74 65 64 | t.(...args).{.......const.casted |
1560 | 41 72 67 73 20 3d 20 61 72 67 73 2e 6d 61 70 28 28 61 72 67 29 20 3d 3e 20 7b 0a 20 20 20 20 20 | Args.=.args.map((arg).=>.{...... |
1580 | 20 20 20 72 65 74 75 72 6e 20 74 79 70 65 6f 66 20 61 72 67 20 21 3d 3d 20 27 73 74 72 69 6e 67 | ...return.typeof.arg.!==.'string |
15a0 | 27 20 3f 20 60 24 7b 61 72 67 7d 60 20 3a 20 61 72 67 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 | '.?.`${arg}`.:.arg.......})..... |
15c0 | 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 73 2e 61 70 70 65 6e 64 41 72 67 75 6d 65 6e 74 | ..return.bindings.appendArgument |
15e0 | 28 2e 2e 2e 63 61 73 74 65 64 41 72 67 73 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 29 0a 0a 61 70 | (...castedArgs).....}...}.})..ap |
1600 | 70 2e 69 73 50 61 63 6b 61 67 65 64 20 3d 20 28 28 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 | p.isPackaged.=.(().=>.{...const. |
1620 | 65 78 65 63 46 69 6c 65 20 3d 20 70 61 74 68 2e 62 61 73 65 6e 61 6d 65 28 70 72 6f 63 65 73 73 | execFile.=.path.basename(process |
1640 | 2e 65 78 65 63 50 61 74 68 29 2e 74 6f 4c 6f 77 65 72 43 61 73 65 28 29 0a 20 20 69 66 20 28 70 | .execPath).toLowerCase()...if.(p |
1660 | 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 29 20 7b 0a 20 | rocess.platform.===.'win32').{.. |
1680 | 20 20 20 72 65 74 75 72 6e 20 65 78 65 63 46 69 6c 65 20 21 3d 3d 20 27 65 6c 65 63 74 72 6f 6e | ...return.execFile.!==.'electron |
16a0 | 2e 65 78 65 27 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 65 78 65 63 46 69 6c 65 20 21 3d 3d 20 | .exe'...}...return.execFile.!==. |
16c0 | 27 65 6c 65 63 74 72 6f 6e 27 0a 7d 29 28 29 0a 0a 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 | 'electron'.})()..if.(process.pla |
16e0 | 74 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 29 20 7b 0a 20 20 61 70 70 2e 64 6f 63 6b | tform.===.'darwin').{...app.dock |
1700 | 20 3d 20 7b 0a 20 20 20 20 62 6f 75 6e 63 65 20 28 74 79 70 65 20 3d 20 27 69 6e 66 6f 72 6d 61 | .=.{.....bounce.(type.=.'informa |
1720 | 74 69 6f 6e 61 6c 27 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 73 | tional').{.......return.bindings |
1740 | 2e 64 6f 63 6b 42 6f 75 6e 63 65 28 74 79 70 65 29 0a 20 20 20 20 7d 2c 0a 20 20 20 20 63 61 6e | .dockBounce(type).....},.....can |
1760 | 63 65 6c 42 6f 75 6e 63 65 3a 20 62 69 6e 64 69 6e 67 73 2e 64 6f 63 6b 43 61 6e 63 65 6c 42 6f | celBounce:.bindings.dockCancelBo |
1780 | 75 6e 63 65 2c 0a 20 20 20 20 64 6f 77 6e 6c 6f 61 64 46 69 6e 69 73 68 65 64 3a 20 62 69 6e 64 | unce,.....downloadFinished:.bind |
17a0 | 69 6e 67 73 2e 64 6f 63 6b 44 6f 77 6e 6c 6f 61 64 46 69 6e 69 73 68 65 64 2c 0a 20 20 20 20 73 | ings.dockDownloadFinished,.....s |
17c0 | 65 74 42 61 64 67 65 3a 20 62 69 6e 64 69 6e 67 73 2e 64 6f 63 6b 53 65 74 42 61 64 67 65 54 65 | etBadge:.bindings.dockSetBadgeTe |
17e0 | 78 74 2c 0a 20 20 20 20 67 65 74 42 61 64 67 65 3a 20 62 69 6e 64 69 6e 67 73 2e 64 6f 63 6b 47 | xt,.....getBadge:.bindings.dockG |
1800 | 65 74 42 61 64 67 65 54 65 78 74 2c 0a 20 20 20 20 68 69 64 65 3a 20 62 69 6e 64 69 6e 67 73 2e | etBadgeText,.....hide:.bindings. |
1820 | 64 6f 63 6b 48 69 64 65 2c 0a 20 20 20 20 73 68 6f 77 3a 20 62 69 6e 64 69 6e 67 73 2e 64 6f 63 | dockHide,.....show:.bindings.doc |
1840 | 6b 53 68 6f 77 2c 0a 20 20 20 20 69 73 56 69 73 69 62 6c 65 3a 20 62 69 6e 64 69 6e 67 73 2e 64 | kShow,.....isVisible:.bindings.d |
1860 | 6f 63 6b 49 73 56 69 73 69 62 6c 65 2c 0a 20 20 20 20 73 65 74 4d 65 6e 75 20 28 6d 65 6e 75 29 | ockIsVisible,.....setMenu.(menu) |
1880 | 20 7b 0a 20 20 20 20 20 20 64 6f 63 6b 4d 65 6e 75 20 3d 20 6d 65 6e 75 0a 20 20 20 20 20 20 62 | .{.......dockMenu.=.menu.......b |
18a0 | 69 6e 64 69 6e 67 73 2e 64 6f 63 6b 53 65 74 4d 65 6e 75 28 6d 65 6e 75 29 0a 20 20 20 20 7d 2c | indings.dockSetMenu(menu).....}, |
18c0 | 0a 20 20 20 20 67 65 74 4d 65 6e 75 20 28 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 64 | .....getMenu.().{.......return.d |
18e0 | 6f 63 6b 4d 65 6e 75 0a 20 20 20 20 7d 2c 0a 20 20 20 20 73 65 74 49 63 6f 6e 3a 20 62 69 6e 64 | ockMenu.....},.....setIcon:.bind |
1900 | 69 6e 67 73 2e 64 6f 63 6b 53 65 74 49 63 6f 6e 0a 20 20 7d 0a 7d 0a 0a 69 66 20 28 70 72 6f 63 | ings.dockSetIcon...}.}..if.(proc |
1920 | 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 6c 69 6e 75 78 27 29 20 7b 0a 20 20 61 70 | ess.platform.===.'linux').{...ap |
1940 | 70 2e 6c 61 75 6e 63 68 65 72 20 3d 20 7b 0a 20 20 20 20 73 65 74 42 61 64 67 65 43 6f 75 6e 74 | p.launcher.=.{.....setBadgeCount |
1960 | 3a 20 62 69 6e 64 69 6e 67 73 2e 75 6e 69 74 79 4c 61 75 6e 63 68 65 72 53 65 74 42 61 64 67 65 | :.bindings.unityLauncherSetBadge |
1980 | 43 6f 75 6e 74 2c 0a 20 20 20 20 67 65 74 42 61 64 67 65 43 6f 75 6e 74 3a 20 62 69 6e 64 69 6e | Count,.....getBadgeCount:.bindin |
19a0 | 67 73 2e 75 6e 69 74 79 4c 61 75 6e 63 68 65 72 47 65 74 42 61 64 67 65 43 6f 75 6e 74 2c 0a 20 | gs.unityLauncherGetBadgeCount,.. |
19c0 | 20 20 20 69 73 43 6f 75 6e 74 65 72 42 61 64 67 65 41 76 61 69 6c 61 62 6c 65 3a 20 62 69 6e 64 | ...isCounterBadgeAvailable:.bind |
19e0 | 69 6e 67 73 2e 75 6e 69 74 79 4c 61 75 6e 63 68 65 72 41 76 61 69 6c 61 62 6c 65 2c 0a 20 20 20 | ings.unityLauncherAvailable,.... |
1a00 | 20 69 73 55 6e 69 74 79 52 75 6e 6e 69 6e 67 3a 20 62 69 6e 64 69 6e 67 73 2e 75 6e 69 74 79 4c | .isUnityRunning:.bindings.unityL |
1a20 | 61 75 6e 63 68 65 72 41 76 61 69 6c 61 62 6c 65 0a 20 20 7d 0a 7d 0a 0a 61 70 70 2e 61 6c 6c 6f | auncherAvailable...}.}..app.allo |
1a40 | 77 4e 54 4c 4d 43 72 65 64 65 6e 74 69 61 6c 73 46 6f 72 41 6c 6c 44 6f 6d 61 69 6e 73 20 3d 20 | wNTLMCredentialsForAllDomains.=. |
1a60 | 66 75 6e 63 74 69 6f 6e 20 28 61 6c 6c 6f 77 29 20 7b 0a 20 20 69 66 20 28 21 70 72 6f 63 65 73 | function.(allow).{...if.(!proces |
1a80 | 73 2e 6e 6f 44 65 70 72 65 63 61 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 64 65 70 72 65 63 61 74 | s.noDeprecations).{.....deprecat |
1aa0 | 65 2e 77 61 72 6e 28 27 61 70 70 2e 61 6c 6c 6f 77 4e 54 4c 4d 43 72 65 64 65 6e 74 69 61 6c 73 | e.warn('app.allowNTLMCredentials |
1ac0 | 46 6f 72 41 6c 6c 44 6f 6d 61 69 6e 73 27 2c 20 27 73 65 73 73 69 6f 6e 2e 61 6c 6c 6f 77 4e 54 | ForAllDomains',.'session.allowNT |
1ae0 | 4c 4d 43 72 65 64 65 6e 74 69 61 6c 73 46 6f 72 44 6f 6d 61 69 6e 73 27 29 0a 20 20 7d 0a 20 20 | LMCredentialsForDomains')...}... |
1b00 | 63 6f 6e 73 74 20 64 6f 6d 61 69 6e 73 20 3d 20 61 6c 6c 6f 77 20 3f 20 27 2a 27 20 3a 20 27 27 | const.domains.=.allow.?.'*'.:.'' |
1b20 | 0a 20 20 69 66 20 28 21 74 68 69 73 2e 69 73 52 65 61 64 79 28 29 29 20 7b 0a 20 20 20 20 74 68 | ...if.(!this.isReady()).{.....th |
1b40 | 69 73 2e 63 6f 6d 6d 61 6e 64 4c 69 6e 65 2e 61 70 70 65 6e 64 53 77 69 74 63 68 28 27 61 75 74 | is.commandLine.appendSwitch('aut |
1b60 | 68 2d 73 65 72 76 65 72 2d 77 68 69 74 65 6c 69 73 74 27 2c 20 64 6f 6d 61 69 6e 73 29 0a 20 20 | h-server-whitelist',.domains)... |
1b80 | 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 65 6c 65 63 74 72 6f 6e 2e 73 65 73 73 69 6f 6e 2e 64 65 | }.else.{.....electron.session.de |
1ba0 | 66 61 75 6c 74 53 65 73 73 69 6f 6e 2e 61 6c 6c 6f 77 4e 54 4c 4d 43 72 65 64 65 6e 74 69 61 6c | faultSession.allowNTLMCredential |
1bc0 | 73 46 6f 72 44 6f 6d 61 69 6e 73 28 64 6f 6d 61 69 6e 73 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 52 | sForDomains(domains)...}.}..//.R |
1be0 | 6f 75 74 65 73 20 74 68 65 20 65 76 65 6e 74 73 20 74 6f 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e | outes.the.events.to.webContents. |
1c00 | 0a 63 6f 6e 73 74 20 65 76 65 6e 74 73 20 3d 20 5b 27 6c 6f 67 69 6e 27 2c 20 27 63 65 72 74 69 | .const.events.=.['login',.'certi |
1c20 | 66 69 63 61 74 65 2d 65 72 72 6f 72 27 2c 20 27 73 65 6c 65 63 74 2d 63 6c 69 65 6e 74 2d 63 65 | ficate-error',.'select-client-ce |
1c40 | 72 74 69 66 69 63 61 74 65 27 5d 0a 66 6f 72 20 28 63 6f 6e 73 74 20 6e 61 6d 65 20 6f 66 20 65 | rtificate'].for.(const.name.of.e |
1c60 | 76 65 6e 74 73 29 20 7b 0a 20 20 61 70 70 2e 6f 6e 28 6e 61 6d 65 2c 20 28 65 76 65 6e 74 2c 20 | vents).{...app.on(name,.(event,. |
1c80 | 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 2e 2e 2e 61 72 67 73 29 20 3d 3e 20 7b 0a 20 20 20 20 77 | webContents,....args).=>.{.....w |
1ca0 | 65 62 43 6f 6e 74 65 6e 74 73 2e 65 6d 69 74 28 6e 61 6d 65 2c 20 65 76 65 6e 74 2c 20 2e 2e 2e | ebContents.emit(name,.event,.... |
1cc0 | 61 72 67 73 29 0a 20 20 7d 29 0a 7d 0a 0a 2f 2f 20 57 72 61 70 70 65 72 73 20 66 6f 72 20 6e 61 | args)...}).}..//.Wrappers.for.na |
1ce0 | 74 69 76 65 20 63 6c 61 73 73 65 73 2e 0a 63 6f 6e 73 74 20 7b 20 44 6f 77 6e 6c 6f 61 64 49 74 | tive.classes..const.{.DownloadIt |
1d00 | 65 6d 20 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 64 6f 77 6e | em.}.=.process.atomBinding('down |
1d20 | 6c 6f 61 64 5f 69 74 65 6d 27 29 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f | load_item').Object.setPrototypeO |
1d40 | 66 28 44 6f 77 6e 6c 6f 61 64 49 74 65 6d 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 | f(DownloadItem.prototype,.EventE |
1d60 | 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a | mitter.prototype).'use.strict'.. |
1d80 | 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 | if.(process.platform.===.'win32' |
1da0 | 29 20 7b 0a 20 20 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 72 65 71 75 69 72 65 28 27 | ).{...module.exports.=.require(' |
1dc0 | 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 61 70 69 2f 61 | @electron/internal/browser/api/a |
1de0 | 75 74 6f 2d 75 70 64 61 74 65 72 2f 61 75 74 6f 2d 75 70 64 61 74 65 72 2d 77 69 6e 27 29 0a 7d | uto-updater/auto-updater-win').} |
1e00 | 20 65 6c 73 65 20 7b 0a 20 20 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 72 65 71 75 69 | .else.{...module.exports.=.requi |
1e20 | 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 61 | re('@electron/internal/browser/a |
1e40 | 70 69 2f 61 75 74 6f 2d 75 70 64 61 74 65 72 2f 61 75 74 6f 2d 75 70 64 61 74 65 72 2d 6e 61 74 | pi/auto-updater/auto-updater-nat |
1e60 | 69 76 65 27 29 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 45 76 65 6e | ive').}.'use.strict'..const.Even |
1e80 | 74 45 6d 69 74 74 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 2e 45 76 65 | tEmitter.=.require('events').Eve |
1ea0 | 6e 74 45 6d 69 74 74 65 72 0a 63 6f 6e 73 74 20 7b 20 61 75 74 6f 55 70 64 61 74 65 72 2c 20 41 | ntEmitter.const.{.autoUpdater,.A |
1ec0 | 75 74 6f 55 70 64 61 74 65 72 20 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 | utoUpdater.}.=.process.atomBindi |
1ee0 | 6e 67 28 27 61 75 74 6f 5f 75 70 64 61 74 65 72 27 29 0a 0a 2f 2f 20 41 75 74 6f 55 70 64 61 74 | ng('auto_updater')..//.AutoUpdat |
1f00 | 65 72 20 69 73 20 61 6e 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 0a 4f 62 6a 65 63 74 2e 73 65 | er.is.an.EventEmitter..Object.se |
1f20 | 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 41 75 74 6f 55 70 64 61 74 65 72 2e 70 72 6f 74 6f 74 79 | tPrototypeOf(AutoUpdater.prototy |
1f40 | 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 45 76 65 6e | pe,.EventEmitter.prototype).Even |
1f60 | 74 45 6d 69 74 74 65 72 2e 63 61 6c 6c 28 61 75 74 6f 55 70 64 61 74 65 72 29 0a 0a 6d 6f 64 75 | tEmitter.call(autoUpdater)..modu |
1f80 | 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 61 75 74 6f 55 70 64 61 74 65 72 0a 27 75 73 65 20 73 74 | le.exports.=.autoUpdater.'use.st |
1fa0 | 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 61 70 70 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 | rict'..const.{.app.}.=.require(' |
1fc0 | 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 | electron').const.{.EventEmitter. |
1fe0 | 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 73 71 75 69 | }.=.require('events').const.squi |
2000 | 72 72 65 6c 55 70 64 61 74 65 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f | rrelUpdate.=.require('@electron/ |
2020 | 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 61 70 69 2f 61 75 74 6f 2d 75 70 64 61 74 65 | internal/browser/api/auto-update |
2040 | 72 2f 73 71 75 69 72 72 65 6c 2d 75 70 64 61 74 65 2d 77 69 6e 27 29 0a 0a 63 6c 61 73 73 20 41 | r/squirrel-update-win')..class.A |
2060 | 75 74 6f 55 70 64 61 74 65 72 20 65 78 74 65 6e 64 73 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 | utoUpdater.extends.EventEmitter. |
2080 | 7b 0a 20 20 71 75 69 74 41 6e 64 49 6e 73 74 61 6c 6c 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 | {...quitAndInstall.().{.....if.( |
20a0 | 21 74 68 69 73 2e 75 70 64 61 74 65 41 76 61 69 6c 61 62 6c 65 29 20 7b 0a 20 20 20 20 20 20 72 | !this.updateAvailable).{.......r |
20c0 | 65 74 75 72 6e 20 74 68 69 73 2e 65 6d 69 74 45 72 72 6f 72 28 27 4e 6f 20 75 70 64 61 74 65 20 | eturn.this.emitError('No.update. |
20e0 | 61 76 61 69 6c 61 62 6c 65 2c 20 63 61 6e 5c 27 74 20 71 75 69 74 20 61 6e 64 20 69 6e 73 74 61 | available,.can\'t.quit.and.insta |
2100 | 6c 6c 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 73 71 75 69 72 72 65 6c 55 70 64 61 74 65 2e 70 72 | ll').....}.....squirrelUpdate.pr |
2120 | 6f 63 65 73 73 53 74 61 72 74 28 29 0a 20 20 20 20 61 70 70 2e 71 75 69 74 28 29 0a 20 20 7d 0a | ocessStart().....app.quit()...}. |
2140 | 0a 20 20 67 65 74 46 65 65 64 55 52 4c 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 | ...getFeedURL.().{.....return.th |
2160 | 69 73 2e 75 70 64 61 74 65 55 52 4c 0a 20 20 7d 0a 0a 20 20 73 65 74 46 65 65 64 55 52 4c 20 28 | is.updateURL...}....setFeedURL.( |
2180 | 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 6c 65 74 20 75 70 64 61 74 65 55 52 4c 0a 20 20 20 | options).{.....let.updateURL.... |
21a0 | 20 69 66 20 28 74 79 70 65 6f 66 20 6f 70 74 69 6f 6e 73 20 3d 3d 3d 20 27 6f 62 6a 65 63 74 27 | .if.(typeof.options.===.'object' |
21c0 | 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 6f 70 74 69 6f 6e 73 2e 75 72 6c | ).{.......if.(typeof.options.url |
21e0 | 20 3d 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 20 20 75 70 64 61 74 65 55 | .===.'string').{.........updateU |
2200 | 52 4c 20 3d 20 6f 70 74 69 6f 6e 73 2e 75 72 6c 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a | RL.=.options.url.......}.else.{. |
2220 | 20 20 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 45 78 70 65 63 74 65 | ........throw.new.Error('Expecte |
2240 | 64 20 6f 70 74 69 6f 6e 73 20 6f 62 6a 65 63 74 20 74 6f 20 63 6f 6e 74 61 69 6e 20 61 20 5c 27 | d.options.object.to.contain.a.\' |
2260 | 75 72 6c 5c 27 20 73 74 72 69 6e 67 20 70 72 6f 70 65 72 74 79 20 69 6e 20 73 65 74 46 65 65 64 | url\'.string.property.in.setFeed |
2280 | 55 72 6c 20 63 61 6c 6c 27 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 | Url.call').......}.....}.else.if |
22a0 | 20 28 74 79 70 65 6f 66 20 6f 70 74 69 6f 6e 73 20 3d 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b | .(typeof.options.===.'string').{ |
22c0 | 0a 20 20 20 20 20 20 75 70 64 61 74 65 55 52 4c 20 3d 20 6f 70 74 69 6f 6e 73 0a 20 20 20 20 7d | .......updateURL.=.options.....} |
22e0 | 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 45 | .else.{.......throw.new.Error('E |
2300 | 78 70 65 63 74 65 64 20 61 6e 20 6f 70 74 69 6f 6e 73 20 6f 62 6a 65 63 74 20 77 69 74 68 20 61 | xpected.an.options.object.with.a |
2320 | 20 5c 27 75 72 6c 5c 27 20 70 72 6f 70 65 72 74 79 20 74 6f 20 62 65 20 70 72 6f 76 69 64 65 64 | .\'url\'.property.to.be.provided |
2340 | 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 73 2e 75 70 64 61 74 65 55 52 4c 20 3d 20 75 70 | ').....}.....this.updateURL.=.up |
2360 | 64 61 74 65 55 52 4c 0a 20 20 7d 0a 0a 20 20 63 68 65 63 6b 46 6f 72 55 70 64 61 74 65 73 20 28 | dateURL...}....checkForUpdates.( |
2380 | 29 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 75 70 64 61 74 65 55 52 4c 29 20 7b 0a 20 | ).{.....if.(!this.updateURL).{.. |
23a0 | 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 65 6d 69 74 45 72 72 6f 72 28 27 55 70 64 61 | .....return.this.emitError('Upda |
23c0 | 74 65 20 55 52 4c 20 69 73 20 6e 6f 74 20 73 65 74 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 | te.URL.is.not.set').....}.....if |
23e0 | 20 28 21 73 71 75 69 72 72 65 6c 55 70 64 61 74 65 2e 73 75 70 70 6f 72 74 65 64 28 29 29 20 7b | .(!squirrelUpdate.supported()).{ |
2400 | 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 65 6d 69 74 45 72 72 6f 72 28 27 43 61 | .......return.this.emitError('Ca |
2420 | 6e 20 6e 6f 74 20 66 69 6e 64 20 53 71 75 69 72 72 65 6c 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 | n.not.find.Squirrel').....}..... |
2440 | 74 68 69 73 2e 65 6d 69 74 28 27 63 68 65 63 6b 69 6e 67 2d 66 6f 72 2d 75 70 64 61 74 65 27 29 | this.emit('checking-for-update') |
2460 | 0a 20 20 20 20 73 71 75 69 72 72 65 6c 55 70 64 61 74 65 2e 63 68 65 63 6b 46 6f 72 55 70 64 61 | .....squirrelUpdate.checkForUpda |
2480 | 74 65 28 74 68 69 73 2e 75 70 64 61 74 65 55 52 4c 2c 20 28 65 72 72 6f 72 2c 20 75 70 64 61 74 | te(this.updateURL,.(error,.updat |
24a0 | 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 69 66 20 28 65 72 72 6f 72 20 21 3d 20 6e 75 6c 6c 29 | e).=>.{.......if.(error.!=.null) |
24c0 | 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 65 6d 69 74 45 72 72 6f 72 | .{.........return.this.emitError |
24e0 | 28 65 72 72 6f 72 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 69 66 20 28 75 70 64 61 74 65 | (error).......}.......if.(update |
2500 | 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e | .==.null).{.........return.this. |
2520 | 65 6d 69 74 28 27 75 70 64 61 74 65 2d 6e 6f 74 2d 61 76 61 69 6c 61 62 6c 65 27 29 0a 20 20 20 | emit('update-not-available').... |
2540 | 20 20 20 7d 0a 20 20 20 20 20 20 74 68 69 73 2e 75 70 64 61 74 65 41 76 61 69 6c 61 62 6c 65 20 | ...}.......this.updateAvailable. |
2560 | 3d 20 74 72 75 65 0a 20 20 20 20 20 20 74 68 69 73 2e 65 6d 69 74 28 27 75 70 64 61 74 65 2d 61 | =.true.......this.emit('update-a |
2580 | 76 61 69 6c 61 62 6c 65 27 29 0a 20 20 20 20 20 20 73 71 75 69 72 72 65 6c 55 70 64 61 74 65 2e | vailable').......squirrelUpdate. |
25a0 | 75 70 64 61 74 65 28 74 68 69 73 2e 75 70 64 61 74 65 55 52 4c 2c 20 28 65 72 72 6f 72 29 20 3d | update(this.updateURL,.(error).= |
25c0 | 3e 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 65 72 72 6f 72 20 21 3d 20 6e 75 6c 6c 29 20 7b | >.{.........if.(error.!=.null).{ |
25e0 | 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 65 6d 69 74 45 72 72 6f 72 | ...........return.this.emitError |
2600 | 28 65 72 72 6f 72 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 | (error).........}.........const. |
2620 | 7b 20 72 65 6c 65 61 73 65 4e 6f 74 65 73 2c 20 76 65 72 73 69 6f 6e 20 7d 20 3d 20 75 70 64 61 | {.releaseNotes,.version.}.=.upda |
2640 | 74 65 0a 20 20 20 20 20 20 20 20 2f 2f 20 44 61 74 65 20 69 73 20 6e 6f 74 20 61 76 61 69 6c 61 | te.........//.Date.is.not.availa |
2660 | 62 6c 65 20 6f 6e 20 57 69 6e 64 6f 77 73 2c 20 73 6f 20 66 61 6b 65 20 69 74 2e 0a 20 20 20 20 | ble.on.Windows,.so.fake.it...... |
2680 | 20 20 20 20 63 6f 6e 73 74 20 64 61 74 65 20 3d 20 6e 65 77 20 44 61 74 65 28 29 0a 20 20 20 20 | ....const.date.=.new.Date()..... |
26a0 | 20 20 20 20 74 68 69 73 2e 65 6d 69 74 28 27 75 70 64 61 74 65 2d 64 6f 77 6e 6c 6f 61 64 65 64 | ....this.emit('update-downloaded |
26c0 | 27 2c 20 7b 7d 2c 20 72 65 6c 65 61 73 65 4e 6f 74 65 73 2c 20 76 65 72 73 69 6f 6e 2c 20 64 61 | ',.{},.releaseNotes,.version,.da |
26e0 | 74 65 2c 20 74 68 69 73 2e 75 70 64 61 74 65 55 52 4c 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 | te,.this.updateURL,.().=>.{..... |
2700 | 20 20 20 20 20 20 74 68 69 73 2e 71 75 69 74 41 6e 64 49 6e 73 74 61 6c 6c 28 29 0a 20 20 20 20 | ......this.quitAndInstall()..... |
2720 | 20 20 20 20 7d 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 2f 2f | ....}).......}).....})...}....// |
2740 | 20 50 72 69 76 61 74 65 3a 20 45 6d 69 74 20 62 6f 74 68 20 65 72 72 6f 72 20 6f 62 6a 65 63 74 | .Private:.Emit.both.error.object |
2760 | 20 61 6e 64 20 6d 65 73 73 61 67 65 2c 20 74 68 69 73 20 69 73 20 74 6f 20 6b 65 65 70 20 63 6f | .and.message,.this.is.to.keep.co |
2780 | 6d 70 61 74 69 62 69 6c 69 74 79 0a 20 20 2f 2f 20 77 69 74 68 20 4f 6c 64 20 41 50 49 73 2e 0a | mpatibility...//.with.Old.APIs.. |
27a0 | 20 20 65 6d 69 74 45 72 72 6f 72 20 28 6d 65 73 73 61 67 65 29 20 7b 0a 20 20 20 20 74 68 69 73 | ..emitError.(message).{.....this |
27c0 | 2e 65 6d 69 74 28 27 65 72 72 6f 72 27 2c 20 6e 65 77 20 45 72 72 6f 72 28 6d 65 73 73 61 67 65 | .emit('error',.new.Error(message |
27e0 | 29 2c 20 6d 65 73 73 61 67 65 29 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 | ),.message)...}.}..module.export |
2800 | 73 20 3d 20 6e 65 77 20 41 75 74 6f 55 70 64 61 74 65 72 28 29 0a 27 75 73 65 20 73 74 72 69 63 | s.=.new.AutoUpdater().'use.stric |
2820 | 74 27 0a 0a 63 6f 6e 73 74 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 29 0a 63 6f 6e | t'..const.fs.=.require('fs').con |
2840 | 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 74 68 27 29 0a 63 6f 6e 73 74 20 | st.path.=.require('path').const. |
2860 | 73 70 61 77 6e 20 3d 20 72 65 71 75 69 72 65 28 27 63 68 69 6c 64 5f 70 72 6f 63 65 73 73 27 29 | spawn.=.require('child_process') |
2880 | 2e 73 70 61 77 6e 0a 0a 2f 2f 20 69 2e 65 2e 20 6d 79 2d 61 70 70 2f 61 70 70 2d 30 2e 31 2e 31 | .spawn..//.i.e..my-app/app-0.1.1 |
28a0 | 33 2f 0a 63 6f 6e 73 74 20 61 70 70 46 6f 6c 64 65 72 20 3d 20 70 61 74 68 2e 64 69 72 6e 61 6d | 3/.const.appFolder.=.path.dirnam |
28c0 | 65 28 70 72 6f 63 65 73 73 2e 65 78 65 63 50 61 74 68 29 0a 0a 2f 2f 20 69 2e 65 2e 20 6d 79 2d | e(process.execPath)..//.i.e..my- |
28e0 | 61 70 70 2f 55 70 64 61 74 65 2e 65 78 65 0a 63 6f 6e 73 74 20 75 70 64 61 74 65 45 78 65 20 3d | app/Update.exe.const.updateExe.= |
2900 | 20 70 61 74 68 2e 72 65 73 6f 6c 76 65 28 61 70 70 46 6f 6c 64 65 72 2c 20 27 2e 2e 27 2c 20 27 | .path.resolve(appFolder,.'..',.' |
2920 | 55 70 64 61 74 65 2e 65 78 65 27 29 0a 63 6f 6e 73 74 20 65 78 65 4e 61 6d 65 20 3d 20 70 61 74 | Update.exe').const.exeName.=.pat |
2940 | 68 2e 62 61 73 65 6e 61 6d 65 28 70 72 6f 63 65 73 73 2e 65 78 65 63 50 61 74 68 29 0a 6c 65 74 | h.basename(process.execPath).let |
2960 | 20 73 70 61 77 6e 65 64 41 72 67 73 20 3d 20 5b 5d 0a 6c 65 74 20 73 70 61 77 6e 65 64 50 72 6f | .spawnedArgs.=.[].let.spawnedPro |
2980 | 63 65 73 73 0a 0a 63 6f 6e 73 74 20 69 73 53 61 6d 65 41 72 67 73 20 3d 20 28 61 72 67 73 29 20 | cess..const.isSameArgs.=.(args). |
29a0 | 3d 3e 20 61 72 67 73 2e 6c 65 6e 67 74 68 20 3d 3d 3d 20 73 70 61 77 6e 65 64 41 72 67 73 2e 6c | =>.args.length.===.spawnedArgs.l |
29c0 | 65 6e 67 74 68 20 26 26 20 61 72 67 73 2e 65 76 65 72 79 28 28 65 2c 20 69 29 20 3d 3e 20 65 20 | ength.&&.args.every((e,.i).=>.e. |
29e0 | 3d 3d 3d 20 73 70 61 77 6e 65 64 41 72 67 73 5b 69 5d 29 0a 0a 2f 2f 20 53 70 61 77 6e 20 61 20 | ===.spawnedArgs[i])..//.Spawn.a. |
2a00 | 63 6f 6d 6d 61 6e 64 20 61 6e 64 20 69 6e 76 6f 6b 65 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 | command.and.invoke.the.callback. |
2a20 | 77 68 65 6e 20 69 74 20 63 6f 6d 70 6c 65 74 65 73 20 77 69 74 68 20 61 6e 20 65 72 72 6f 72 0a | when.it.completes.with.an.error. |
2a40 | 2f 2f 20 61 6e 64 20 74 68 65 20 6f 75 74 70 75 74 20 66 72 6f 6d 20 73 74 61 6e 64 61 72 64 20 | //.and.the.output.from.standard. |
2a60 | 6f 75 74 2e 0a 63 6f 6e 73 74 20 73 70 61 77 6e 55 70 64 61 74 65 20 3d 20 66 75 6e 63 74 69 6f | out..const.spawnUpdate.=.functio |
2a80 | 6e 20 28 61 72 67 73 2c 20 64 65 74 61 63 68 65 64 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 | n.(args,.detached,.callback).{.. |
2aa0 | 20 6c 65 74 20 65 72 72 6f 72 2c 20 65 72 72 6f 72 45 6d 69 74 74 65 64 2c 20 73 74 64 65 72 72 | .let.error,.errorEmitted,.stderr |
2ac0 | 2c 20 73 74 64 6f 75 74 0a 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 2f 2f 20 45 6e 73 75 72 65 20 | ,.stdout....try.{.....//.Ensure. |
2ae0 | 77 65 20 64 6f 6e 27 74 20 73 70 61 77 6e 20 6d 75 6c 74 69 70 6c 65 20 73 71 75 69 72 72 65 6c | we.don't.spawn.multiple.squirrel |
2b00 | 20 70 72 6f 63 65 73 73 65 73 0a 20 20 20 20 2f 2f 20 50 72 6f 63 65 73 73 20 73 70 61 77 6e 65 | .processes.....//.Process.spawne |
2b20 | 64 2c 20 73 61 6d 65 20 61 72 67 73 3a 20 20 20 20 20 20 20 20 41 74 74 61 63 68 20 65 76 65 6e | d,.same.args:........Attach.even |
2b40 | 74 73 20 74 6f 20 61 6c 72 65 61 64 20 72 75 6e 6e 69 6e 67 20 70 72 6f 63 65 73 73 0a 20 20 20 | ts.to.alread.running.process.... |
2b60 | 20 2f 2f 20 50 72 6f 63 65 73 73 20 73 70 61 77 6e 65 64 2c 20 64 69 66 66 65 72 65 6e 74 20 61 | .//.Process.spawned,.different.a |
2b80 | 72 67 73 3a 20 20 20 52 65 74 75 72 6e 20 77 69 74 68 20 65 72 72 6f 72 0a 20 20 20 20 2f 2f 20 | rgs:...Return.with.error.....//. |
2ba0 | 4e 6f 20 70 72 6f 63 65 73 73 20 73 70 61 77 6e 65 64 3a 20 20 20 20 20 20 20 20 20 20 20 20 20 | No.process.spawned:............. |
2bc0 | 20 20 20 53 70 61 77 6e 20 6e 65 77 20 70 72 6f 63 65 73 73 0a 20 20 20 20 69 66 20 28 73 70 61 | ...Spawn.new.process.....if.(spa |
2be0 | 77 6e 65 64 50 72 6f 63 65 73 73 20 26 26 20 21 69 73 53 61 6d 65 41 72 67 73 28 61 72 67 73 29 | wnedProcess.&&.!isSameArgs(args) |
2c00 | 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 44 69 73 61 62 6c 65 64 20 66 6f 72 20 62 61 63 6b 77 61 | ).{.......//.Disabled.for.backwa |
2c20 | 72 64 73 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 3a 0a 20 20 20 20 20 20 2f 2f 20 65 73 6c 69 | rds.compatibility:.......//.esli |
2c40 | 6e 74 2d 64 69 73 61 62 6c 65 2d 6e 65 78 74 2d 6c 69 6e 65 20 73 74 61 6e 64 61 72 64 2f 6e 6f | nt-disable-next-line.standard/no |
2c60 | 2d 63 61 6c 6c 62 61 63 6b 2d 6c 69 74 65 72 61 6c 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 | -callback-literal.......return.c |
2c80 | 61 6c 6c 62 61 63 6b 28 60 41 75 74 6f 55 70 64 61 74 65 72 20 70 72 6f 63 65 73 73 20 77 69 74 | allback(`AutoUpdater.process.wit |
2ca0 | 68 20 61 72 67 75 6d 65 6e 74 73 20 24 7b 61 72 67 73 7d 20 69 73 20 61 6c 72 65 61 64 79 20 72 | h.arguments.${args}.is.already.r |
2cc0 | 75 6e 6e 69 6e 67 60 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 21 73 70 61 77 6e 65 64 | unning`).....}.else.if.(!spawned |
2ce0 | 50 72 6f 63 65 73 73 29 20 7b 0a 20 20 20 20 20 20 73 70 61 77 6e 65 64 50 72 6f 63 65 73 73 20 | Process).{.......spawnedProcess. |
2d00 | 3d 20 73 70 61 77 6e 28 75 70 64 61 74 65 45 78 65 2c 20 61 72 67 73 2c 20 7b 0a 20 20 20 20 20 | =.spawn(updateExe,.args,.{...... |
2d20 | 20 20 20 64 65 74 61 63 68 65 64 3a 20 64 65 74 61 63 68 65 64 2c 0a 20 20 20 20 20 20 20 20 77 | ...detached:.detached,.........w |
2d40 | 69 6e 64 6f 77 73 48 69 64 65 3a 20 74 72 75 65 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 | indowsHide:.true.......})....... |
2d60 | 73 70 61 77 6e 65 64 41 72 67 73 20 3d 20 61 72 67 73 20 7c 7c 20 5b 5d 0a 20 20 20 20 7d 0a 20 | spawnedArgs.=.args.||.[].....}.. |
2d80 | 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 31 29 20 7b 0a 20 20 20 20 65 72 72 6f 72 20 3d 20 | .}.catch.(error1).{.....error.=. |
2da0 | 65 72 72 6f 72 31 0a 0a 20 20 20 20 2f 2f 20 53 68 6f 75 6c 64 6e 27 74 20 68 61 70 70 65 6e 2c | error1......//.Shouldn't.happen, |
2dc0 | 20 62 75 74 20 73 74 69 6c 6c 20 67 75 61 72 64 20 69 74 2e 0a 20 20 20 20 70 72 6f 63 65 73 73 | .but.still.guard.it......process |
2de0 | 2e 6e 65 78 74 54 69 63 6b 28 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 72 65 | .nextTick(function.().{.......re |
2e00 | 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 65 72 72 6f 72 29 0a 20 20 20 20 7d 29 0a 20 20 20 20 | turn.callback(error).....})..... |
2e20 | 72 65 74 75 72 6e 0a 20 20 7d 0a 20 20 73 74 64 6f 75 74 20 3d 20 27 27 0a 20 20 73 74 64 65 72 | return...}...stdout.=.''...stder |
2e40 | 72 20 3d 20 27 27 0a 0a 20 20 73 70 61 77 6e 65 64 50 72 6f 63 65 73 73 2e 73 74 64 6f 75 74 2e | r.=.''....spawnedProcess.stdout. |
2e60 | 6f 6e 28 27 64 61 74 61 27 2c 20 28 64 61 74 61 29 20 3d 3e 20 7b 20 73 74 64 6f 75 74 20 2b 3d | on('data',.(data).=>.{.stdout.+= |
2e80 | 20 64 61 74 61 20 7d 29 0a 20 20 73 70 61 77 6e 65 64 50 72 6f 63 65 73 73 2e 73 74 64 65 72 72 | .data.})...spawnedProcess.stderr |
2ea0 | 2e 6f 6e 28 27 64 61 74 61 27 2c 20 28 64 61 74 61 29 20 3d 3e 20 7b 20 73 74 64 65 72 72 20 2b | .on('data',.(data).=>.{.stderr.+ |
2ec0 | 3d 20 64 61 74 61 20 7d 29 0a 0a 20 20 65 72 72 6f 72 45 6d 69 74 74 65 64 20 3d 20 66 61 6c 73 | =.data.})....errorEmitted.=.fals |
2ee0 | 65 0a 20 20 73 70 61 77 6e 65 64 50 72 6f 63 65 73 73 2e 6f 6e 28 27 65 72 72 6f 72 27 2c 20 28 | e...spawnedProcess.on('error',.( |
2f00 | 65 72 72 6f 72 29 20 3d 3e 20 7b 0a 20 20 20 20 65 72 72 6f 72 45 6d 69 74 74 65 64 20 3d 20 74 | error).=>.{.....errorEmitted.=.t |
2f20 | 72 75 65 0a 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 65 72 72 6f 72 29 0a 20 20 7d 29 0a 0a 20 20 | rue.....callback(error)...}).... |
2f40 | 72 65 74 75 72 6e 20 73 70 61 77 6e 65 64 50 72 6f 63 65 73 73 2e 6f 6e 28 27 65 78 69 74 27 2c | return.spawnedProcess.on('exit', |
2f60 | 20 66 75 6e 63 74 69 6f 6e 20 28 63 6f 64 65 2c 20 73 69 67 6e 61 6c 29 20 7b 0a 20 20 20 20 73 | .function.(code,.signal).{.....s |
2f80 | 70 61 77 6e 65 64 50 72 6f 63 65 73 73 20 3d 20 75 6e 64 65 66 69 6e 65 64 0a 20 20 20 20 73 70 | pawnedProcess.=.undefined.....sp |
2fa0 | 61 77 6e 65 64 41 72 67 73 20 3d 20 5b 5d 0a 0a 20 20 20 20 2f 2f 20 57 65 20 6d 61 79 20 68 61 | awnedArgs.=.[]......//.We.may.ha |
2fc0 | 76 65 20 61 6c 72 65 61 64 79 20 65 6d 69 74 74 65 64 20 61 6e 20 65 72 72 6f 72 2e 0a 20 20 20 | ve.already.emitted.an.error..... |
2fe0 | 20 69 66 20 28 65 72 72 6f 72 45 6d 69 74 74 65 64 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 | .if.(errorEmitted).{.......retur |
3000 | 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 50 72 6f 63 65 73 73 20 74 65 72 6d 69 6e 61 74 | n.....}......//.Process.terminat |
3020 | 65 64 20 77 69 74 68 20 65 72 72 6f 72 2e 0a 20 20 20 20 69 66 20 28 63 6f 64 65 20 21 3d 3d 20 | ed.with.error......if.(code.!==. |
3040 | 30 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 44 69 73 61 62 6c 65 64 20 66 6f 72 20 62 61 63 6b 77 | 0).{.......//.Disabled.for.backw |
3060 | 61 72 64 73 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 3a 0a 20 20 20 20 20 20 2f 2f 20 65 73 6c | ards.compatibility:.......//.esl |
3080 | 69 6e 74 2d 64 69 73 61 62 6c 65 2d 6e 65 78 74 2d 6c 69 6e 65 20 73 74 61 6e 64 61 72 64 2f 6e | int-disable-next-line.standard/n |
30a0 | 6f 2d 63 61 6c 6c 62 61 63 6b 2d 6c 69 74 65 72 61 6c 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 | o-callback-literal.......return. |
30c0 | 63 61 6c 6c 62 61 63 6b 28 60 43 6f 6d 6d 61 6e 64 20 66 61 69 6c 65 64 3a 20 24 7b 73 69 67 6e | callback(`Command.failed:.${sign |
30e0 | 61 6c 20 21 3d 20 6e 75 6c 6c 20 3f 20 73 69 67 6e 61 6c 20 3a 20 63 6f 64 65 7d 5c 6e 24 7b 73 | al.!=.null.?.signal.:.code}\n${s |
3100 | 74 64 65 72 72 7d 60 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 53 75 63 63 65 73 73 2e 0a | tderr}`).....}......//.Success.. |
3120 | 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 6e 75 6c 6c 2c 20 73 74 64 6f 75 74 29 0a 20 20 7d 29 0a | ....callback(null,.stdout)...}). |
3140 | 7d 0a 0a 2f 2f 20 53 74 61 72 74 20 61 6e 20 69 6e 73 74 61 6e 63 65 20 6f 66 20 74 68 65 20 69 | }..//.Start.an.instance.of.the.i |
3160 | 6e 73 74 61 6c 6c 65 64 20 61 70 70 2e 0a 65 78 70 6f 72 74 73 2e 70 72 6f 63 65 73 73 53 74 61 | nstalled.app..exports.processSta |
3180 | 72 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 73 70 61 77 | rt.=.function.().{...return.spaw |
31a0 | 6e 55 70 64 61 74 65 28 5b 27 2d 2d 70 72 6f 63 65 73 73 53 74 61 72 74 41 6e 64 57 61 69 74 27 | nUpdate(['--processStartAndWait' |
31c0 | 2c 20 65 78 65 4e 61 6d 65 5d 2c 20 74 72 75 65 2c 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 7d | ,.exeName],.true,.function.().{} |
31e0 | 29 0a 7d 0a 0a 2f 2f 20 44 6f 77 6e 6c 6f 61 64 20 74 68 65 20 72 65 6c 65 61 73 65 73 20 73 70 | ).}..//.Download.the.releases.sp |
3200 | 65 63 69 66 69 65 64 20 62 79 20 74 68 65 20 55 52 4c 20 61 6e 64 20 77 72 69 74 65 20 6e 65 77 | ecified.by.the.URL.and.write.new |
3220 | 20 72 65 73 75 6c 74 73 20 74 6f 20 73 74 64 6f 75 74 2e 0a 65 78 70 6f 72 74 73 2e 63 68 65 63 | .results.to.stdout..exports.chec |
3240 | 6b 46 6f 72 55 70 64 61 74 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 75 70 64 61 74 65 55 52 4c | kForUpdate.=.function.(updateURL |
3260 | 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 73 70 61 77 6e 55 70 64 61 | ,.callback).{...return.spawnUpda |
3280 | 74 65 28 5b 27 2d 2d 63 68 65 63 6b 46 6f 72 55 70 64 61 74 65 27 2c 20 75 70 64 61 74 65 55 52 | te(['--checkForUpdate',.updateUR |
32a0 | 4c 5d 2c 20 66 61 6c 73 65 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 72 72 6f 72 2c 20 73 74 64 6f | L],.false,.function.(error,.stdo |
32c0 | 75 74 29 20 7b 0a 20 20 20 20 6c 65 74 20 72 65 66 2c 20 72 65 66 31 2c 20 75 70 64 61 74 65 0a | ut).{.....let.ref,.ref1,.update. |
32e0 | 20 20 20 20 69 66 20 28 65 72 72 6f 72 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 72 | ....if.(error.!=.null).{.......r |
3300 | 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 65 72 72 6f 72 29 0a 20 20 20 20 7d 0a 20 20 20 20 | eturn.callback(error).....}..... |
3320 | 74 72 79 20 7b 0a 20 20 20 20 20 20 2f 2f 20 4c 61 73 74 20 6c 69 6e 65 20 6f 66 20 6f 75 74 70 | try.{.......//.Last.line.of.outp |
3340 | 75 74 20 69 73 20 74 68 65 20 4a 53 4f 4e 20 64 65 74 61 69 6c 73 20 61 62 6f 75 74 20 74 68 65 | ut.is.the.JSON.details.about.the |
3360 | 20 72 65 6c 65 61 73 65 73 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 6a 73 6f 6e 20 3d 20 73 74 64 | .releases.......const.json.=.std |
3380 | 6f 75 74 2e 74 72 69 6d 28 29 2e 73 70 6c 69 74 28 27 5c 6e 27 29 2e 70 6f 70 28 29 0a 20 20 20 | out.trim().split('\n').pop().... |
33a0 | 20 20 20 75 70 64 61 74 65 20 3d 20 28 72 65 66 20 3d 20 4a 53 4f 4e 2e 70 61 72 73 65 28 6a 73 | ...update.=.(ref.=.JSON.parse(js |
33c0 | 6f 6e 29 29 20 21 3d 20 6e 75 6c 6c 20 3f 20 28 72 65 66 31 20 3d 20 72 65 66 2e 72 65 6c 65 61 | on)).!=.null.?.(ref1.=.ref.relea |
33e0 | 73 65 73 54 6f 41 70 70 6c 79 29 20 21 3d 20 6e 75 6c 6c 20 3f 20 74 79 70 65 6f 66 20 72 65 66 | sesToApply).!=.null.?.typeof.ref |
3400 | 31 2e 70 6f 70 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 20 3f 20 72 65 66 31 2e 70 6f 70 28 | 1.pop.===.'function'.?.ref1.pop( |
3420 | 29 20 3a 20 76 6f 69 64 20 30 20 3a 20 76 6f 69 64 20 30 20 3a 20 76 6f 69 64 20 30 0a 20 20 20 | ).:.void.0.:.void.0.:.void.0.... |
3440 | 20 7d 20 63 61 74 63 68 20 28 6a 73 6f 6e 45 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 | .}.catch.(jsonError).{.......//. |
3460 | 44 69 73 61 62 6c 65 64 20 66 6f 72 20 62 61 63 6b 77 61 72 64 73 20 63 6f 6d 70 61 74 69 62 69 | Disabled.for.backwards.compatibi |
3480 | 6c 69 74 79 3a 0a 20 20 20 20 20 20 2f 2f 20 65 73 6c 69 6e 74 2d 64 69 73 61 62 6c 65 2d 6e 65 | lity:.......//.eslint-disable-ne |
34a0 | 78 74 2d 6c 69 6e 65 20 73 74 61 6e 64 61 72 64 2f 6e 6f 2d 63 61 6c 6c 62 61 63 6b 2d 6c 69 74 | xt-line.standard/no-callback-lit |
34c0 | 65 72 61 6c 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 60 49 6e 76 61 | eral.......return.callback(`Inva |
34e0 | 6c 69 64 20 72 65 73 75 6c 74 3a 5c 6e 24 7b 73 74 64 6f 75 74 7d 60 29 0a 20 20 20 20 7d 0a 20 | lid.result:\n${stdout}`).....}.. |
3500 | 20 20 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 6e 75 6c 6c 2c 20 75 70 64 61 74 65 29 | ...return.callback(null,.update) |
3520 | 0a 20 20 7d 29 0a 7d 0a 0a 2f 2f 20 55 70 64 61 74 65 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 | ...}).}..//.Update.the.applicati |
3540 | 6f 6e 20 74 6f 20 74 68 65 20 6c 61 74 65 73 74 20 72 65 6d 6f 74 65 20 76 65 72 73 69 6f 6e 20 | on.to.the.latest.remote.version. |
3560 | 73 70 65 63 69 66 69 65 64 20 62 79 20 55 52 4c 2e 0a 65 78 70 6f 72 74 73 2e 75 70 64 61 74 65 | specified.by.URL..exports.update |
3580 | 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 75 70 64 61 74 65 55 52 4c 2c 20 63 61 6c 6c 62 61 63 6b | .=.function.(updateURL,.callback |
35a0 | 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 73 70 61 77 6e 55 70 64 61 74 65 28 5b 27 2d 2d 75 70 64 | ).{...return.spawnUpdate(['--upd |
35c0 | 61 74 65 27 2c 20 75 70 64 61 74 65 55 52 4c 5d 2c 20 66 61 6c 73 65 2c 20 63 61 6c 6c 62 61 63 | ate',.updateURL],.false,.callbac |
35e0 | 6b 29 0a 7d 0a 0a 2f 2f 20 49 73 20 74 68 65 20 55 70 64 61 74 65 2e 65 78 65 20 69 6e 73 74 61 | k).}..//.Is.the.Update.exe.insta |
3600 | 6c 6c 65 64 20 77 69 74 68 20 74 68 65 20 63 75 72 72 65 6e 74 20 61 70 70 6c 69 63 61 74 69 6f | lled.with.the.current.applicatio |
3620 | 6e 3f 0a 65 78 70 6f 72 74 73 2e 73 75 70 70 6f 72 74 65 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 | n?.exports.supported.=.function. |
3640 | 28 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 66 73 2e 61 63 63 65 73 73 53 79 6e 63 28 75 | ().{...try.{.....fs.accessSync(u |
3660 | 70 64 61 74 65 45 78 65 2c 20 66 73 2e 52 5f 4f 4b 29 0a 20 20 20 20 72 65 74 75 72 6e 20 74 72 | pdateExe,.fs.R_OK).....return.tr |
3680 | 75 65 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 72 65 74 75 72 | ue...}.catch.(error).{.....retur |
36a0 | 6e 20 66 61 6c 73 65 0a 20 20 7d 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 | n.false...}.}.'use.strict'..cons |
36c0 | 74 20 7b 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 | t.{.EventEmitter.}.=.require('ev |
36e0 | 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 7b 20 42 72 6f 77 73 65 72 56 69 65 77 20 7d 20 3d 20 70 | ents').const.{.BrowserView.}.=.p |
3700 | 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 62 72 6f 77 73 65 72 5f 76 69 65 77 | rocess.atomBinding('browser_view |
3720 | 27 29 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 42 72 6f 77 73 65 | ')..Object.setPrototypeOf(Browse |
3740 | 72 56 69 65 77 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 | rView.prototype,.EventEmitter.pr |
3760 | 6f 74 6f 74 79 70 65 29 0a 0a 42 72 6f 77 73 65 72 56 69 65 77 2e 66 72 6f 6d 57 65 62 43 6f 6e | ototype)..BrowserView.fromWebCon |
3780 | 74 65 6e 74 73 20 3d 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 3d 3e 20 7b 0a 20 20 66 6f 72 | tents.=.(webContents).=>.{...for |
37a0 | 20 28 63 6f 6e 73 74 20 76 69 65 77 20 6f 66 20 42 72 6f 77 73 65 72 56 69 65 77 2e 67 65 74 41 | .(const.view.of.BrowserView.getA |
37c0 | 6c 6c 56 69 65 77 73 28 29 29 20 7b 0a 20 20 20 20 69 66 20 28 76 69 65 77 2e 77 65 62 43 6f 6e | llViews()).{.....if.(view.webCon |
37e0 | 74 65 6e 74 73 2e 65 71 75 61 6c 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 29 20 72 65 74 75 72 6e | tents.equal(webContents)).return |
3800 | 20 76 69 65 77 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 6e 75 6c 6c 0a 7d 0a 0a 6d 6f 64 75 | .view...}....return.null.}..modu |
3820 | 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 42 72 6f 77 73 65 72 56 69 65 77 0a 27 75 73 65 20 73 74 | le.exports.=.BrowserView.'use.st |
3840 | 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 65 6c 65 63 74 72 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 | rict'..const.electron.=.require( |
3860 | 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 7b 20 57 65 62 43 6f 6e 74 65 6e 74 73 56 | 'electron').const.{.WebContentsV |
3880 | 69 65 77 2c 20 54 6f 70 4c 65 76 65 6c 57 69 6e 64 6f 77 20 7d 20 3d 20 65 6c 65 63 74 72 6f 6e | iew,.TopLevelWindow.}.=.electron |
38a0 | 0a 63 6f 6e 73 74 20 7b 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 20 7d 20 3d 20 70 72 6f 63 65 | .const.{.BrowserWindow.}.=.proce |
38c0 | 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 77 69 6e 64 6f 77 27 29 0a 0a 4f 62 6a 65 63 74 | ss.atomBinding('window')..Object |
38e0 | 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 70 72 | .setPrototypeOf(BrowserWindow.pr |
3900 | 6f 74 6f 74 79 70 65 2c 20 54 6f 70 4c 65 76 65 6c 57 69 6e 64 6f 77 2e 70 72 6f 74 6f 74 79 70 | ototype,.TopLevelWindow.prototyp |
3920 | 65 29 0a 0a 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 69 6e 69 | e)..BrowserWindow.prototype._ini |
3940 | 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 2f 2f 20 43 61 6c 6c 20 70 61 72 65 | t.=.function.().{...//.Call.pare |
3960 | 6e 74 20 63 6c 61 73 73 27 73 20 5f 69 6e 69 74 2e 0a 20 20 54 6f 70 4c 65 76 65 6c 57 69 6e 64 | nt.class's._init....TopLevelWind |
3980 | 6f 77 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 69 6e 69 74 2e 63 61 6c 6c 28 74 68 69 73 29 0a 0a 20 | ow.prototype._init.call(this)... |
39a0 | 20 2f 2f 20 41 76 6f 69 64 20 72 65 63 75 72 73 69 76 65 20 72 65 71 75 69 72 65 2e 0a 20 20 63 | .//.Avoid.recursive.require....c |
39c0 | 6f 6e 73 74 20 7b 20 61 70 70 20 7d 20 3d 20 65 6c 65 63 74 72 6f 6e 0a 0a 20 20 2f 2f 20 43 72 | onst.{.app.}.=.electron....//.Cr |
39e0 | 65 61 74 65 20 57 65 62 43 6f 6e 74 65 6e 74 73 56 69 65 77 2e 0a 20 20 74 68 69 73 2e 73 65 74 | eate.WebContentsView....this.set |
3a00 | 43 6f 6e 74 65 6e 74 56 69 65 77 28 6e 65 77 20 57 65 62 43 6f 6e 74 65 6e 74 73 56 69 65 77 28 | ContentView(new.WebContentsView( |
3a20 | 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 29 29 0a 0a 20 20 63 6f 6e 73 74 20 6e 61 74 69 | this.webContents))....const.nati |
3a40 | 76 65 53 65 74 42 6f 75 6e 64 73 20 3d 20 74 68 69 73 2e 73 65 74 42 6f 75 6e 64 73 0a 20 20 74 | veSetBounds.=.this.setBounds...t |
3a60 | 68 69 73 2e 73 65 74 42 6f 75 6e 64 73 20 3d 20 28 62 6f 75 6e 64 73 2c 20 2e 2e 2e 6f 70 74 73 | his.setBounds.=.(bounds,....opts |
3a80 | 29 20 3d 3e 20 7b 0a 20 20 20 20 62 6f 75 6e 64 73 20 3d 20 7b 0a 20 20 20 20 20 20 2e 2e 2e 74 | ).=>.{.....bounds.=.{..........t |
3aa0 | 68 69 73 2e 67 65 74 42 6f 75 6e 64 73 28 29 2c 0a 20 20 20 20 20 20 2e 2e 2e 62 6f 75 6e 64 73 | his.getBounds(),..........bounds |
3ac0 | 0a 20 20 20 20 7d 0a 20 20 20 20 6e 61 74 69 76 65 53 65 74 42 6f 75 6e 64 73 2e 63 61 6c 6c 28 | .....}.....nativeSetBounds.call( |
3ae0 | 74 68 69 73 2c 20 62 6f 75 6e 64 73 2c 20 2e 2e 2e 6f 70 74 73 29 0a 20 20 7d 0a 0a 20 20 2f 2f | this,.bounds,....opts)...}....// |
3b00 | 20 77 69 6e 64 6f 77 2e 72 65 73 69 7a 65 54 6f 28 2e 2e 2e 29 0a 20 20 2f 2f 20 77 69 6e 64 6f | .window.resizeTo(...)...//.windo |
3b20 | 77 2e 6d 6f 76 65 54 6f 28 2e 2e 2e 29 0a 20 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 | w.moveTo(...)...this.webContents |
3b40 | 2e 6f 6e 28 27 6d 6f 76 65 27 2c 20 28 65 76 65 6e 74 2c 20 73 69 7a 65 29 20 3d 3e 20 7b 0a 20 | .on('move',.(event,.size).=>.{.. |
3b60 | 20 20 20 74 68 69 73 2e 73 65 74 42 6f 75 6e 64 73 28 73 69 7a 65 29 0a 20 20 7d 29 0a 0a 20 20 | ...this.setBounds(size)...}).... |
3b80 | 2f 2f 20 48 69 64 65 20 74 68 65 20 61 75 74 6f 2d 68 69 64 65 20 6d 65 6e 75 20 77 68 65 6e 20 | //.Hide.the.auto-hide.menu.when. |
3ba0 | 77 65 62 43 6f 6e 74 65 6e 74 73 20 69 73 20 66 6f 63 75 73 65 64 2e 0a 20 20 74 68 69 73 2e 77 | webContents.is.focused....this.w |
3bc0 | 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 61 63 74 69 76 61 74 65 27 2c 20 28 29 20 3d 3e 20 | ebContents.on('activate',.().=>. |
3be0 | 7b 0a 20 20 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 21 3d 3d 20 27 | {.....if.(process.platform.!==.' |
3c00 | 64 61 72 77 69 6e 27 20 26 26 20 74 68 69 73 2e 69 73 4d 65 6e 75 42 61 72 41 75 74 6f 48 69 64 | darwin'.&&.this.isMenuBarAutoHid |
3c20 | 65 28 29 20 26 26 20 74 68 69 73 2e 69 73 4d 65 6e 75 42 61 72 56 69 73 69 62 6c 65 28 29 29 20 | e().&&.this.isMenuBarVisible()). |
3c40 | 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 73 65 74 4d 65 6e 75 42 61 72 56 69 73 69 62 69 6c 69 74 | {.......this.setMenuBarVisibilit |
3c60 | 79 28 66 61 6c 73 65 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 43 68 61 6e 67 65 | y(false).....}...})....//.Change |
3c80 | 20 77 69 6e 64 6f 77 20 74 69 74 6c 65 20 74 6f 20 70 61 67 65 20 74 69 74 6c 65 2e 0a 20 20 74 | .window.title.to.page.title....t |
3ca0 | 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 70 61 67 65 2d 74 69 74 6c 65 2d 75 | his.webContents.on('page-title-u |
3cc0 | 70 64 61 74 65 64 27 2c 20 28 65 76 65 6e 74 2c 20 74 69 74 6c 65 2c 20 2e 2e 2e 61 72 67 73 29 | pdated',.(event,.title,....args) |
3ce0 | 20 3d 3e 20 7b 0a 20 20 20 20 2f 2f 20 52 6f 75 74 65 20 74 68 65 20 65 76 65 6e 74 20 74 6f 20 | .=>.{.....//.Route.the.event.to. |
3d00 | 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 0a 20 20 20 20 74 68 69 73 2e 65 6d 69 74 28 27 70 61 | BrowserWindow......this.emit('pa |
3d20 | 67 65 2d 74 69 74 6c 65 2d 75 70 64 61 74 65 64 27 2c 20 65 76 65 6e 74 2c 20 74 69 74 6c 65 2c | ge-title-updated',.event,.title, |
3d40 | 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 69 73 44 65 73 74 72 6f | ....args).....if.(!this.isDestro |
3d60 | 79 65 64 28 29 20 26 26 20 21 65 76 65 6e 74 2e 64 65 66 61 75 6c 74 50 72 65 76 65 6e 74 65 64 | yed().&&.!event.defaultPrevented |
3d80 | 29 20 74 68 69 73 2e 73 65 74 54 69 74 6c 65 28 74 69 74 6c 65 29 0a 20 20 7d 29 0a 0a 20 20 2f | ).this.setTitle(title)...})..../ |
3da0 | 2f 20 53 6f 6d 65 74 69 6d 65 73 20 74 68 65 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 64 6f 65 73 | /.Sometimes.the.webContents.does |
3dc0 | 6e 27 74 20 67 65 74 20 66 6f 63 75 73 20 77 68 65 6e 20 77 69 6e 64 6f 77 20 69 73 20 73 68 6f | n't.get.focus.when.window.is.sho |
3de0 | 77 6e 2c 20 73 6f 20 77 65 0a 20 20 2f 2f 20 68 61 76 65 20 74 6f 20 66 6f 72 63 65 20 66 6f 63 | wn,.so.we...//.have.to.force.foc |
3e00 | 75 73 69 6e 67 20 6f 6e 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 69 6e 20 74 68 69 73 20 63 61 73 | using.on.webContents.in.this.cas |
3e20 | 65 2e 20 54 68 65 20 73 61 66 65 73 74 20 77 61 79 20 69 73 20 74 6f 0a 20 20 2f 2f 20 66 6f 63 | e..The.safest.way.is.to...//.foc |
3e40 | 75 73 20 69 74 20 77 68 65 6e 20 77 65 20 66 69 72 73 74 20 73 74 61 72 74 20 74 6f 20 6c 6f 61 | us.it.when.we.first.start.to.loa |
3e60 | 64 20 55 52 4c 2c 20 69 66 20 77 65 20 64 6f 20 69 74 20 65 61 72 6c 69 65 72 20 69 74 20 77 6f | d.URL,.if.we.do.it.earlier.it.wo |
3e80 | 6e 27 74 0a 20 20 2f 2f 20 68 61 76 65 20 65 66 66 65 63 74 2c 20 69 66 20 77 65 20 64 6f 20 69 | n't...//.have.effect,.if.we.do.i |
3ea0 | 74 20 6c 61 74 65 72 20 77 65 20 6d 69 67 68 74 20 6d 6f 76 65 20 66 6f 63 75 73 20 69 6e 20 74 | t.later.we.might.move.focus.in.t |
3ec0 | 68 65 20 70 61 67 65 2e 0a 20 20 2f 2f 0a 20 20 2f 2f 20 54 68 6f 75 67 68 20 74 68 69 73 20 68 | he.page....//...//.Though.this.h |
3ee0 | 61 63 6b 20 69 73 20 6f 6e 6c 79 20 6e 65 65 64 65 64 20 6f 6e 20 6d 61 63 4f 53 20 77 68 65 6e | ack.is.only.needed.on.macOS.when |
3f00 | 20 74 68 65 20 61 70 70 20 69 73 20 6c 61 75 6e 63 68 65 64 20 66 72 6f 6d 0a 20 20 2f 2f 20 46 | .the.app.is.launched.from...//.F |
3f20 | 69 6e 64 65 72 2c 20 77 65 20 73 74 69 6c 6c 20 64 6f 20 69 74 20 6f 6e 20 61 6c 6c 20 70 6c 61 | inder,.we.still.do.it.on.all.pla |
3f40 | 74 66 6f 72 6d 73 20 69 6e 20 63 61 73 65 20 6f 66 20 6f 74 68 65 72 20 62 75 67 73 20 77 65 20 | tforms.in.case.of.other.bugs.we. |
3f60 | 64 6f 6e 27 74 0a 20 20 2f 2f 20 6b 6e 6f 77 2e 0a 20 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 | don't...//.know....this.webConte |
3f80 | 6e 74 73 2e 6f 6e 63 65 28 27 6c 6f 61 64 2d 75 72 6c 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 29 | nts.once('load-url',.function.() |
3fa0 | 20 7b 0a 20 20 20 20 74 68 69 73 2e 66 6f 63 75 73 28 29 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 52 | .{.....this.focus()...})....//.R |
3fc0 | 65 64 69 72 65 63 74 20 66 6f 63 75 73 2f 62 6c 75 72 20 65 76 65 6e 74 20 74 6f 20 61 70 70 20 | edirect.focus/blur.event.to.app. |
3fe0 | 69 6e 73 74 61 6e 63 65 20 74 6f 6f 2e 0a 20 20 74 68 69 73 2e 6f 6e 28 27 62 6c 75 72 27 2c 20 | instance.too....this.on('blur',. |
4000 | 28 65 76 65 6e 74 29 20 3d 3e 20 7b 0a 20 20 20 20 61 70 70 2e 65 6d 69 74 28 27 62 72 6f 77 73 | (event).=>.{.....app.emit('brows |
4020 | 65 72 2d 77 69 6e 64 6f 77 2d 62 6c 75 72 27 2c 20 65 76 65 6e 74 2c 20 74 68 69 73 29 0a 20 20 | er-window-blur',.event,.this)... |
4040 | 7d 29 0a 20 20 74 68 69 73 2e 6f 6e 28 27 66 6f 63 75 73 27 2c 20 28 65 76 65 6e 74 29 20 3d 3e | })...this.on('focus',.(event).=> |
4060 | 20 7b 0a 20 20 20 20 61 70 70 2e 65 6d 69 74 28 27 62 72 6f 77 73 65 72 2d 77 69 6e 64 6f 77 2d | .{.....app.emit('browser-window- |
4080 | 66 6f 63 75 73 27 2c 20 65 76 65 6e 74 2c 20 74 68 69 73 29 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 | focus',.event,.this)...})....//. |
40a0 | 53 75 62 73 63 72 69 62 65 20 74 6f 20 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 20 63 68 61 | Subscribe.to.visibilityState.cha |
40c0 | 6e 67 65 73 20 61 6e 64 20 70 61 73 73 20 74 6f 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 | nges.and.pass.to.renderer.proces |
40e0 | 73 2e 0a 20 20 6c 65 74 20 69 73 56 69 73 69 62 6c 65 20 3d 20 74 68 69 73 2e 69 73 56 69 73 69 | s....let.isVisible.=.this.isVisi |
4100 | 62 6c 65 28 29 20 26 26 20 21 74 68 69 73 2e 69 73 4d 69 6e 69 6d 69 7a 65 64 28 29 0a 20 20 63 | ble().&&.!this.isMinimized()...c |
4120 | 6f 6e 73 74 20 76 69 73 69 62 69 6c 69 74 79 43 68 61 6e 67 65 64 20 3d 20 28 29 20 3d 3e 20 7b | onst.visibilityChanged.=.().=>.{ |
4140 | 0a 20 20 20 20 63 6f 6e 73 74 20 6e 65 77 53 74 61 74 65 20 3d 20 74 68 69 73 2e 69 73 56 69 73 | .....const.newState.=.this.isVis |
4160 | 69 62 6c 65 28 29 20 26 26 20 21 74 68 69 73 2e 69 73 4d 69 6e 69 6d 69 7a 65 64 28 29 0a 20 20 | ible().&&.!this.isMinimized()... |
4180 | 20 20 69 66 20 28 69 73 56 69 73 69 62 6c 65 20 21 3d 3d 20 6e 65 77 53 74 61 74 65 29 20 7b 0a | ..if.(isVisible.!==.newState).{. |
41a0 | 20 20 20 20 20 20 69 73 56 69 73 69 62 6c 65 20 3d 20 6e 65 77 53 74 61 74 65 0a 20 20 20 20 20 | ......isVisible.=.newState...... |
41c0 | 20 63 6f 6e 73 74 20 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 20 3d 20 69 73 56 69 73 69 62 | .const.visibilityState.=.isVisib |
41e0 | 6c 65 20 3f 20 27 76 69 73 69 62 6c 65 27 20 3a 20 27 68 69 64 64 65 6e 27 0a 20 20 20 20 20 20 | le.?.'visible'.:.'hidden'....... |
4200 | 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 65 6d 69 74 28 27 2d 77 69 6e 64 6f 77 2d 76 | this.webContents.emit('-window-v |
4220 | 69 73 69 62 69 6c 69 74 79 2d 63 68 61 6e 67 65 27 2c 20 76 69 73 69 62 69 6c 69 74 79 53 74 61 | isibility-change',.visibilitySta |
4240 | 74 65 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 76 69 73 69 62 69 6c 69 74 | te).....}...}....const.visibilit |
4260 | 79 45 76 65 6e 74 73 20 3d 20 5b 27 73 68 6f 77 27 2c 20 27 68 69 64 65 27 2c 20 27 6d 69 6e 69 | yEvents.=.['show',.'hide',.'mini |
4280 | 6d 69 7a 65 27 2c 20 27 6d 61 78 69 6d 69 7a 65 27 2c 20 27 72 65 73 74 6f 72 65 27 5d 0a 20 20 | mize',.'maximize',.'restore']... |
42a0 | 66 6f 72 20 28 63 6f 6e 73 74 20 65 76 65 6e 74 20 6f 66 20 76 69 73 69 62 69 6c 69 74 79 45 76 | for.(const.event.of.visibilityEv |
42c0 | 65 6e 74 73 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 6f 6e 28 65 76 65 6e 74 2c 20 76 69 73 69 62 | ents).{.....this.on(event,.visib |
42e0 | 69 6c 69 74 79 43 68 61 6e 67 65 64 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 4e 6f 74 69 66 79 20 74 | ilityChanged)...}....//.Notify.t |
4300 | 68 65 20 63 72 65 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 77 69 6e 64 6f 77 2e 0a 20 20 61 70 70 | he.creation.of.the.window....app |
4320 | 2e 65 6d 69 74 28 27 62 72 6f 77 73 65 72 2d 77 69 6e 64 6f 77 2d 63 72 65 61 74 65 64 27 2c 20 | .emit('browser-window-created',. |
4340 | 7b 7d 2c 20 74 68 69 73 29 0a 0a 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 | {},.this)....Object.defineProper |
4360 | 74 79 28 74 68 69 73 2c 20 27 64 65 76 54 6f 6f 6c 73 57 65 62 43 6f 6e 74 65 6e 74 73 27 2c 20 | ty(this,.'devToolsWebContents',. |
4380 | 7b 0a 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 63 6f 6e 66 | {.....enumerable:.true,.....conf |
43a0 | 69 67 75 72 61 62 6c 65 3a 20 66 61 6c 73 65 2c 0a 20 20 20 20 67 65 74 20 28 29 20 7b 0a 20 20 | igurable:.false,.....get.().{... |
43c0 | 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 64 65 76 54 | ....return.this.webContents.devT |
43e0 | 6f 6f 6c 73 57 65 62 43 6f 6e 74 65 6e 74 73 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 63 6f | oolsWebContents.....}...}).}..co |
4400 | 6e 73 74 20 69 73 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 20 3d 20 28 77 69 6e 29 20 3d 3e 20 7b | nst.isBrowserWindow.=.(win).=>.{ |
4420 | 0a 20 20 72 65 74 75 72 6e 20 77 69 6e 20 26 26 20 77 69 6e 2e 63 6f 6e 73 74 72 75 63 74 6f 72 | ...return.win.&&.win.constructor |
4440 | 2e 6e 61 6d 65 20 3d 3d 3d 20 27 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 27 0a 7d 0a 0a 42 72 6f | .name.===.'BrowserWindow'.}..Bro |
4460 | 77 73 65 72 57 69 6e 64 6f 77 2e 66 72 6f 6d 49 64 20 3d 20 28 69 64 29 20 3d 3e 20 7b 0a 20 20 | wserWindow.fromId.=.(id).=>.{... |
4480 | 63 6f 6e 73 74 20 77 69 6e 20 3d 20 54 6f 70 4c 65 76 65 6c 57 69 6e 64 6f 77 2e 66 72 6f 6d 49 | const.win.=.TopLevelWindow.fromI |
44a0 | 64 28 69 64 29 0a 20 20 72 65 74 75 72 6e 20 69 73 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 28 77 | d(id)...return.isBrowserWindow(w |
44c0 | 69 6e 29 20 3f 20 77 69 6e 20 3a 20 6e 75 6c 6c 0a 7d 0a 0a 42 72 6f 77 73 65 72 57 69 6e 64 6f | in).?.win.:.null.}..BrowserWindo |
44e0 | 77 2e 67 65 74 41 6c 6c 57 69 6e 64 6f 77 73 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 72 65 74 75 | w.getAllWindows.=.().=>.{...retu |
4500 | 72 6e 20 54 6f 70 4c 65 76 65 6c 57 69 6e 64 6f 77 2e 67 65 74 41 6c 6c 57 69 6e 64 6f 77 73 28 | rn.TopLevelWindow.getAllWindows( |
4520 | 29 2e 66 69 6c 74 65 72 28 69 73 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 29 0a 7d 0a 0a 42 72 6f | ).filter(isBrowserWindow).}..Bro |
4540 | 77 73 65 72 57 69 6e 64 6f 77 2e 67 65 74 46 6f 63 75 73 65 64 57 69 6e 64 6f 77 20 3d 20 28 29 | wserWindow.getFocusedWindow.=.() |
4560 | 20 3d 3e 20 7b 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 77 69 6e 64 6f 77 20 6f 66 20 42 72 6f | .=>.{...for.(const.window.of.Bro |
4580 | 77 73 65 72 57 69 6e 64 6f 77 2e 67 65 74 41 6c 6c 57 69 6e 64 6f 77 73 28 29 29 20 7b 0a 20 20 | wserWindow.getAllWindows()).{... |
45a0 | 20 20 69 66 20 28 77 69 6e 64 6f 77 2e 69 73 46 6f 63 75 73 65 64 28 29 20 7c 7c 20 77 69 6e 64 | ..if.(window.isFocused().||.wind |
45c0 | 6f 77 2e 69 73 44 65 76 54 6f 6f 6c 73 46 6f 63 75 73 65 64 28 29 29 20 72 65 74 75 72 6e 20 77 | ow.isDevToolsFocused()).return.w |
45e0 | 69 6e 64 6f 77 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 6e 75 6c 6c 0a 7d 0a 0a 42 72 6f 77 73 | indow...}...return.null.}..Brows |
4600 | 65 72 57 69 6e 64 6f 77 2e 66 72 6f 6d 57 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 28 77 65 62 43 | erWindow.fromWebContents.=.(webC |
4620 | 6f 6e 74 65 6e 74 73 29 20 3d 3e 20 7b 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 77 69 6e 64 6f | ontents).=>.{...for.(const.windo |
4640 | 77 20 6f 66 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 67 65 74 41 6c 6c 57 69 6e 64 6f 77 73 | w.of.BrowserWindow.getAllWindows |
4660 | 28 29 29 20 7b 0a 20 20 20 20 69 66 20 28 77 69 6e 64 6f 77 2e 77 65 62 43 6f 6e 74 65 6e 74 73 | ()).{.....if.(window.webContents |
4680 | 2e 65 71 75 61 6c 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 29 20 72 65 74 75 72 6e 20 77 69 6e 64 | .equal(webContents)).return.wind |
46a0 | 6f 77 0a 20 20 7d 0a 7d 0a 0a 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 66 72 6f 6d 42 72 6f 77 | ow...}.}..BrowserWindow.fromBrow |
46c0 | 73 65 72 56 69 65 77 20 3d 20 28 62 72 6f 77 73 65 72 56 69 65 77 29 20 3d 3e 20 7b 0a 20 20 66 | serView.=.(browserView).=>.{...f |
46e0 | 6f 72 20 28 63 6f 6e 73 74 20 77 69 6e 64 6f 77 20 6f 66 20 42 72 6f 77 73 65 72 57 69 6e 64 6f | or.(const.window.of.BrowserWindo |
4700 | 77 2e 67 65 74 41 6c 6c 57 69 6e 64 6f 77 73 28 29 29 20 7b 0a 20 20 20 20 69 66 20 28 77 69 6e | w.getAllWindows()).{.....if.(win |
4720 | 64 6f 77 2e 67 65 74 42 72 6f 77 73 65 72 56 69 65 77 28 29 20 3d 3d 3d 20 62 72 6f 77 73 65 72 | dow.getBrowserView().===.browser |
4740 | 56 69 65 77 29 20 72 65 74 75 72 6e 20 77 69 6e 64 6f 77 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 | View).return.window...}....retur |
4760 | 6e 20 6e 75 6c 6c 0a 7d 0a 0a 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 66 72 6f 6d 44 65 76 54 | n.null.}..BrowserWindow.fromDevT |
4780 | 6f 6f 6c 73 57 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 | oolsWebContents.=.(webContents). |
47a0 | 3d 3e 20 7b 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 77 69 6e 64 6f 77 20 6f 66 20 42 72 6f 77 | =>.{...for.(const.window.of.Brow |
47c0 | 73 65 72 57 69 6e 64 6f 77 2e 67 65 74 41 6c 6c 57 69 6e 64 6f 77 73 28 29 29 20 7b 0a 20 20 20 | serWindow.getAllWindows()).{.... |
47e0 | 20 63 6f 6e 73 74 20 7b 20 64 65 76 54 6f 6f 6c 73 57 65 62 43 6f 6e 74 65 6e 74 73 20 7d 20 3d | .const.{.devToolsWebContents.}.= |
4800 | 20 77 69 6e 64 6f 77 0a 20 20 20 20 69 66 20 28 64 65 76 54 6f 6f 6c 73 57 65 62 43 6f 6e 74 65 | .window.....if.(devToolsWebConte |
4820 | 6e 74 73 20 21 3d 20 6e 75 6c 6c 20 26 26 20 64 65 76 54 6f 6f 6c 73 57 65 62 43 6f 6e 74 65 6e | nts.!=.null.&&.devToolsWebConten |
4840 | 74 73 2e 65 71 75 61 6c 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 29 20 7b 0a 20 20 20 20 20 20 72 | ts.equal(webContents)).{.......r |
4860 | 65 74 75 72 6e 20 77 69 6e 64 6f 77 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 48 65 6c | eturn.window.....}...}.}..//.Hel |
4880 | 70 65 72 73 2e 0a 4f 62 6a 65 63 74 2e 61 73 73 69 67 6e 28 42 72 6f 77 73 65 72 57 69 6e 64 6f | pers..Object.assign(BrowserWindo |
48a0 | 77 2e 70 72 6f 74 6f 74 79 70 65 2c 20 7b 0a 20 20 6c 6f 61 64 55 52 4c 20 28 2e 2e 2e 61 72 67 | w.prototype,.{...loadURL.(...arg |
48c0 | 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 | s).{.....return.this.webContents |
48e0 | 2e 6c 6f 61 64 55 52 4c 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 2c 0a 20 20 67 65 74 55 52 4c 20 | .loadURL(...args)...},...getURL. |
4900 | 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 | (...args).{.....return.this.webC |
4920 | 6f 6e 74 65 6e 74 73 2e 67 65 74 55 52 4c 28 29 0a 20 20 7d 2c 0a 20 20 6c 6f 61 64 46 69 6c 65 | ontents.getURL()...},...loadFile |
4940 | 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 | .(...args).{.....return.this.web |
4960 | 43 6f 6e 74 65 6e 74 73 2e 6c 6f 61 64 46 69 6c 65 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 2c 0a | Contents.loadFile(...args)...},. |
4980 | 20 20 72 65 6c 6f 61 64 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 | ..reload.(...args).{.....return. |
49a0 | 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 72 65 6c 6f 61 64 28 2e 2e 2e 61 72 67 73 29 | this.webContents.reload(...args) |
49c0 | 0a 20 20 7d 2c 0a 20 20 73 65 6e 64 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 65 74 | ...},...send.(...args).{.....ret |
49e0 | 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 73 65 6e 64 28 2e 2e 2e 61 72 67 | urn.this.webContents.send(...arg |
4a00 | 73 29 0a 20 20 7d 2c 0a 20 20 6f 70 65 6e 44 65 76 54 6f 6f 6c 73 20 28 2e 2e 2e 61 72 67 73 29 | s)...},...openDevTools.(...args) |
4a20 | 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f | .{.....return.this.webContents.o |
4a40 | 70 65 6e 44 65 76 54 6f 6f 6c 73 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 2c 0a 20 20 63 6c 6f 73 | penDevTools(...args)...},...clos |
4a60 | 65 44 65 76 54 6f 6f 6c 73 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 | eDevTools.().{.....return.this.w |
4a80 | 65 62 43 6f 6e 74 65 6e 74 73 2e 63 6c 6f 73 65 44 65 76 54 6f 6f 6c 73 28 29 0a 20 20 7d 2c 0a | ebContents.closeDevTools()...},. |
4aa0 | 20 20 69 73 44 65 76 54 6f 6f 6c 73 4f 70 65 6e 65 64 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 | ..isDevToolsOpened.().{.....retu |
4ac0 | 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 73 44 65 76 54 6f 6f 6c 73 4f 70 | rn.this.webContents.isDevToolsOp |
4ae0 | 65 6e 65 64 28 29 0a 20 20 7d 2c 0a 20 20 69 73 44 65 76 54 6f 6f 6c 73 46 6f 63 75 73 65 64 20 | ened()...},...isDevToolsFocused. |
4b00 | 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 | ().{.....return.this.webContents |
4b20 | 2e 69 73 44 65 76 54 6f 6f 6c 73 46 6f 63 75 73 65 64 28 29 0a 20 20 7d 2c 0a 20 20 74 6f 67 67 | .isDevToolsFocused()...},...togg |
4b40 | 6c 65 44 65 76 54 6f 6f 6c 73 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e | leDevTools.().{.....return.this. |
4b60 | 77 65 62 43 6f 6e 74 65 6e 74 73 2e 74 6f 67 67 6c 65 44 65 76 54 6f 6f 6c 73 28 29 0a 20 20 7d | webContents.toggleDevTools()...} |
4b80 | 2c 0a 20 20 69 6e 73 70 65 63 74 45 6c 65 6d 65 6e 74 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 | ,...inspectElement.(...args).{.. |
4ba0 | 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 6e 73 70 65 | ...return.this.webContents.inspe |
4bc0 | 63 74 45 6c 65 6d 65 6e 74 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 2c 0a 20 20 69 6e 73 70 65 63 | ctElement(...args)...},...inspec |
4be0 | 74 53 65 72 76 69 63 65 57 6f 72 6b 65 72 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 | tServiceWorker.().{.....return.t |
4c00 | 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 6e 73 70 65 63 74 53 65 72 76 69 63 65 57 6f | his.webContents.inspectServiceWo |
4c20 | 72 6b 65 72 28 29 0a 20 20 7d 2c 0a 20 20 73 68 6f 77 44 65 66 69 6e 69 74 69 6f 6e 46 6f 72 53 | rker()...},...showDefinitionForS |
4c40 | 65 6c 65 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 | election.().{.....return.this.we |
4c60 | 62 43 6f 6e 74 65 6e 74 73 2e 73 68 6f 77 44 65 66 69 6e 69 74 69 6f 6e 46 6f 72 53 65 6c 65 63 | bContents.showDefinitionForSelec |
4c80 | 74 69 6f 6e 28 29 0a 20 20 7d 2c 0a 20 20 63 61 70 74 75 72 65 50 61 67 65 20 28 2e 2e 2e 61 72 | tion()...},...capturePage.(...ar |
4ca0 | 67 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 | gs).{.....return.this.webContent |
4cc0 | 73 2e 63 61 70 74 75 72 65 50 61 67 65 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 2c 0a 20 20 73 65 | s.capturePage(...args)...},...se |
4ce0 | 74 54 6f 75 63 68 42 61 72 20 28 74 6f 75 63 68 42 61 72 29 20 7b 0a 20 20 20 20 65 6c 65 63 74 | tTouchBar.(touchBar).{.....elect |
4d00 | 72 6f 6e 2e 54 6f 75 63 68 42 61 72 2e 5f 73 65 74 4f 6e 57 69 6e 64 6f 77 28 74 6f 75 63 68 42 | ron.TouchBar._setOnWindow(touchB |
4d20 | 61 72 2c 20 74 68 69 73 29 0a 20 20 7d 2c 0a 20 20 73 65 74 42 61 63 6b 67 72 6f 75 6e 64 54 68 | ar,.this)...},...setBackgroundTh |
4d40 | 72 6f 74 74 6c 69 6e 67 20 28 61 6c 6c 6f 77 65 64 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 77 65 | rottling.(allowed).{.....this.we |
4d60 | 62 43 6f 6e 74 65 6e 74 73 2e 73 65 74 42 61 63 6b 67 72 6f 75 6e 64 54 68 72 6f 74 74 6c 69 6e | bContents.setBackgroundThrottlin |
4d80 | 67 28 61 6c 6c 6f 77 65 64 29 0a 20 20 7d 0a 7d 29 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 | g(allowed)...}.})..module.export |
4da0 | 73 20 3d 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a | s.=.BrowserWindow.'use.strict'.. |
4dc0 | 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e | module.exports.=.process.atomBin |
4de0 | 64 69 6e 67 28 27 63 6f 6e 74 65 6e 74 5f 74 72 61 63 69 6e 67 27 29 0a 27 75 73 65 20 73 74 72 | ding('content_tracing').'use.str |
4e00 | 69 63 74 27 0a 0a 63 6f 6e 73 74 20 43 72 61 73 68 52 65 70 6f 72 74 65 72 20 3d 20 72 65 71 75 | ict'..const.CrashReporter.=.requ |
4e20 | 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 63 | ire('@electron/internal/common/c |
4e40 | 72 61 73 68 2d 72 65 70 6f 72 74 65 72 27 29 0a 63 6f 6e 73 74 20 7b 20 63 72 61 73 68 52 65 70 | rash-reporter').const.{.crashRep |
4e60 | 6f 72 74 65 72 49 6e 69 74 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e | orterInit.}.=.require('@electron |
4e80 | 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 63 72 61 73 68 2d 72 65 70 6f 72 74 65 72 | /internal/browser/crash-reporter |
4ea0 | 2d 69 6e 69 74 27 29 0a 0a 63 6c 61 73 73 20 43 72 61 73 68 52 65 70 6f 72 74 65 72 4d 61 69 6e | -init')..class.CrashReporterMain |
4ec0 | 20 65 78 74 65 6e 64 73 20 43 72 61 73 68 52 65 70 6f 72 74 65 72 20 7b 0a 20 20 69 6e 69 74 20 | .extends.CrashReporter.{...init. |
4ee0 | 28 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 63 72 61 73 68 52 65 70 6f | (options).{.....return.crashRepo |
4f00 | 72 74 65 72 49 6e 69 74 28 6f 70 74 69 6f 6e 73 29 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e | rterInit(options)...}.}..module. |
4f20 | 65 78 70 6f 72 74 73 20 3d 20 6e 65 77 20 43 72 61 73 68 52 65 70 6f 72 74 65 72 4d 61 69 6e 28 | exports.=.new.CrashReporterMain( |
4f40 | 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 61 70 70 2c 20 42 72 6f | ).'use.strict'..const.{.app,.Bro |
4f60 | 77 73 65 72 57 69 6e 64 6f 77 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e | wserWindow.}.=.require('electron |
4f80 | 27 29 0a 63 6f 6e 73 74 20 62 69 6e 64 69 6e 67 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 | ').const.binding.=.process.atomB |
4fa0 | 69 6e 64 69 6e 67 28 27 64 69 61 6c 6f 67 27 29 0a 63 6f 6e 73 74 20 76 38 55 74 69 6c 20 3d 20 | inding('dialog').const.v8Util.=. |
4fc0 | 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 29 0a 0a | process.atomBinding('v8_util').. |
4fe0 | 63 6f 6e 73 74 20 66 69 6c 65 44 69 61 6c 6f 67 50 72 6f 70 65 72 74 69 65 73 20 3d 20 7b 0a 20 | const.fileDialogProperties.=.{.. |
5000 | 20 6f 70 65 6e 46 69 6c 65 3a 20 31 20 3c 3c 20 30 2c 0a 20 20 6f 70 65 6e 44 69 72 65 63 74 6f | .openFile:.1.<<.0,...openDirecto |
5020 | 72 79 3a 20 31 20 3c 3c 20 31 2c 0a 20 20 6d 75 6c 74 69 53 65 6c 65 63 74 69 6f 6e 73 3a 20 31 | ry:.1.<<.1,...multiSelections:.1 |
5040 | 20 3c 3c 20 32 2c 0a 20 20 63 72 65 61 74 65 44 69 72 65 63 74 6f 72 79 3a 20 31 20 3c 3c 20 33 | .<<.2,...createDirectory:.1.<<.3 |
5060 | 2c 0a 20 20 73 68 6f 77 48 69 64 64 65 6e 46 69 6c 65 73 3a 20 31 20 3c 3c 20 34 2c 0a 20 20 70 | ,...showHiddenFiles:.1.<<.4,...p |
5080 | 72 6f 6d 70 74 54 6f 43 72 65 61 74 65 3a 20 31 20 3c 3c 20 35 2c 0a 20 20 6e 6f 52 65 73 6f 6c | romptToCreate:.1.<<.5,...noResol |
50a0 | 76 65 41 6c 69 61 73 65 73 3a 20 31 20 3c 3c 20 36 2c 0a 20 20 74 72 65 61 74 50 61 63 6b 61 67 | veAliases:.1.<<.6,...treatPackag |
50c0 | 65 41 73 44 69 72 65 63 74 6f 72 79 3a 20 31 20 3c 3c 20 37 0a 7d 0a 0a 63 6f 6e 73 74 20 6d 65 | eAsDirectory:.1.<<.7.}..const.me |
50e0 | 73 73 61 67 65 42 6f 78 54 79 70 65 73 20 3d 20 5b 27 6e 6f 6e 65 27 2c 20 27 69 6e 66 6f 27 2c | ssageBoxTypes.=.['none',.'info', |
5100 | 20 27 77 61 72 6e 69 6e 67 27 2c 20 27 65 72 72 6f 72 27 2c 20 27 71 75 65 73 74 69 6f 6e 27 5d | .'warning',.'error',.'question'] |
5120 | 0a 0a 63 6f 6e 73 74 20 6d 65 73 73 61 67 65 42 6f 78 4f 70 74 69 6f 6e 73 20 3d 20 7b 0a 20 20 | ..const.messageBoxOptions.=.{... |
5140 | 6e 6f 4c 69 6e 6b 3a 20 31 20 3c 3c 20 30 0a 7d 0a 0a 63 6f 6e 73 74 20 70 61 72 73 65 41 72 67 | noLink:.1.<<.0.}..const.parseArg |
5160 | 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 69 6e 64 6f 77 2c 20 6f 70 74 69 6f 6e 73 2c 20 63 | s.=.function.(window,.options,.c |
5180 | 61 6c 6c 62 61 63 6b 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 69 66 20 28 77 69 6e 64 6f 77 | allback,....args).{...if.(window |
51a0 | 20 21 3d 20 6e 75 6c 6c 20 26 26 20 77 69 6e 64 6f 77 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 21 | .!=.null.&&.window.constructor.! |
51c0 | 3d 3d 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 29 20 7b 0a 20 20 20 20 2f 2f 20 53 68 69 66 74 | ==.BrowserWindow).{.....//.Shift |
51e0 | 2e 0a 20 20 20 20 5b 63 61 6c 6c 62 61 63 6b 2c 20 6f 70 74 69 6f 6e 73 2c 20 77 69 6e 64 6f 77 | ......[callback,.options,.window |
5200 | 5d 20 3d 20 5b 6f 70 74 69 6f 6e 73 2c 20 77 69 6e 64 6f 77 2c 20 6e 75 6c 6c 5d 0a 20 20 7d 0a | ].=.[options,.window,.null]...}. |
5220 | 0a 20 20 69 66 20 28 28 63 61 6c 6c 62 61 63 6b 20 3d 3d 20 6e 75 6c 6c 29 20 26 26 20 74 79 70 | ...if.((callback.==.null).&&.typ |
5240 | 65 6f 66 20 6f 70 74 69 6f 6e 73 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 | eof.options.===.'function').{... |
5260 | 20 20 2f 2f 20 53 68 69 66 74 2e 0a 20 20 20 20 5b 63 61 6c 6c 62 61 63 6b 2c 20 6f 70 74 69 6f | ..//.Shift......[callback,.optio |
5280 | 6e 73 5d 20 3d 20 5b 6f 70 74 69 6f 6e 73 2c 20 6e 75 6c 6c 5d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 | ns].=.[options,.null]...}....//. |
52a0 | 46 61 6c 6c 62 61 63 6b 20 74 6f 20 75 73 69 6e 67 20 76 65 72 79 20 6c 61 73 74 20 61 72 67 75 | Fallback.to.using.very.last.argu |
52c0 | 6d 65 6e 74 20 61 73 20 74 68 65 20 63 61 6c 6c 62 61 63 6b 20 66 75 6e 63 74 69 6f 6e 0a 20 20 | ment.as.the.callback.function... |
52e0 | 63 6f 6e 73 74 20 6c 61 73 74 41 72 67 75 6d 65 6e 74 20 3d 20 61 72 67 73 5b 61 72 67 73 2e 6c | const.lastArgument.=.args[args.l |
5300 | 65 6e 67 74 68 20 2d 20 31 5d 0a 20 20 69 66 20 28 28 63 61 6c 6c 62 61 63 6b 20 3d 3d 20 6e 75 | ength.-.1]...if.((callback.==.nu |
5320 | 6c 6c 29 20 26 26 20 74 79 70 65 6f 66 20 6c 61 73 74 41 72 67 75 6d 65 6e 74 20 3d 3d 3d 20 27 | ll).&&.typeof.lastArgument.===.' |
5340 | 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 63 61 6c 6c 62 61 63 6b 20 3d 20 6c 61 73 74 | function').{.....callback.=.last |
5360 | 41 72 67 75 6d 65 6e 74 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 5b 77 69 6e 64 6f 77 2c 20 | Argument...}....return.[window,. |
5380 | 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 5d 0a 7d 0a 0a 63 6f 6e 73 74 20 6e 6f 72 6d | options,.callback].}..const.norm |
53a0 | 61 6c 69 7a 65 41 63 63 65 73 73 4b 65 79 20 3d 20 28 74 65 78 74 29 20 3d 3e 20 7b 0a 20 20 69 | alizeAccessKey.=.(text).=>.{...i |
53c0 | 66 20 28 74 79 70 65 6f 66 20 74 65 78 74 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 72 65 74 | f.(typeof.text.!==.'string').ret |
53e0 | 75 72 6e 20 74 65 78 74 0a 0a 20 20 2f 2f 20 6d 61 63 4f 53 20 64 6f 65 73 20 6e 6f 74 20 68 61 | urn.text....//.macOS.does.not.ha |
5400 | 76 65 20 61 63 63 65 73 73 20 6b 65 79 73 20 73 6f 20 72 65 6d 6f 76 65 20 73 69 6e 67 6c 65 20 | ve.access.keys.so.remove.single. |
5420 | 61 6d 70 65 72 73 61 6e 64 73 0a 20 20 2f 2f 20 61 6e 64 20 72 65 70 6c 61 63 65 20 64 6f 75 62 | ampersands...//.and.replace.doub |
5440 | 6c 65 20 61 6d 70 65 72 73 61 6e 64 73 20 77 69 74 68 20 61 20 73 69 6e 67 6c 65 20 61 6d 70 65 | le.ampersands.with.a.single.ampe |
5460 | 72 73 61 6e 64 0a 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d | rsand...if.(process.platform.=== |
5480 | 20 27 64 61 72 77 69 6e 27 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 65 78 74 2e 72 65 70 | .'darwin').{.....return.text.rep |
54a0 | 6c 61 63 65 28 2f 26 28 26 3f 29 2f 67 2c 20 27 24 31 27 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 4c | lace(/&(&?)/g,.'$1')...}....//.L |
54c0 | 69 6e 75 78 20 75 73 65 73 20 61 20 73 69 6e 67 6c 65 20 75 6e 64 65 72 73 63 6f 72 65 20 61 73 | inux.uses.a.single.underscore.as |
54e0 | 20 61 6e 20 61 63 63 65 73 73 20 6b 65 79 20 70 72 65 66 69 78 20 73 6f 20 65 73 63 61 70 65 0a | .an.access.key.prefix.so.escape. |
5500 | 20 20 2f 2f 20 65 78 69 73 74 69 6e 67 20 73 69 6e 67 6c 65 20 75 6e 64 65 72 73 63 6f 72 65 73 | ..//.existing.single.underscores |
5520 | 20 77 69 74 68 20 61 20 73 65 63 6f 6e 64 20 75 6e 64 65 72 73 63 6f 72 65 2c 20 72 65 70 6c 61 | .with.a.second.underscore,.repla |
5540 | 63 65 20 64 6f 75 62 6c 65 0a 20 20 2f 2f 20 61 6d 70 65 72 73 61 6e 64 73 20 77 69 74 68 20 61 | ce.double...//.ampersands.with.a |
5560 | 20 73 69 6e 67 6c 65 20 61 6d 70 65 72 73 61 6e 64 2c 20 61 6e 64 20 72 65 70 6c 61 63 65 20 61 | .single.ampersand,.and.replace.a |
5580 | 20 73 69 6e 67 6c 65 20 61 6d 70 65 72 73 61 6e 64 20 77 69 74 68 0a 20 20 2f 2f 20 61 20 73 69 | .single.ampersand.with...//.a.si |
55a0 | 6e 67 6c 65 20 75 6e 64 65 72 73 63 6f 72 65 0a 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c | ngle.underscore...if.(process.pl |
55c0 | 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 6c 69 6e 75 78 27 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e | atform.===.'linux').{.....return |
55e0 | 20 74 65 78 74 2e 72 65 70 6c 61 63 65 28 2f 5f 2f 67 2c 20 27 5f 5f 27 29 2e 72 65 70 6c 61 63 | .text.replace(/_/g,.'__').replac |
5600 | 65 28 2f 26 28 2e 3f 29 2f 67 2c 20 28 6d 61 74 63 68 2c 20 61 66 74 65 72 29 20 3d 3e 20 7b 0a | e(/&(.?)/g,.(match,.after).=>.{. |
5620 | 20 20 20 20 20 20 69 66 20 28 61 66 74 65 72 20 3d 3d 3d 20 27 26 27 29 20 72 65 74 75 72 6e 20 | ......if.(after.===.'&').return. |
5640 | 61 66 74 65 72 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 60 5f 24 7b 61 66 74 65 72 7d 60 0a 20 | after.......return.`_${after}`.. |
5660 | 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 74 65 78 74 0a 7d 0a 0a 63 6f 6e 73 | ...})...}....return.text.}..cons |
5680 | 74 20 63 68 65 63 6b 41 70 70 49 6e 69 74 69 61 6c 69 7a 65 64 20 3d 20 66 75 6e 63 74 69 6f 6e | t.checkAppInitialized.=.function |
56a0 | 20 28 29 20 7b 0a 20 20 69 66 20 28 21 61 70 70 2e 69 73 52 65 61 64 79 28 29 29 20 7b 0a 20 20 | .().{...if.(!app.isReady()).{... |
56c0 | 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 64 69 61 6c 6f 67 20 6d 6f 64 75 6c 65 | ..throw.new.Error('dialog.module |
56e0 | 20 63 61 6e 20 6f 6e 6c 79 20 62 65 20 75 73 65 64 20 61 66 74 65 72 20 61 70 70 20 69 73 20 72 | .can.only.be.used.after.app.is.r |
5700 | 65 61 64 79 27 29 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 7b | eady')...}.}..module.exports.=.{ |
5720 | 0a 20 20 73 68 6f 77 4f 70 65 6e 44 69 61 6c 6f 67 3a 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e | ...showOpenDialog:.function.(... |
5740 | 61 72 67 73 29 20 7b 0a 20 20 20 20 63 68 65 63 6b 41 70 70 49 6e 69 74 69 61 6c 69 7a 65 64 28 | args).{.....checkAppInitialized( |
5760 | 29 0a 0a 20 20 20 20 6c 65 74 20 5b 77 69 6e 64 6f 77 2c 20 6f 70 74 69 6f 6e 73 2c 20 63 61 6c | )......let.[window,.options,.cal |
5780 | 6c 62 61 63 6b 5d 20 3d 20 70 61 72 73 65 41 72 67 73 28 2e 2e 2e 61 72 67 73 29 0a 0a 20 20 20 | lback].=.parseArgs(...args)..... |
57a0 | 20 69 66 20 28 6f 70 74 69 6f 6e 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 6f 70 | .if.(options.==.null).{.......op |
57c0 | 74 69 6f 6e 73 20 3d 20 7b 0a 20 20 20 20 20 20 20 20 74 69 74 6c 65 3a 20 27 4f 70 65 6e 27 2c | tions.=.{.........title:.'Open', |
57e0 | 0a 20 20 20 20 20 20 20 20 70 72 6f 70 65 72 74 69 65 73 3a 20 5b 27 6f 70 65 6e 46 69 6c 65 27 | .........properties:.['openFile' |
5800 | 5d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6c 65 74 20 7b 20 62 75 74 74 6f | ].......}.....}......let.{.butto |
5820 | 6e 4c 61 62 65 6c 2c 20 64 65 66 61 75 6c 74 50 61 74 68 2c 20 66 69 6c 74 65 72 73 2c 20 70 72 | nLabel,.defaultPath,.filters,.pr |
5840 | 6f 70 65 72 74 69 65 73 2c 20 74 69 74 6c 65 2c 20 6d 65 73 73 61 67 65 2c 20 73 65 63 75 72 69 | operties,.title,.message,.securi |
5860 | 74 79 53 63 6f 70 65 64 42 6f 6f 6b 6d 61 72 6b 73 20 3d 20 66 61 6c 73 65 20 7d 20 3d 20 6f 70 | tyScopedBookmarks.=.false.}.=.op |
5880 | 74 69 6f 6e 73 0a 0a 20 20 20 20 69 66 20 28 70 72 6f 70 65 72 74 69 65 73 20 3d 3d 20 6e 75 6c | tions......if.(properties.==.nul |
58a0 | 6c 29 20 7b 0a 20 20 20 20 20 20 70 72 6f 70 65 72 74 69 65 73 20 3d 20 5b 27 6f 70 65 6e 46 69 | l).{.......properties.=.['openFi |
58c0 | 6c 65 27 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 21 41 72 72 61 79 2e 69 73 41 72 72 | le'].....}.else.if.(!Array.isArr |
58e0 | 61 79 28 70 72 6f 70 65 72 74 69 65 73 29 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 | ay(properties)).{.......throw.ne |
5900 | 77 20 54 79 70 65 45 72 72 6f 72 28 27 50 72 6f 70 65 72 74 69 65 73 20 6d 75 73 74 20 62 65 20 | w.TypeError('Properties.must.be. |
5920 | 61 6e 20 61 72 72 61 79 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6c 65 74 20 64 69 61 6c 6f 67 | an.array').....}......let.dialog |
5940 | 50 72 6f 70 65 72 74 69 65 73 20 3d 20 30 0a 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 70 72 | Properties.=.0.....for.(const.pr |
5960 | 6f 70 20 69 6e 20 66 69 6c 65 44 69 61 6c 6f 67 50 72 6f 70 65 72 74 69 65 73 29 20 7b 0a 20 20 | op.in.fileDialogProperties).{... |
5980 | 20 20 20 20 69 66 20 28 70 72 6f 70 65 72 74 69 65 73 2e 69 6e 63 6c 75 64 65 73 28 70 72 6f 70 | ....if.(properties.includes(prop |
59a0 | 29 29 20 7b 0a 20 20 20 20 20 20 20 20 64 69 61 6c 6f 67 50 72 6f 70 65 72 74 69 65 73 20 7c 3d | )).{.........dialogProperties.|= |
59c0 | 20 66 69 6c 65 44 69 61 6c 6f 67 50 72 6f 70 65 72 74 69 65 73 5b 70 72 6f 70 5d 0a 20 20 20 20 | .fileDialogProperties[prop]..... |
59e0 | 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 74 69 74 6c 65 20 3d 3d 20 6e 75 6c 6c | ..}.....}......if.(title.==.null |
5a00 | 29 20 7b 0a 20 20 20 20 20 20 74 69 74 6c 65 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 | ).{.......title.=.''.....}.else. |
5a20 | 69 66 20 28 74 79 70 65 6f 66 20 74 69 74 6c 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b | if.(typeof.title.!==.'string').{ |
5a40 | 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 54 69 74 6c | .......throw.new.TypeError('Titl |
5a60 | 65 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 | e.must.be.a.string').....}...... |
5a80 | 69 66 20 28 62 75 74 74 6f 6e 4c 61 62 65 6c 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 | if.(buttonLabel.==.null).{...... |
5aa0 | 20 62 75 74 74 6f 6e 4c 61 62 65 6c 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 | .buttonLabel.=.''.....}.else.if. |
5ac0 | 28 74 79 70 65 6f 66 20 62 75 74 74 6f 6e 4c 61 62 65 6c 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 | (typeof.buttonLabel.!==.'string' |
5ae0 | 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 42 | ).{.......throw.new.TypeError('B |
5b00 | 75 74 74 6f 6e 20 6c 61 62 65 6c 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 | utton.label.must.be.a.string').. |
5b20 | 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 64 65 66 61 75 6c 74 50 61 74 68 20 3d 3d 20 6e 75 6c | ...}......if.(defaultPath.==.nul |
5b40 | 6c 29 20 7b 0a 20 20 20 20 20 20 64 65 66 61 75 6c 74 50 61 74 68 20 3d 20 27 27 0a 20 20 20 20 | l).{.......defaultPath.=.''..... |
5b60 | 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 64 65 66 61 75 6c 74 50 61 74 68 20 21 3d | }.else.if.(typeof.defaultPath.!= |
5b80 | 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 | =.'string').{.......throw.new.Ty |
5ba0 | 70 65 45 72 72 6f 72 28 27 44 65 66 61 75 6c 74 20 70 61 74 68 20 6d 75 73 74 20 62 65 20 61 20 | peError('Default.path.must.be.a. |
5bc0 | 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 66 69 6c 74 65 72 73 20 | string').....}......if.(filters. |
5be0 | 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 66 69 6c 74 65 72 73 20 3d 20 5b 5d 0a 20 20 | ==.null).{.......filters.=.[]... |
5c00 | 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 6d 65 73 73 61 67 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a | ..}......if.(message.==.null).{. |
5c20 | 20 20 20 20 20 20 6d 65 73 73 61 67 65 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 | ......message.=.''.....}.else.if |
5c40 | 20 28 74 79 70 65 6f 66 20 6d 65 73 73 61 67 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b | .(typeof.message.!==.'string').{ |
5c60 | 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 4d 65 73 73 | .......throw.new.TypeError('Mess |
5c80 | 61 67 65 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 | age.must.be.a.string').....}.... |
5ca0 | 20 20 63 6f 6e 73 74 20 77 72 61 70 70 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 74 79 70 65 6f 66 | ..const.wrappedCallback.=.typeof |
5cc0 | 20 63 61 6c 6c 62 61 63 6b 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 20 3f 20 66 75 6e 63 74 | .callback.===.'function'.?.funct |
5ce0 | 69 6f 6e 20 28 73 75 63 63 65 73 73 2c 20 72 65 73 75 6c 74 2c 20 62 6f 6f 6b 6d 61 72 6b 44 61 | ion.(success,.result,.bookmarkDa |
5d00 | 74 61 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 73 75 63 63 65 73 73 20 3f 20 63 61 6c | ta).{.......return.success.?.cal |
5d20 | 6c 62 61 63 6b 28 72 65 73 75 6c 74 2c 20 62 6f 6f 6b 6d 61 72 6b 44 61 74 61 29 20 3a 20 63 61 | lback(result,.bookmarkData).:.ca |
5d40 | 6c 6c 62 61 63 6b 28 29 0a 20 20 20 20 7d 20 3a 20 6e 75 6c 6c 0a 20 20 20 20 63 6f 6e 73 74 20 | llback().....}.:.null.....const. |
5d60 | 73 65 74 74 69 6e 67 73 20 3d 20 7b 20 74 69 74 6c 65 2c 20 62 75 74 74 6f 6e 4c 61 62 65 6c 2c | settings.=.{.title,.buttonLabel, |
5d80 | 20 64 65 66 61 75 6c 74 50 61 74 68 2c 20 66 69 6c 74 65 72 73 2c 20 6d 65 73 73 61 67 65 2c 20 | .defaultPath,.filters,.message,. |
5da0 | 73 65 63 75 72 69 74 79 53 63 6f 70 65 64 42 6f 6f 6b 6d 61 72 6b 73 2c 20 77 69 6e 64 6f 77 20 | securityScopedBookmarks,.window. |
5dc0 | 7d 0a 20 20 20 20 73 65 74 74 69 6e 67 73 2e 70 72 6f 70 65 72 74 69 65 73 20 3d 20 64 69 61 6c | }.....settings.properties.=.dial |
5de0 | 6f 67 50 72 6f 70 65 72 74 69 65 73 0a 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e | ogProperties.....return.binding. |
5e00 | 73 68 6f 77 4f 70 65 6e 44 69 61 6c 6f 67 28 73 65 74 74 69 6e 67 73 2c 20 77 72 61 70 70 65 64 | showOpenDialog(settings,.wrapped |
5e20 | 43 61 6c 6c 62 61 63 6b 29 0a 20 20 7d 2c 0a 0a 20 20 73 68 6f 77 53 61 76 65 44 69 61 6c 6f 67 | Callback)...},....showSaveDialog |
5e40 | 3a 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 63 68 65 63 6b | :.function.(...args).{.....check |
5e60 | 41 70 70 49 6e 69 74 69 61 6c 69 7a 65 64 28 29 0a 0a 20 20 20 20 6c 65 74 20 5b 77 69 6e 64 6f | AppInitialized()......let.[windo |
5e80 | 77 2c 20 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 5d 20 3d 20 70 61 72 73 65 41 72 67 | w,.options,.callback].=.parseArg |
5ea0 | 73 28 2e 2e 2e 61 72 67 73 29 0a 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 20 3d 3d 20 6e | s(...args)......if.(options.==.n |
5ec0 | 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 20 3d 20 7b 0a 20 20 20 20 20 20 20 | ull).{.......options.=.{........ |
5ee0 | 20 74 69 74 6c 65 3a 20 27 53 61 76 65 27 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 | .title:.'Save'.......}.....}.... |
5f00 | 20 20 6c 65 74 20 7b 20 62 75 74 74 6f 6e 4c 61 62 65 6c 2c 20 64 65 66 61 75 6c 74 50 61 74 68 | ..let.{.buttonLabel,.defaultPath |
5f20 | 2c 20 66 69 6c 74 65 72 73 2c 20 74 69 74 6c 65 2c 20 6d 65 73 73 61 67 65 2c 20 73 65 63 75 72 | ,.filters,.title,.message,.secur |
5f40 | 69 74 79 53 63 6f 70 65 64 42 6f 6f 6b 6d 61 72 6b 73 20 3d 20 66 61 6c 73 65 2c 20 6e 61 6d 65 | ityScopedBookmarks.=.false,.name |
5f60 | 46 69 65 6c 64 4c 61 62 65 6c 2c 20 73 68 6f 77 73 54 61 67 46 69 65 6c 64 20 7d 20 3d 20 6f 70 | FieldLabel,.showsTagField.}.=.op |
5f80 | 74 69 6f 6e 73 0a 0a 20 20 20 20 69 66 20 28 74 69 74 6c 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a | tions......if.(title.==.null).{. |
5fa0 | 20 20 20 20 20 20 74 69 74 6c 65 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 | ......title.=.''.....}.else.if.( |
5fc0 | 74 79 70 65 6f 66 20 74 69 74 6c 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 | typeof.title.!==.'string').{.... |
5fe0 | 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 54 69 74 6c 65 20 6d 75 | ...throw.new.TypeError('Title.mu |
6000 | 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 | st.be.a.string').....}......if.( |
6020 | 62 75 74 74 6f 6e 4c 61 62 65 6c 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 62 75 74 | buttonLabel.==.null).{.......but |
6040 | 74 6f 6e 4c 61 62 65 6c 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 | tonLabel.=.''.....}.else.if.(typ |
6060 | 65 6f 66 20 62 75 74 74 6f 6e 4c 61 62 65 6c 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a | eof.buttonLabel.!==.'string').{. |
6080 | 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 42 75 74 74 6f | ......throw.new.TypeError('Butto |
60a0 | 6e 20 6c 61 62 65 6c 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d | n.label.must.be.a.string').....} |
60c0 | 0a 0a 20 20 20 20 69 66 20 28 64 65 66 61 75 6c 74 50 61 74 68 20 3d 3d 20 6e 75 6c 6c 29 20 7b | ......if.(defaultPath.==.null).{ |
60e0 | 0a 20 20 20 20 20 20 64 65 66 61 75 6c 74 50 61 74 68 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c | .......defaultPath.=.''.....}.el |
6100 | 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 64 65 66 61 75 6c 74 50 61 74 68 20 21 3d 3d 20 27 73 | se.if.(typeof.defaultPath.!==.'s |
6120 | 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 | tring').{.......throw.new.TypeEr |
6140 | 72 6f 72 28 27 44 65 66 61 75 6c 74 20 70 61 74 68 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 | ror('Default.path.must.be.a.stri |
6160 | 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 66 69 6c 74 65 72 73 20 3d 3d 20 6e | ng').....}......if.(filters.==.n |
6180 | 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 66 69 6c 74 65 72 73 20 3d 20 5b 5d 0a 20 20 20 20 7d 0a | ull).{.......filters.=.[].....}. |
61a0 | 0a 20 20 20 20 69 66 20 28 6d 65 73 73 61 67 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 | .....if.(message.==.null).{..... |
61c0 | 20 20 6d 65 73 73 61 67 65 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 | ..message.=.''.....}.else.if.(ty |
61e0 | 70 65 6f 66 20 6d 65 73 73 61 67 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 | peof.message.!==.'string').{.... |
6200 | 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 4d 65 73 73 61 67 65 20 | ...throw.new.TypeError('Message. |
6220 | 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 | must.be.a.string').....}......if |
6240 | 20 28 6e 61 6d 65 46 69 65 6c 64 4c 61 62 65 6c 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 | .(nameFieldLabel.==.null).{..... |
6260 | 20 20 6e 61 6d 65 46 69 65 6c 64 4c 61 62 65 6c 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 | ..nameFieldLabel.=.''.....}.else |
6280 | 20 69 66 20 28 74 79 70 65 6f 66 20 6e 61 6d 65 46 69 65 6c 64 4c 61 62 65 6c 20 21 3d 3d 20 27 | .if.(typeof.nameFieldLabel.!==.' |
62a0 | 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 | string').{.......throw.new.TypeE |
62c0 | 72 72 6f 72 28 27 4e 61 6d 65 20 66 69 65 6c 64 20 6c 61 62 65 6c 20 6d 75 73 74 20 62 65 20 61 | rror('Name.field.label.must.be.a |
62e0 | 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 73 68 6f 77 73 54 61 | .string').....}......if.(showsTa |
6300 | 67 46 69 65 6c 64 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 73 68 6f 77 73 54 61 67 | gField.==.null).{.......showsTag |
6320 | 46 69 65 6c 64 20 3d 20 74 72 75 65 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 77 72 | Field.=.true.....}......const.wr |
6340 | 61 70 70 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 74 79 70 65 6f 66 20 63 61 6c 6c 62 61 63 6b 20 | appedCallback.=.typeof.callback. |
6360 | 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 20 3f 20 66 75 6e 63 74 69 6f 6e 20 28 73 75 63 63 65 | ===.'function'.?.function.(succe |
6380 | 73 73 2c 20 72 65 73 75 6c 74 2c 20 62 6f 6f 6b 6d 61 72 6b 44 61 74 61 29 20 7b 0a 20 20 20 20 | ss,.result,.bookmarkData).{..... |
63a0 | 20 20 72 65 74 75 72 6e 20 73 75 63 63 65 73 73 20 3f 20 63 61 6c 6c 62 61 63 6b 28 72 65 73 75 | ..return.success.?.callback(resu |
63c0 | 6c 74 2c 20 62 6f 6f 6b 6d 61 72 6b 44 61 74 61 29 20 3a 20 63 61 6c 6c 62 61 63 6b 28 29 0a 20 | lt,.bookmarkData).:.callback().. |
63e0 | 20 20 20 7d 20 3a 20 6e 75 6c 6c 0a 20 20 20 20 63 6f 6e 73 74 20 73 65 74 74 69 6e 67 73 20 3d | ...}.:.null.....const.settings.= |
6400 | 20 7b 20 74 69 74 6c 65 2c 20 62 75 74 74 6f 6e 4c 61 62 65 6c 2c 20 64 65 66 61 75 6c 74 50 61 | .{.title,.buttonLabel,.defaultPa |
6420 | 74 68 2c 20 66 69 6c 74 65 72 73 2c 20 6d 65 73 73 61 67 65 2c 20 73 65 63 75 72 69 74 79 53 63 | th,.filters,.message,.securitySc |
6440 | 6f 70 65 64 42 6f 6f 6b 6d 61 72 6b 73 2c 20 6e 61 6d 65 46 69 65 6c 64 4c 61 62 65 6c 2c 20 73 | opedBookmarks,.nameFieldLabel,.s |
6460 | 68 6f 77 73 54 61 67 46 69 65 6c 64 2c 20 77 69 6e 64 6f 77 20 7d 0a 20 20 20 20 72 65 74 75 72 | howsTagField,.window.}.....retur |
6480 | 6e 20 62 69 6e 64 69 6e 67 2e 73 68 6f 77 53 61 76 65 44 69 61 6c 6f 67 28 73 65 74 74 69 6e 67 | n.binding.showSaveDialog(setting |
64a0 | 73 2c 20 77 72 61 70 70 65 64 43 61 6c 6c 62 61 63 6b 29 0a 20 20 7d 2c 0a 0a 20 20 73 68 6f 77 | s,.wrappedCallback)...},....show |
64c0 | 4d 65 73 73 61 67 65 42 6f 78 3a 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b | MessageBox:.function.(...args).{ |
64e0 | 0a 20 20 20 20 63 68 65 63 6b 41 70 70 49 6e 69 74 69 61 6c 69 7a 65 64 28 29 0a 0a 20 20 20 20 | .....checkAppInitialized()...... |
6500 | 6c 65 74 20 5b 77 69 6e 64 6f 77 2c 20 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 5d 20 | let.[window,.options,.callback]. |
6520 | 3d 20 70 61 72 73 65 41 72 67 73 28 2e 2e 2e 61 72 67 73 29 0a 0a 20 20 20 20 69 66 20 28 6f 70 | =.parseArgs(...args)......if.(op |
6540 | 74 69 6f 6e 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 20 3d | tions.==.null).{.......options.= |
6560 | 20 7b 0a 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 6e 6f 6e 65 27 0a 20 20 20 20 20 20 7d 0a | .{.........type:.'none'.......}. |
6580 | 20 20 20 20 7d 0a 0a 20 20 20 20 6c 65 74 20 7b 0a 20 20 20 20 20 20 62 75 74 74 6f 6e 73 2c 20 | ....}......let.{.......buttons,. |
65a0 | 63 61 6e 63 65 6c 49 64 2c 20 63 68 65 63 6b 62 6f 78 4c 61 62 65 6c 2c 20 63 68 65 63 6b 62 6f | cancelId,.checkboxLabel,.checkbo |
65c0 | 78 43 68 65 63 6b 65 64 2c 20 64 65 66 61 75 6c 74 49 64 2c 20 64 65 74 61 69 6c 2c 0a 20 20 20 | xChecked,.defaultId,.detail,.... |
65e0 | 20 20 20 69 63 6f 6e 2c 20 6d 65 73 73 61 67 65 2c 20 74 69 74 6c 65 2c 20 74 79 70 65 0a 20 20 | ...icon,.message,.title,.type... |
6600 | 20 20 7d 20 3d 20 6f 70 74 69 6f 6e 73 0a 0a 20 20 20 20 69 66 20 28 74 79 70 65 20 3d 3d 20 6e | ..}.=.options......if.(type.==.n |
6620 | 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 79 70 65 20 3d 20 27 6e 6f 6e 65 27 0a 20 20 20 20 7d | ull).{.......type.=.'none'.....} |
6640 | 0a 0a 20 20 20 20 63 6f 6e 73 74 20 6d 65 73 73 61 67 65 42 6f 78 54 79 70 65 20 3d 20 6d 65 73 | ......const.messageBoxType.=.mes |
6660 | 73 61 67 65 42 6f 78 54 79 70 65 73 2e 69 6e 64 65 78 4f 66 28 74 79 70 65 29 0a 20 20 20 20 69 | sageBoxTypes.indexOf(type).....i |
6680 | 66 20 28 6d 65 73 73 61 67 65 42 6f 78 54 79 70 65 20 3d 3d 3d 20 2d 31 29 20 7b 0a 20 20 20 20 | f.(messageBoxType.===.-1).{..... |
66a0 | 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 49 6e 76 61 6c 69 64 20 6d | ..throw.new.TypeError('Invalid.m |
66c0 | 65 73 73 61 67 65 20 62 6f 78 20 74 79 70 65 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 | essage.box.type').....}......if. |
66e0 | 28 62 75 74 74 6f 6e 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 62 75 74 74 6f 6e | (buttons.==.null).{.......button |
6700 | 73 20 3d 20 5b 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 21 41 72 72 61 79 2e 69 73 41 | s.=.[].....}.else.if.(!Array.isA |
6720 | 72 72 61 79 28 62 75 74 74 6f 6e 73 29 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 | rray(buttons)).{.......throw.new |
6740 | 20 54 79 70 65 45 72 72 6f 72 28 27 42 75 74 74 6f 6e 73 20 6d 75 73 74 20 62 65 20 61 6e 20 61 | .TypeError('Buttons.must.be.an.a |
6760 | 72 72 61 79 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 6e 6f | rray').....}......if.(options.no |
6780 | 72 6d 61 6c 69 7a 65 41 63 63 65 73 73 4b 65 79 73 29 20 7b 0a 20 20 20 20 20 20 62 75 74 74 6f | rmalizeAccessKeys).{.......butto |
67a0 | 6e 73 20 3d 20 62 75 74 74 6f 6e 73 2e 6d 61 70 28 6e 6f 72 6d 61 6c 69 7a 65 41 63 63 65 73 73 | ns.=.buttons.map(normalizeAccess |
67c0 | 4b 65 79 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 74 69 74 6c 65 20 3d 3d 20 6e 75 6c | Key).....}......if.(title.==.nul |
67e0 | 6c 29 20 7b 0a 20 20 20 20 20 20 74 69 74 6c 65 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 | l).{.......title.=.''.....}.else |
6800 | 20 69 66 20 28 74 79 70 65 6f 66 20 74 69 74 6c 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 | .if.(typeof.title.!==.'string'). |
6820 | 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 54 69 74 | {.......throw.new.TypeError('Tit |
6840 | 6c 65 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 | le.must.be.a.string').....}..... |
6860 | 20 69 66 20 28 6d 65 73 73 61 67 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 6d 65 | .if.(message.==.null).{.......me |
6880 | 73 73 61 67 65 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 | ssage.=.''.....}.else.if.(typeof |
68a0 | 20 6d 65 73 73 61 67 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 | .message.!==.'string').{.......t |
68c0 | 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 4d 65 73 73 61 67 65 20 6d 75 73 74 | hrow.new.TypeError('Message.must |
68e0 | 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 64 65 | .be.a.string').....}......if.(de |
6900 | 74 61 69 6c 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 64 65 74 61 69 6c 20 3d 20 27 | tail.==.null).{.......detail.=.' |
6920 | 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 65 6f 66 20 64 65 74 61 69 6c 20 21 | '.....}.else.if.(typeof.detail.! |
6940 | 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 | ==.'string').{.......throw.new.T |
6960 | 79 70 65 45 72 72 6f 72 28 27 44 65 74 61 69 6c 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e | ypeError('Detail.must.be.a.strin |
6980 | 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 68 65 63 6b 62 6f 78 43 68 65 63 6b 65 64 20 3d | g').....}......checkboxChecked.= |
69a0 | 20 21 21 63 68 65 63 6b 62 6f 78 43 68 65 63 6b 65 64 0a 0a 20 20 20 20 69 66 20 28 63 68 65 63 | .!!checkboxChecked......if.(chec |
69c0 | 6b 62 6f 78 4c 61 62 65 6c 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 63 68 65 63 6b | kboxLabel.==.null).{.......check |
69e0 | 62 6f 78 4c 61 62 65 6c 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 79 70 | boxLabel.=.''.....}.else.if.(typ |
6a00 | 65 6f 66 20 63 68 65 63 6b 62 6f 78 4c 61 62 65 6c 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 | eof.checkboxLabel.!==.'string'). |
6a20 | 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 63 68 65 | {.......throw.new.TypeError('che |
6a40 | 63 6b 62 6f 78 4c 61 62 65 6c 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 | ckboxLabel.must.be.a.string')... |
6a60 | 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 69 63 6f 6e 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 | ..}......if.(icon.==.null).{.... |
6a80 | 20 20 20 69 63 6f 6e 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 64 65 | ...icon.=.null.....}......if.(de |
6aa0 | 66 61 75 6c 74 49 64 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 64 65 66 61 75 6c 74 | faultId.==.null).{.......default |
6ac0 | 49 64 20 3d 20 2d 31 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 43 68 6f 6f 73 65 20 61 20 64 | Id.=.-1.....}......//.Choose.a.d |
6ae0 | 65 66 61 75 6c 74 20 62 75 74 74 6f 6e 20 74 6f 20 67 65 74 20 73 65 6c 65 63 74 65 64 20 77 68 | efault.button.to.get.selected.wh |
6b00 | 65 6e 20 64 69 61 6c 6f 67 20 69 73 20 63 61 6e 63 65 6c 6c 65 64 2e 0a 20 20 20 20 69 66 20 28 | en.dialog.is.cancelled......if.( |
6b20 | 63 61 6e 63 65 6c 49 64 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 49 66 20 | cancelId.==.null).{.......//.If. |
6b40 | 74 68 65 20 64 65 66 61 75 6c 74 49 64 20 69 73 20 73 65 74 20 74 6f 20 30 2c 20 65 6e 73 75 72 | the.defaultId.is.set.to.0,.ensur |
6b60 | 65 20 74 68 65 20 63 61 6e 63 65 6c 20 62 75 74 74 6f 6e 20 69 73 20 61 20 64 69 66 66 65 72 65 | e.the.cancel.button.is.a.differe |
6b80 | 6e 74 20 69 6e 64 65 78 20 28 31 29 0a 20 20 20 20 20 20 63 61 6e 63 65 6c 49 64 20 3d 20 28 64 | nt.index.(1).......cancelId.=.(d |
6ba0 | 65 66 61 75 6c 74 49 64 20 3d 3d 3d 20 30 20 26 26 20 62 75 74 74 6f 6e 73 2e 6c 65 6e 67 74 68 | efaultId.===.0.&&.buttons.length |
6bc0 | 20 3e 20 31 29 20 3f 20 31 20 3a 20 30 0a 20 20 20 20 20 20 66 6f 72 20 28 6c 65 74 20 69 20 3d | .>.1).?.1.:.0.......for.(let.i.= |
6be0 | 20 30 3b 20 69 20 3c 20 62 75 74 74 6f 6e 73 2e 6c 65 6e 67 74 68 3b 20 69 2b 2b 29 20 7b 0a 20 | .0;.i.<.buttons.length;.i++).{.. |
6c00 | 20 20 20 20 20 20 20 63 6f 6e 73 74 20 74 65 78 74 20 3d 20 62 75 74 74 6f 6e 73 5b 69 5d 2e 74 | .......const.text.=.buttons[i].t |
6c20 | 6f 4c 6f 77 65 72 43 61 73 65 28 29 0a 20 20 20 20 20 20 20 20 69 66 20 28 74 65 78 74 20 3d 3d | oLowerCase().........if.(text.== |
6c40 | 3d 20 27 63 61 6e 63 65 6c 27 20 7c 7c 20 74 65 78 74 20 3d 3d 3d 20 27 6e 6f 27 29 20 7b 0a 20 | =.'cancel'.||.text.===.'no').{.. |
6c60 | 20 20 20 20 20 20 20 20 20 63 61 6e 63 65 6c 49 64 20 3d 20 69 0a 20 20 20 20 20 20 20 20 20 20 | .........cancelId.=.i........... |
6c80 | 62 72 65 61 6b 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 | break.........}.......}.....}... |
6ca0 | 20 20 20 63 6f 6e 73 74 20 66 6c 61 67 73 20 3d 20 6f 70 74 69 6f 6e 73 2e 6e 6f 4c 69 6e 6b 20 | ...const.flags.=.options.noLink. |
6cc0 | 3f 20 6d 65 73 73 61 67 65 42 6f 78 4f 70 74 69 6f 6e 73 2e 6e 6f 4c 69 6e 6b 20 3a 20 30 0a 20 | ?.messageBoxOptions.noLink.:.0.. |
6ce0 | 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 73 68 6f 77 4d 65 73 73 61 67 65 42 6f 78 | ...return.binding.showMessageBox |
6d00 | 28 6d 65 73 73 61 67 65 42 6f 78 54 79 70 65 2c 20 62 75 74 74 6f 6e 73 2c 20 64 65 66 61 75 6c | (messageBoxType,.buttons,.defaul |
6d20 | 74 49 64 2c 20 63 61 6e 63 65 6c 49 64 2c 0a 20 20 20 20 20 20 66 6c 61 67 73 2c 20 74 69 74 6c | tId,.cancelId,.......flags,.titl |
6d40 | 65 2c 20 6d 65 73 73 61 67 65 2c 20 64 65 74 61 69 6c 2c 20 63 68 65 63 6b 62 6f 78 4c 61 62 65 | e,.message,.detail,.checkboxLabe |
6d60 | 6c 2c 0a 20 20 20 20 20 20 63 68 65 63 6b 62 6f 78 43 68 65 63 6b 65 64 2c 20 69 63 6f 6e 2c 20 | l,.......checkboxChecked,.icon,. |
6d80 | 77 69 6e 64 6f 77 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 7d 2c 0a 0a 20 20 73 68 6f 77 45 72 | window,.callback)...},....showEr |
6da0 | 72 6f 72 42 6f 78 3a 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 | rorBox:.function.(...args).{.... |
6dc0 | 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 73 68 6f 77 45 72 72 6f 72 42 6f 78 28 2e 2e 2e | .return.binding.showErrorBox(... |
6de0 | 61 72 67 73 29 0a 20 20 7d 2c 0a 0a 20 20 73 68 6f 77 43 65 72 74 69 66 69 63 61 74 65 54 72 75 | args)...},....showCertificateTru |
6e00 | 73 74 44 69 61 6c 6f 67 3a 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 | stDialog:.function.(...args).{.. |
6e20 | 20 20 20 63 6f 6e 73 74 20 5b 77 69 6e 64 6f 77 2c 20 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 | ...const.[window,.options,.callb |
6e40 | 61 63 6b 5d 20 3d 20 70 61 72 73 65 41 72 67 73 28 2e 2e 2e 61 72 67 73 29 0a 0a 20 20 20 20 69 | ack].=.parseArgs(...args)......i |
6e60 | 66 20 28 6f 70 74 69 6f 6e 73 20 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 74 79 70 65 6f 66 20 6f 70 74 | f.(options.==.null.||.typeof.opt |
6e80 | 69 6f 6e 73 20 21 3d 3d 20 27 6f 62 6a 65 63 74 27 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 | ions.!==.'object').{.......throw |
6ea0 | 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 6f 70 74 69 6f 6e 73 20 6d 75 73 74 20 62 65 20 | .new.TypeError('options.must.be. |
6ec0 | 61 6e 20 6f 62 6a 65 63 74 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 6c 65 74 20 7b 20 63 65 72 | an.object').....}......let.{.cer |
6ee0 | 74 69 66 69 63 61 74 65 2c 20 6d 65 73 73 61 67 65 20 7d 20 3d 20 6f 70 74 69 6f 6e 73 0a 20 20 | tificate,.message.}.=.options... |
6f00 | 20 20 69 66 20 28 63 65 72 74 69 66 69 63 61 74 65 20 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 74 79 70 | ..if.(certificate.==.null.||.typ |
6f20 | 65 6f 66 20 63 65 72 74 69 66 69 63 61 74 65 20 21 3d 3d 20 27 6f 62 6a 65 63 74 27 29 20 7b 0a | eof.certificate.!==.'object').{. |
6f40 | 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 63 65 72 74 69 | ......throw.new.TypeError('certi |
6f60 | 66 69 63 61 74 65 20 6d 75 73 74 20 62 65 20 61 6e 20 6f 62 6a 65 63 74 27 29 0a 20 20 20 20 7d | ficate.must.be.an.object').....} |
6f80 | 0a 0a 20 20 20 20 69 66 20 28 6d 65 73 73 61 67 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 | ......if.(message.==.null).{.... |
6fa0 | 20 20 20 6d 65 73 73 61 67 65 20 3d 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 | ...message.=.''.....}.else.if.(t |
6fc0 | 79 70 65 6f 66 20 6d 65 73 73 61 67 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 | ypeof.message.!==.'string').{... |
6fe0 | 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 6d 65 73 73 61 67 65 | ....throw.new.TypeError('message |
7000 | 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 72 | .must.be.a.string').....}......r |
7020 | 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 73 68 6f 77 43 65 72 74 69 66 69 63 61 74 65 54 72 75 | eturn.binding.showCertificateTru |
7040 | 73 74 44 69 61 6c 6f 67 28 77 69 6e 64 6f 77 2c 20 63 65 72 74 69 66 69 63 61 74 65 2c 20 6d 65 | stDialog(window,.certificate,.me |
7060 | 73 73 61 67 65 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 4d 61 72 6b 20 | ssage,.callback)...}.}..//.Mark. |
7080 | 73 74 61 6e 64 61 72 64 20 61 73 79 6e 63 68 72 6f 6e 6f 75 73 20 66 75 6e 63 74 69 6f 6e 73 2e | standard.asynchronous.functions. |
70a0 | 0a 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 6d 6f 64 75 6c 65 2e 65 78 | .v8Util.setHiddenValue(module.ex |
70c0 | 70 6f 72 74 73 2e 73 68 6f 77 4d 65 73 73 61 67 65 42 6f 78 2c 20 27 61 73 79 6e 63 68 72 6f 6e | ports.showMessageBox,.'asynchron |
70e0 | 6f 75 73 27 2c 20 74 72 75 65 29 0a 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 | ous',.true).v8Util.setHiddenValu |
7100 | 65 28 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 2e 73 68 6f 77 4f 70 65 6e 44 69 61 6c 6f 67 2c | e(module.exports.showOpenDialog, |
7120 | 20 27 61 73 79 6e 63 68 72 6f 6e 6f 75 73 27 2c 20 74 72 75 65 29 0a 76 38 55 74 69 6c 2e 73 65 | .'asynchronous',.true).v8Util.se |
7140 | 74 48 69 64 64 65 6e 56 61 6c 75 65 28 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 2e 73 68 6f 77 | tHiddenValue(module.exports.show |
7160 | 53 61 76 65 44 69 61 6c 6f 67 2c 20 27 61 73 79 6e 63 68 72 6f 6e 6f 75 73 27 2c 20 74 72 75 65 | SaveDialog,.'asynchronous',.true |
7180 | 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 63 6f 6d 6d 6f 6e 20 3d 20 72 | ).'use.strict'..const.common.=.r |
71a0 | 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f | equire('@electron/internal/commo |
71c0 | 6e 2f 61 70 69 2f 65 78 70 6f 72 74 73 2f 65 6c 65 63 74 72 6f 6e 27 29 0a 2f 2f 20 73 69 6e 63 | n/api/exports/electron').//.sinc |
71e0 | 65 20 62 72 6f 77 73 65 72 20 6d 6f 64 75 6c 65 20 6c 69 73 74 20 69 73 20 61 6c 73 6f 20 75 73 | e.browser.module.list.is.also.us |
7200 | 65 64 20 69 6e 20 72 65 6e 64 65 72 65 72 2c 20 6b 65 65 70 20 69 74 20 73 65 70 61 72 61 74 65 | ed.in.renderer,.keep.it.separate |
7220 | 2e 0a 63 6f 6e 73 74 20 6d 6f 64 75 6c 65 4c 69 73 74 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 | ..const.moduleList.=.require('@e |
7240 | 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 61 70 69 2f 6d 6f 64 | lectron/internal/browser/api/mod |
7260 | 75 6c 65 2d 6c 69 73 74 27 29 0a 0a 2f 2f 20 49 6d 70 6f 72 74 20 63 6f 6d 6d 6f 6e 20 6d 6f 64 | ule-list')..//.Import.common.mod |
7280 | 75 6c 65 73 2e 0a 63 6f 6d 6d 6f 6e 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 69 65 73 28 65 78 | ules..common.defineProperties(ex |
72a0 | 70 6f 72 74 73 29 0a 0a 66 6f 72 20 28 63 6f 6e 73 74 20 6d 6f 64 75 6c 65 20 6f 66 20 6d 6f 64 | ports)..for.(const.module.of.mod |
72c0 | 75 6c 65 4c 69 73 74 29 20 7b 0a 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 | uleList).{...Object.defineProper |
72e0 | 74 79 28 65 78 70 6f 72 74 73 2c 20 6d 6f 64 75 6c 65 2e 6e 61 6d 65 2c 20 7b 0a 20 20 20 20 65 | ty(exports,.module.name,.{.....e |
7300 | 6e 75 6d 65 72 61 62 6c 65 3a 20 21 6d 6f 64 75 6c 65 2e 70 72 69 76 61 74 65 2c 0a 20 20 20 20 | numerable:.!module.private,..... |
7320 | 67 65 74 3a 20 63 6f 6d 6d 6f 6e 2e 6d 65 6d 6f 69 7a 65 64 47 65 74 74 65 72 28 28 29 20 3d 3e | get:.common.memoizedGetter(().=> |
7340 | 20 72 65 71 75 69 72 65 28 60 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f | .require(`@electron/internal/bro |
7360 | 77 73 65 72 2f 61 70 69 2f 24 7b 6d 6f 64 75 6c 65 2e 66 69 6c 65 7d 2e 6a 73 60 29 29 0a 20 20 | wser/api/${module.file}.js`))... |
7380 | 7d 29 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 | }).}.'use.strict'..module.export |
73a0 | 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 67 6c 6f 62 61 6c 5f | s.=.process.atomBinding('global_ |
73c0 | 73 68 6f 72 74 63 75 74 27 29 2e 67 6c 6f 62 61 6c 53 68 6f 72 74 63 75 74 0a 27 75 73 65 20 73 | shortcut').globalShortcut.'use.s |
73e0 | 74 72 69 63 74 27 0a 0a 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d | trict'..if.(process.platform.=== |
7400 | 20 27 64 61 72 77 69 6e 27 29 20 7b 0a 20 20 63 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d 69 74 | .'darwin').{...const.{.EventEmit |
7420 | 74 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 20 20 63 6f 6e 73 | ter.}.=.require('events')...cons |
7440 | 74 20 7b 20 69 6e 41 70 70 50 75 72 63 68 61 73 65 2c 20 49 6e 41 70 70 50 75 72 63 68 61 73 65 | t.{.inAppPurchase,.InAppPurchase |
7460 | 20 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 69 6e 5f 61 70 70 | .}.=.process.atomBinding('in_app |
7480 | 5f 70 75 72 63 68 61 73 65 27 29 0a 0a 20 20 2f 2f 20 69 6e 41 70 70 50 75 72 63 68 61 73 65 20 | _purchase')....//.inAppPurchase. |
74a0 | 69 73 20 61 6e 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 0a 20 20 4f 62 6a 65 63 74 2e 73 65 74 | is.an.EventEmitter....Object.set |
74c0 | 50 72 6f 74 6f 74 79 70 65 4f 66 28 49 6e 41 70 70 50 75 72 63 68 61 73 65 2e 70 72 6f 74 6f 74 | PrototypeOf(InAppPurchase.protot |
74e0 | 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 20 20 45 | ype,.EventEmitter.prototype)...E |
7500 | 76 65 6e 74 45 6d 69 74 74 65 72 2e 63 61 6c 6c 28 69 6e 41 70 70 50 75 72 63 68 61 73 65 29 0a | ventEmitter.call(inAppPurchase). |
7520 | 0a 20 20 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 69 6e 41 70 70 50 75 72 63 68 61 73 | ...module.exports.=.inAppPurchas |
7540 | 65 0a 7d 20 65 6c 73 65 20 7b 0a 20 20 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 7b 0a | e.}.else.{...module.exports.=.{. |
7560 | 20 20 20 20 70 75 72 63 68 61 73 65 50 72 6f 64 75 63 74 3a 20 28 70 72 6f 64 75 63 74 49 44 2c | ....purchaseProduct:.(productID, |
7580 | 20 71 75 61 6e 74 69 74 79 2c 20 63 61 6c 6c 62 61 63 6b 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 | .quantity,.callback).=>.{....... |
75a0 | 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 54 68 65 20 69 6e 41 70 70 50 75 72 63 68 61 | throw.new.Error('The.inAppPurcha |
75c0 | 73 65 20 6d 6f 64 75 6c 65 20 63 61 6e 20 6f 6e 6c 79 20 62 65 20 75 73 65 64 20 6f 6e 20 6d 61 | se.module.can.only.be.used.on.ma |
75e0 | 63 4f 53 27 29 0a 20 20 20 20 7d 2c 0a 20 20 20 20 63 61 6e 4d 61 6b 65 50 61 79 6d 65 6e 74 73 | cOS').....},.....canMakePayments |
7600 | 3a 20 28 29 20 3d 3e 20 66 61 6c 73 65 2c 0a 20 20 20 20 67 65 74 52 65 63 65 69 70 74 55 52 4c | :.().=>.false,.....getReceiptURL |
7620 | 3a 20 28 29 20 3d 3e 20 27 27 0a 20 20 7d 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 | :.().=>.''...}.}.'use.strict'..c |
7640 | 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 | onst.{.EventEmitter.}.=.require( |
7660 | 27 65 76 65 6e 74 73 27 29 0a 0a 63 6f 6e 73 74 20 65 6d 69 74 74 65 72 20 3d 20 6e 65 77 20 45 | 'events')..const.emitter.=.new.E |
7680 | 76 65 6e 74 45 6d 69 74 74 65 72 28 29 0a 0a 2f 2f 20 44 6f 20 6e 6f 74 20 74 68 72 6f 77 20 65 | ventEmitter()..//.Do.not.throw.e |
76a0 | 78 63 65 70 74 69 6f 6e 20 77 68 65 6e 20 63 68 61 6e 6e 65 6c 20 6e 61 6d 65 20 69 73 20 22 65 | xception.when.channel.name.is."e |
76c0 | 72 72 6f 72 22 2e 0a 65 6d 69 74 74 65 72 2e 6f 6e 28 27 65 72 72 6f 72 27 2c 20 28 29 20 3d 3e | rror"..emitter.on('error',.().=> |
76e0 | 20 7b 7d 29 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 65 6d 69 74 74 65 72 0a 27 | .{})..module.exports.=.emitter.' |
7700 | 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 61 70 70 20 7d 20 3d 20 72 65 71 | use.strict'..const.{.app.}.=.req |
7720 | 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 63 6f 6e 73 74 20 72 6f 6c 65 73 20 3d 20 | uire('electron')..const.roles.=. |
7740 | 7b 0a 20 20 61 62 6f 75 74 3a 20 7b 0a 20 20 20 20 67 65 74 20 6c 61 62 65 6c 20 28 29 20 7b 0a | {...about:.{.....get.label.().{. |
7760 | 20 20 20 20 20 20 72 65 74 75 72 6e 20 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d | ......return.process.platform.== |
7780 | 3d 20 27 6c 69 6e 75 78 27 20 3f 20 27 41 62 6f 75 74 27 20 3a 20 60 41 62 6f 75 74 20 24 7b 61 | =.'linux'.?.'About'.:.`About.${a |
77a0 | 70 70 2e 67 65 74 4e 61 6d 65 28 29 7d 60 0a 20 20 20 20 7d 0a 20 20 7d 2c 0a 20 20 63 6c 6f 73 | pp.getName()}`.....}...},...clos |
77c0 | 65 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d | e:.{.....label:.process.platform |
77e0 | 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 20 3f 20 27 43 6c 6f 73 65 20 57 69 6e 64 6f 77 27 20 3a | .===.'darwin'.?.'Close.Window'.: |
7800 | 20 27 43 6c 6f 73 65 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d | .'Close',.....accelerator:.'Comm |
7820 | 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 57 27 2c 0a 20 20 20 20 77 69 6e 64 6f 77 4d 65 74 68 6f | andOrControl+W',.....windowMetho |
7840 | 64 3a 20 27 63 6c 6f 73 65 27 0a 20 20 7d 2c 0a 20 20 63 6f 70 79 3a 20 7b 0a 20 20 20 20 6c 61 | d:.'close'...},...copy:.{.....la |
7860 | 62 65 6c 3a 20 27 43 6f 70 79 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 | bel:.'Copy',.....accelerator:.'C |
7880 | 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 43 27 2c 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 | ommandOrControl+C',.....webConte |
78a0 | 6e 74 73 4d 65 74 68 6f 64 3a 20 27 63 6f 70 79 27 2c 0a 20 20 20 20 72 65 67 69 73 74 65 72 41 | ntsMethod:.'copy',.....registerA |
78c0 | 63 63 65 6c 65 72 61 74 6f 72 3a 20 66 61 6c 73 65 0a 20 20 7d 2c 0a 20 20 63 75 74 3a 20 7b 0a | ccelerator:.false...},...cut:.{. |
78e0 | 20 20 20 20 6c 61 62 65 6c 3a 20 27 43 75 74 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f | ....label:.'Cut',.....accelerato |
7900 | 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 58 27 2c 0a 20 20 20 20 77 65 62 | r:.'CommandOrControl+X',.....web |
7920 | 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 27 63 75 74 27 2c 0a 20 20 20 20 72 65 67 69 73 | ContentsMethod:.'cut',.....regis |
7940 | 74 65 72 41 63 63 65 6c 65 72 61 74 6f 72 3a 20 66 61 6c 73 65 0a 20 20 7d 2c 0a 20 20 64 65 6c | terAccelerator:.false...},...del |
7960 | 65 74 65 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 44 65 6c 65 74 65 27 2c 0a 20 20 20 20 | ete:.{.....label:.'Delete',..... |
7980 | 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 27 64 65 6c 65 74 65 27 0a 20 20 7d 2c | webContentsMethod:.'delete'...}, |
79a0 | 0a 20 20 66 6f 72 63 65 72 65 6c 6f 61 64 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 46 6f | ...forcereload:.{.....label:.'Fo |
79c0 | 72 63 65 20 52 65 6c 6f 61 64 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 53 | rce.Reload',.....accelerator:.'S |
79e0 | 68 69 66 74 2b 43 6d 64 4f 72 43 74 72 6c 2b 52 27 2c 0a 20 20 20 20 6e 6f 6e 4e 61 74 69 76 65 | hift+CmdOrCtrl+R',.....nonNative |
7a00 | 4d 61 63 4f 53 52 6f 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 77 69 6e 64 6f 77 4d 65 74 68 6f | MacOSRole:.true,.....windowMetho |
7a20 | 64 3a 20 28 77 69 6e 64 6f 77 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 77 65 | d:.(window).=>.{.......window.we |
7a40 | 62 43 6f 6e 74 65 6e 74 73 2e 72 65 6c 6f 61 64 49 67 6e 6f 72 69 6e 67 43 61 63 68 65 28 29 0a | bContents.reloadIgnoringCache(). |
7a60 | 20 20 20 20 7d 0a 20 20 7d 2c 0a 20 20 66 72 6f 6e 74 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a | ....}...},...front:.{.....label: |
7a80 | 20 27 42 72 69 6e 67 20 41 6c 6c 20 74 6f 20 46 72 6f 6e 74 27 0a 20 20 7d 2c 0a 20 20 68 65 6c | .'Bring.All.to.Front'...},...hel |
7aa0 | 70 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 48 65 6c 70 27 0a 20 20 7d 2c 0a 20 20 68 69 | p:.{.....label:.'Help'...},...hi |
7ac0 | 64 65 3a 20 7b 0a 20 20 20 20 67 65 74 20 6c 61 62 65 6c 20 28 29 20 7b 0a 20 20 20 20 20 20 72 | de:.{.....get.label.().{.......r |
7ae0 | 65 74 75 72 6e 20 60 48 69 64 65 20 24 7b 61 70 70 2e 67 65 74 4e 61 6d 65 28 29 7d 60 0a 20 20 | eturn.`Hide.${app.getName()}`... |
7b00 | 20 20 7d 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 2b 48 | ..},.....accelerator:.'Command+H |
7b20 | 27 0a 20 20 7d 2c 0a 20 20 68 69 64 65 6f 74 68 65 72 73 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c | '...},...hideothers:.{.....label |
7b40 | 3a 20 27 48 69 64 65 20 4f 74 68 65 72 73 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 | :.'Hide.Others',.....accelerator |
7b60 | 3a 20 27 43 6f 6d 6d 61 6e 64 2b 41 6c 74 2b 48 27 0a 20 20 7d 2c 0a 20 20 6d 69 6e 69 6d 69 7a | :.'Command+Alt+H'...},...minimiz |
7b80 | 65 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 4d 69 6e 69 6d 69 7a 65 27 2c 0a 20 20 20 20 | e:.{.....label:.'Minimize',..... |
7ba0 | 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 4d | accelerator:.'CommandOrControl+M |
7bc0 | 27 2c 0a 20 20 20 20 77 69 6e 64 6f 77 4d 65 74 68 6f 64 3a 20 27 6d 69 6e 69 6d 69 7a 65 27 0a | ',.....windowMethod:.'minimize'. |
7be0 | 20 20 7d 2c 0a 20 20 70 61 73 74 65 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 50 61 73 74 | ..},...paste:.{.....label:.'Past |
7c00 | 65 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 | e',.....accelerator:.'CommandOrC |
7c20 | 6f 6e 74 72 6f 6c 2b 56 27 2c 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 | ontrol+V',.....webContentsMethod |
7c40 | 3a 20 27 70 61 73 74 65 27 2c 0a 20 20 20 20 72 65 67 69 73 74 65 72 41 63 63 65 6c 65 72 61 74 | :.'paste',.....registerAccelerat |
7c60 | 6f 72 3a 20 66 61 6c 73 65 0a 20 20 7d 2c 0a 20 20 70 61 73 74 65 61 6e 64 6d 61 74 63 68 73 74 | or:.false...},...pasteandmatchst |
7c80 | 79 6c 65 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 50 61 73 74 65 20 61 6e 64 20 4d 61 74 | yle:.{.....label:.'Paste.and.Mat |
7ca0 | 63 68 20 53 74 79 6c 65 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 53 68 69 | ch.Style',.....accelerator:.'Shi |
7cc0 | 66 74 2b 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 56 27 2c 0a 20 20 20 20 77 65 62 43 | ft+CommandOrControl+V',.....webC |
7ce0 | 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 27 70 61 73 74 65 41 6e 64 4d 61 74 63 68 53 74 79 | ontentsMethod:.'pasteAndMatchSty |
7d00 | 6c 65 27 2c 0a 20 20 20 20 72 65 67 69 73 74 65 72 41 63 63 65 6c 65 72 61 74 6f 72 3a 20 66 61 | le',.....registerAccelerator:.fa |
7d20 | 6c 73 65 0a 20 20 7d 2c 0a 20 20 71 75 69 74 3a 20 7b 0a 20 20 20 20 67 65 74 20 6c 61 62 65 6c | lse...},...quit:.{.....get.label |
7d40 | 20 28 29 20 7b 0a 20 20 20 20 20 20 73 77 69 74 63 68 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 | .().{.......switch.(process.plat |
7d60 | 66 6f 72 6d 29 20 7b 0a 20 20 20 20 20 20 20 20 63 61 73 65 20 27 64 61 72 77 69 6e 27 3a 20 72 | form).{.........case.'darwin':.r |
7d80 | 65 74 75 72 6e 20 60 51 75 69 74 20 24 7b 61 70 70 2e 67 65 74 4e 61 6d 65 28 29 7d 60 0a 20 20 | eturn.`Quit.${app.getName()}`... |
7da0 | 20 20 20 20 20 20 63 61 73 65 20 27 77 69 6e 33 32 27 3a 20 72 65 74 75 72 6e 20 27 45 78 69 74 | ......case.'win32':.return.'Exit |
7dc0 | 27 0a 20 20 20 20 20 20 20 20 64 65 66 61 75 6c 74 3a 20 72 65 74 75 72 6e 20 27 51 75 69 74 27 | '.........default:.return.'Quit' |
7de0 | 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a | .......}.....},.....accelerator: |
7e00 | 20 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 20 3f 20 | .process.platform.===.'win32'.?. |
7e20 | 6e 75 6c 6c 20 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 51 27 2c 0a 20 20 20 | null.:.'CommandOrControl+Q',.... |
7e40 | 20 61 70 70 4d 65 74 68 6f 64 3a 20 27 71 75 69 74 27 0a 20 20 7d 2c 0a 20 20 72 65 64 6f 3a 20 | .appMethod:.'quit'...},...redo:. |
7e60 | 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 52 65 64 6f 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 | {.....label:.'Redo',.....acceler |
7e80 | 61 74 6f 72 3a 20 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 | ator:.process.platform.===.'win3 |
7ea0 | 32 27 20 3f 20 27 43 6f 6e 74 72 6f 6c 2b 59 27 20 3a 20 27 53 68 69 66 74 2b 43 6f 6d 6d 61 6e | 2'.?.'Control+Y'.:.'Shift+Comman |
7ec0 | 64 4f 72 43 6f 6e 74 72 6f 6c 2b 5a 27 2c 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 | dOrControl+Z',.....webContentsMe |
7ee0 | 74 68 6f 64 3a 20 27 72 65 64 6f 27 0a 20 20 7d 2c 0a 20 20 72 65 6c 6f 61 64 3a 20 7b 0a 20 20 | thod:.'redo'...},...reload:.{... |
7f00 | 20 20 6c 61 62 65 6c 3a 20 27 52 65 6c 6f 61 64 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 | ..label:.'Reload',.....accelerat |
7f20 | 6f 72 3a 20 27 43 6d 64 4f 72 43 74 72 6c 2b 52 27 2c 0a 20 20 20 20 6e 6f 6e 4e 61 74 69 76 65 | or:.'CmdOrCtrl+R',.....nonNative |
7f40 | 4d 61 63 4f 53 52 6f 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 77 69 6e 64 6f 77 4d 65 74 68 6f | MacOSRole:.true,.....windowMetho |
7f60 | 64 3a 20 27 72 65 6c 6f 61 64 27 0a 20 20 7d 2c 0a 20 20 72 65 73 65 74 7a 6f 6f 6d 3a 20 7b 0a | d:.'reload'...},...resetzoom:.{. |
7f80 | 20 20 20 20 6c 61 62 65 6c 3a 20 27 41 63 74 75 61 6c 20 53 69 7a 65 27 2c 0a 20 20 20 20 61 63 | ....label:.'Actual.Size',.....ac |
7fa0 | 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 30 27 2c | celerator:.'CommandOrControl+0', |
7fc0 | 0a 20 20 20 20 6e 6f 6e 4e 61 74 69 76 65 4d 61 63 4f 53 52 6f 6c 65 3a 20 74 72 75 65 2c 0a 20 | .....nonNativeMacOSRole:.true,.. |
7fe0 | 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 28 77 65 62 43 6f 6e 74 65 6e | ...webContentsMethod:.(webConten |
8000 | 74 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 73 65 74 5a 6f | ts).=>.{.......webContents.setZo |
8020 | 6f 6d 4c 65 76 65 6c 28 30 29 0a 20 20 20 20 7d 0a 20 20 7d 2c 0a 20 20 73 65 6c 65 63 74 61 6c | omLevel(0).....}...},...selectal |
8040 | 6c 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 53 65 6c 65 63 74 20 41 6c 6c 27 2c 0a 20 20 | l:.{.....label:.'Select.All',... |
8060 | 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c | ..accelerator:.'CommandOrControl |
8080 | 2b 41 27 2c 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 27 73 65 6c | +A',.....webContentsMethod:.'sel |
80a0 | 65 63 74 41 6c 6c 27 0a 20 20 7d 2c 0a 20 20 73 65 72 76 69 63 65 73 3a 20 7b 0a 20 20 20 20 6c | ectAll'...},...services:.{.....l |
80c0 | 61 62 65 6c 3a 20 27 53 65 72 76 69 63 65 73 27 0a 20 20 7d 2c 0a 20 20 72 65 63 65 6e 74 64 6f | abel:.'Services'...},...recentdo |
80e0 | 63 75 6d 65 6e 74 73 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 4f 70 65 6e 20 52 65 63 65 | cuments:.{.....label:.'Open.Rece |
8100 | 6e 74 27 0a 20 20 7d 2c 0a 20 20 63 6c 65 61 72 72 65 63 65 6e 74 64 6f 63 75 6d 65 6e 74 73 3a | nt'...},...clearrecentdocuments: |
8120 | 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 43 6c 65 61 72 20 4d 65 6e 75 27 0a 20 20 7d 2c 0a | .{.....label:.'Clear.Menu'...},. |
8140 | 20 20 73 74 61 72 74 73 70 65 61 6b 69 6e 67 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 53 | ..startspeaking:.{.....label:.'S |
8160 | 74 61 72 74 20 53 70 65 61 6b 69 6e 67 27 0a 20 20 7d 2c 0a 20 20 73 74 6f 70 73 70 65 61 6b 69 | tart.Speaking'...},...stopspeaki |
8180 | 6e 67 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 53 74 6f 70 20 53 70 65 61 6b 69 6e 67 27 | ng:.{.....label:.'Stop.Speaking' |
81a0 | 0a 20 20 7d 2c 0a 20 20 74 6f 67 67 6c 65 64 65 76 74 6f 6f 6c 73 3a 20 7b 0a 20 20 20 20 6c 61 | ...},...toggledevtools:.{.....la |
81c0 | 62 65 6c 3a 20 27 54 6f 67 67 6c 65 20 44 65 76 65 6c 6f 70 65 72 20 54 6f 6f 6c 73 27 2c 0a 20 | bel:.'Toggle.Developer.Tools',.. |
81e0 | 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d | ...accelerator:.process.platform |
8200 | 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 20 3f 20 27 41 6c 74 2b 43 6f 6d 6d 61 6e 64 2b 49 27 20 | .===.'darwin'.?.'Alt+Command+I'. |
8220 | 3a 20 27 43 74 72 6c 2b 53 68 69 66 74 2b 49 27 2c 0a 20 20 20 20 6e 6f 6e 4e 61 74 69 76 65 4d | :.'Ctrl+Shift+I',.....nonNativeM |
8240 | 61 63 4f 53 52 6f 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 77 69 6e 64 6f 77 4d 65 74 68 6f 64 | acOSRole:.true,.....windowMethod |
8260 | 3a 20 27 74 6f 67 67 6c 65 44 65 76 54 6f 6f 6c 73 27 0a 20 20 7d 2c 0a 20 20 74 6f 67 67 6c 65 | :.'toggleDevTools'...},...toggle |
8280 | 66 75 6c 6c 73 63 72 65 65 6e 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 54 6f 67 67 6c 65 | fullscreen:.{.....label:.'Toggle |
82a0 | 20 46 75 6c 6c 20 53 63 72 65 65 6e 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 | .Full.Screen',.....accelerator:. |
82c0 | 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 20 3f 20 | process.platform.===.'darwin'.?. |
82e0 | 27 43 6f 6e 74 72 6f 6c 2b 43 6f 6d 6d 61 6e 64 2b 46 27 20 3a 20 27 46 31 31 27 2c 0a 20 20 20 | 'Control+Command+F'.:.'F11',.... |
8300 | 20 77 69 6e 64 6f 77 4d 65 74 68 6f 64 3a 20 28 77 69 6e 64 6f 77 29 20 3d 3e 20 7b 0a 20 20 20 | .windowMethod:.(window).=>.{.... |
8320 | 20 20 20 77 69 6e 64 6f 77 2e 73 65 74 46 75 6c 6c 53 63 72 65 65 6e 28 21 77 69 6e 64 6f 77 2e | ...window.setFullScreen(!window. |
8340 | 69 73 46 75 6c 6c 53 63 72 65 65 6e 28 29 29 0a 20 20 20 20 7d 0a 20 20 7d 2c 0a 20 20 75 6e 64 | isFullScreen()).....}...},...und |
8360 | 6f 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 55 6e 64 6f 27 2c 0a 20 20 20 20 61 63 63 65 | o:.{.....label:.'Undo',.....acce |
8380 | 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 5a 27 2c 0a 20 | lerator:.'CommandOrControl+Z',.. |
83a0 | 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 27 75 6e 64 6f 27 0a 20 20 7d | ...webContentsMethod:.'undo'...} |
83c0 | 2c 0a 20 20 75 6e 68 69 64 65 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 53 68 6f 77 20 41 | ,...unhide:.{.....label:.'Show.A |
83e0 | 6c 6c 27 0a 20 20 7d 2c 0a 20 20 77 69 6e 64 6f 77 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 | ll'...},...window:.{.....label:. |
8400 | 27 57 69 6e 64 6f 77 27 0a 20 20 7d 2c 0a 20 20 7a 6f 6f 6d 3a 20 7b 0a 20 20 20 20 6c 61 62 65 | 'Window'...},...zoom:.{.....labe |
8420 | 6c 3a 20 27 5a 6f 6f 6d 27 0a 20 20 7d 2c 0a 20 20 7a 6f 6f 6d 69 6e 3a 20 7b 0a 20 20 20 20 6c | l:.'Zoom'...},...zoomin:.{.....l |
8440 | 61 62 65 6c 3a 20 27 5a 6f 6f 6d 20 49 6e 27 2c 0a 20 20 20 20 61 63 63 65 6c 65 72 61 74 6f 72 | abel:.'Zoom.In',.....accelerator |
8460 | 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b 50 6c 75 73 27 2c 0a 20 20 20 20 6e | :.'CommandOrControl+Plus',.....n |
8480 | 6f 6e 4e 61 74 69 76 65 4d 61 63 4f 53 52 6f 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 77 65 62 | onNativeMacOSRole:.true,.....web |
84a0 | 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 3d 3e | ContentsMethod:.(webContents).=> |
84c0 | 20 7b 0a 20 20 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 67 65 74 5a 6f 6f 6d 4c 65 76 65 | .{.......webContents.getZoomLeve |
84e0 | 6c 28 28 7a 6f 6f 6d 4c 65 76 65 6c 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 77 65 62 43 6f | l((zoomLevel).=>.{.........webCo |
8500 | 6e 74 65 6e 74 73 2e 73 65 74 5a 6f 6f 6d 4c 65 76 65 6c 28 7a 6f 6f 6d 4c 65 76 65 6c 20 2b 20 | ntents.setZoomLevel(zoomLevel.+. |
8520 | 30 2e 35 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 0a 20 20 7d 2c 0a 20 20 7a 6f 6f 6d 6f | 0.5).......}).....}...},...zoomo |
8540 | 75 74 3a 20 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 5a 6f 6f 6d 20 4f 75 74 27 2c 0a 20 20 20 | ut:.{.....label:.'Zoom.Out',.... |
8560 | 20 61 63 63 65 6c 65 72 61 74 6f 72 3a 20 27 43 6f 6d 6d 61 6e 64 4f 72 43 6f 6e 74 72 6f 6c 2b | .accelerator:.'CommandOrControl+ |
8580 | 2d 27 2c 0a 20 20 20 20 6e 6f 6e 4e 61 74 69 76 65 4d 61 63 4f 53 52 6f 6c 65 3a 20 74 72 75 65 | -',.....nonNativeMacOSRole:.true |
85a0 | 2c 0a 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 3a 20 28 77 65 62 43 6f 6e | ,.....webContentsMethod:.(webCon |
85c0 | 74 65 6e 74 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 67 65 | tents).=>.{.......webContents.ge |
85e0 | 74 5a 6f 6f 6d 4c 65 76 65 6c 28 28 7a 6f 6f 6d 4c 65 76 65 6c 29 20 3d 3e 20 7b 0a 20 20 20 20 | tZoomLevel((zoomLevel).=>.{..... |
8600 | 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 73 65 74 5a 6f 6f 6d 4c 65 76 65 6c 28 7a 6f 6f | ....webContents.setZoomLevel(zoo |
8620 | 6d 4c 65 76 65 6c 20 2d 20 30 2e 35 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 0a 20 20 7d | mLevel.-.0.5).......}).....}...} |
8640 | 2c 0a 20 20 2f 2f 20 45 64 69 74 20 73 75 62 6d 65 6e 75 20 28 73 68 6f 75 6c 64 20 66 69 74 20 | ,...//.Edit.submenu.(should.fit. |
8660 | 62 6f 74 68 20 4d 61 63 20 26 20 57 69 6e 64 6f 77 73 29 0a 20 20 65 64 69 74 6d 65 6e 75 3a 20 | both.Mac.&.Windows)...editmenu:. |
8680 | 7b 0a 20 20 20 20 6c 61 62 65 6c 3a 20 27 45 64 69 74 27 2c 0a 20 20 20 20 73 75 62 6d 65 6e 75 | {.....label:.'Edit',.....submenu |
86a0 | 3a 20 5b 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 75 6e 64 6f 27 | :.[.......{.........role:.'undo' |
86c0 | 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 | .......},.......{.........role:. |
86e0 | 27 72 65 64 6f 27 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 | 'redo'.......},.......{......... |
8700 | 74 79 70 65 3a 20 27 73 65 70 61 72 61 74 6f 72 27 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 | type:.'separator'.......},...... |
8720 | 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 63 75 74 27 0a 20 20 20 20 20 20 7d 2c 0a | .{.........role:.'cut'.......},. |
8740 | 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 63 6f 70 79 27 0a 20 20 20 | ......{.........role:.'copy'.... |
8760 | 20 20 20 7d 2c 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 70 61 73 | ...},.......{.........role:.'pas |
8780 | 74 65 27 0a 20 20 20 20 20 20 7d 2c 0a 0a 20 20 20 20 20 20 70 72 6f 63 65 73 73 2e 70 6c 61 74 | te'.......},........process.plat |
87a0 | 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 20 3f 20 7b 0a 20 20 20 20 20 20 20 20 72 6f | form.===.'darwin'.?.{.........ro |
87c0 | 6c 65 3a 20 27 70 61 73 74 65 41 6e 64 4d 61 74 63 68 53 74 79 6c 65 27 0a 20 20 20 20 20 20 7d | le:.'pasteAndMatchStyle'.......} |
87e0 | 20 3a 20 6e 75 6c 6c 2c 0a 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 | .:.null,........{.........role:. |
8800 | 27 64 65 6c 65 74 65 27 0a 20 20 20 20 20 20 7d 2c 0a 0a 20 20 20 20 20 20 70 72 6f 63 65 73 73 | 'delete'.......},........process |
8820 | 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 20 3f 20 7b 0a 20 20 20 20 20 20 | .platform.===.'win32'.?.{....... |
8840 | 20 20 74 79 70 65 3a 20 27 73 65 70 61 72 61 74 6f 72 27 0a 20 20 20 20 20 20 7d 20 3a 20 6e 75 | ..type:.'separator'.......}.:.nu |
8860 | 6c 6c 2c 0a 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 73 65 6c 65 | ll,........{.........role:.'sele |
8880 | 63 74 41 6c 6c 27 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 5d 0a 20 20 7d 2c 0a 0a 20 20 2f 2f 20 | ctAll'.......}.....]...},....//. |
88a0 | 57 69 6e 64 6f 77 20 73 75 62 6d 65 6e 75 20 73 68 6f 75 6c 64 20 62 65 20 75 73 65 64 20 66 6f | Window.submenu.should.be.used.fo |
88c0 | 72 20 4d 61 63 20 6f 6e 6c 79 0a 20 20 77 69 6e 64 6f 77 6d 65 6e 75 3a 20 7b 0a 20 20 20 20 6c | r.Mac.only...windowmenu:.{.....l |
88e0 | 61 62 65 6c 3a 20 27 57 69 6e 64 6f 77 27 2c 0a 20 20 20 20 73 75 62 6d 65 6e 75 3a 20 5b 0a 20 | abel:.'Window',.....submenu:.[.. |
8900 | 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 6d 69 6e 69 6d 69 7a 65 27 0a | .....{.........role:.'minimize'. |
8920 | 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 | ......},.......{.........role:.' |
8940 | 63 6c 6f 73 65 27 0a 20 20 20 20 20 20 7d 2c 0a 0a 20 20 20 20 20 20 70 72 6f 63 65 73 73 2e 70 | close'.......},........process.p |
8960 | 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 20 3f 20 7b 0a 20 20 20 20 20 20 20 | latform.===.'darwin'.?.{........ |
8980 | 20 74 79 70 65 3a 20 27 73 65 70 61 72 61 74 6f 72 27 0a 20 20 20 20 20 20 7d 20 3a 20 6e 75 6c | .type:.'separator'.......}.:.nul |
89a0 | 6c 2c 0a 0a 20 20 20 20 20 20 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 | l,........process.platform.===.' |
89c0 | 64 61 72 77 69 6e 27 20 3f 20 7b 0a 20 20 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 66 72 6f 6e 74 | darwin'.?.{.........role:.'front |
89e0 | 27 0a 20 20 20 20 20 20 7d 20 3a 20 6e 75 6c 6c 0a 0a 20 20 20 20 5d 0a 20 20 7d 0a 7d 0a 0a 63 | '.......}.:.null......]...}.}..c |
8a00 | 6f 6e 73 74 20 63 61 6e 45 78 65 63 75 74 65 52 6f 6c 65 20 3d 20 28 72 6f 6c 65 29 20 3d 3e 20 | onst.canExecuteRole.=.(role).=>. |
8a20 | 7b 0a 20 20 69 66 20 28 21 72 6f 6c 65 73 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 72 6f | {...if.(!roles.hasOwnProperty(ro |
8a40 | 6c 65 29 29 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0a 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e | le)).return.false...if.(process. |
8a60 | 70 6c 61 74 66 6f 72 6d 20 21 3d 3d 20 27 64 61 72 77 69 6e 27 29 20 72 65 74 75 72 6e 20 74 72 | platform.!==.'darwin').return.tr |
8a80 | 75 65 0a 0a 20 20 2f 2f 20 6d 61 63 4f 53 20 68 61 6e 64 6c 65 73 20 61 6c 6c 20 72 6f 6c 65 73 | ue....//.macOS.handles.all.roles |
8aa0 | 20 6e 61 74 69 76 65 6c 79 20 65 78 63 65 70 74 20 66 6f 72 20 61 20 66 65 77 0a 20 20 72 65 74 | .natively.except.for.a.few...ret |
8ac0 | 75 72 6e 20 72 6f 6c 65 73 5b 72 6f 6c 65 5d 2e 6e 6f 6e 4e 61 74 69 76 65 4d 61 63 4f 53 52 6f | urn.roles[role].nonNativeMacOSRo |
8ae0 | 6c 65 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 67 65 74 44 65 66 61 75 6c 74 4c 61 62 65 6c 20 3d 20 | le.}..exports.getDefaultLabel.=. |
8b00 | 28 72 6f 6c 65 29 20 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e 20 72 6f 6c 65 73 2e 68 61 73 4f 77 | (role).=>.{...return.roles.hasOw |
8b20 | 6e 50 72 6f 70 65 72 74 79 28 72 6f 6c 65 29 20 3f 20 72 6f 6c 65 73 5b 72 6f 6c 65 5d 2e 6c 61 | nProperty(role).?.roles[role].la |
8b40 | 62 65 6c 20 3a 20 27 27 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 67 65 74 44 65 66 61 75 6c 74 41 63 | bel.:.''.}..exports.getDefaultAc |
8b60 | 63 65 6c 65 72 61 74 6f 72 20 3d 20 28 72 6f 6c 65 29 20 3d 3e 20 7b 0a 20 20 69 66 20 28 72 6f | celerator.=.(role).=>.{...if.(ro |
8b80 | 6c 65 73 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 72 6f 6c 65 29 29 20 72 65 74 75 72 6e | les.hasOwnProperty(role)).return |
8ba0 | 20 72 6f 6c 65 73 5b 72 6f 6c 65 5d 2e 61 63 63 65 6c 65 72 61 74 6f 72 0a 7d 0a 0a 65 78 70 6f | .roles[role].accelerator.}..expo |
8bc0 | 72 74 73 2e 73 68 6f 75 6c 64 52 65 67 69 73 74 65 72 41 63 63 65 6c 65 72 61 74 6f 72 20 3d 20 | rts.shouldRegisterAccelerator.=. |
8be0 | 28 72 6f 6c 65 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 68 61 73 52 6f 6c 65 52 65 67 69 73 | (role).=>.{...const.hasRoleRegis |
8c00 | 74 65 72 20 3d 20 72 6f 6c 65 73 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 72 6f 6c 65 29 | ter.=.roles.hasOwnProperty(role) |
8c20 | 20 26 26 20 72 6f 6c 65 73 5b 72 6f 6c 65 5d 2e 72 65 67 69 73 74 65 72 41 63 63 65 6c 65 72 61 | .&&.roles[role].registerAccelera |
8c40 | 74 6f 72 20 21 3d 3d 20 75 6e 64 65 66 69 6e 65 64 0a 20 20 72 65 74 75 72 6e 20 68 61 73 52 6f | tor.!==.undefined...return.hasRo |
8c60 | 6c 65 52 65 67 69 73 74 65 72 20 3f 20 72 6f 6c 65 73 5b 72 6f 6c 65 5d 2e 72 65 67 69 73 74 65 | leRegister.?.roles[role].registe |
8c80 | 72 41 63 63 65 6c 65 72 61 74 6f 72 20 3a 20 74 72 75 65 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 67 | rAccelerator.:.true.}..exports.g |
8ca0 | 65 74 44 65 66 61 75 6c 74 53 75 62 6d 65 6e 75 20 3d 20 28 72 6f 6c 65 29 20 3d 3e 20 7b 0a 20 | etDefaultSubmenu.=.(role).=>.{.. |
8cc0 | 20 69 66 20 28 21 72 6f 6c 65 73 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 72 6f 6c 65 29 | .if.(!roles.hasOwnProperty(role) |
8ce0 | 29 20 72 65 74 75 72 6e 0a 0a 20 20 6c 65 74 20 7b 20 73 75 62 6d 65 6e 75 20 7d 20 3d 20 72 6f | ).return....let.{.submenu.}.=.ro |
8d00 | 6c 65 73 5b 72 6f 6c 65 5d 0a 0a 20 20 2f 2f 20 72 65 6d 6f 76 65 20 6e 75 6c 6c 20 69 74 65 6d | les[role]....//.remove.null.item |
8d20 | 73 20 66 72 6f 6d 20 77 69 74 68 69 6e 20 74 68 65 20 73 75 62 6d 65 6e 75 0a 20 20 69 66 20 28 | s.from.within.the.submenu...if.( |
8d40 | 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 73 75 62 6d 65 6e 75 29 29 20 7b 0a 20 20 20 20 73 75 | Array.isArray(submenu)).{.....su |
8d60 | 62 6d 65 6e 75 20 3d 20 73 75 62 6d 65 6e 75 2e 66 69 6c 74 65 72 28 28 69 74 65 6d 29 20 3d 3e | bmenu.=.submenu.filter((item).=> |
8d80 | 20 69 74 65 6d 20 21 3d 20 6e 75 6c 6c 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 73 75 62 | .item.!=.null)...}....return.sub |
8da0 | 6d 65 6e 75 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 65 78 65 63 75 74 65 20 3d 20 28 72 6f 6c 65 2c | menu.}..exports.execute.=.(role, |
8dc0 | 20 66 6f 63 75 73 65 64 57 69 6e 64 6f 77 2c 20 66 6f 63 75 73 65 64 57 65 62 43 6f 6e 74 65 6e | .focusedWindow,.focusedWebConten |
8de0 | 74 73 29 20 3d 3e 20 7b 0a 20 20 69 66 20 28 21 63 61 6e 45 78 65 63 75 74 65 52 6f 6c 65 28 72 | ts).=>.{...if.(!canExecuteRole(r |
8e00 | 6f 6c 65 29 29 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0a 0a 20 20 63 6f 6e 73 74 20 7b 20 61 70 | ole)).return.false....const.{.ap |
8e20 | 70 4d 65 74 68 6f 64 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 2c 20 77 69 6e 64 | pMethod,.webContentsMethod,.wind |
8e40 | 6f 77 4d 65 74 68 6f 64 20 7d 20 3d 20 72 6f 6c 65 73 5b 72 6f 6c 65 5d 0a 0a 20 20 69 66 20 28 | owMethod.}.=.roles[role]....if.( |
8e60 | 61 70 70 4d 65 74 68 6f 64 29 20 7b 0a 20 20 20 20 61 70 70 5b 61 70 70 4d 65 74 68 6f 64 5d 28 | appMethod).{.....app[appMethod]( |
8e80 | 29 0a 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 7d 0a 0a 20 20 69 66 20 28 77 69 6e | ).....return.true...}....if.(win |
8ea0 | 64 6f 77 4d 65 74 68 6f 64 20 26 26 20 66 6f 63 75 73 65 64 57 69 6e 64 6f 77 20 21 3d 20 6e 75 | dowMethod.&&.focusedWindow.!=.nu |
8ec0 | 6c 6c 29 20 7b 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 77 69 6e 64 6f 77 4d 65 74 68 6f | ll).{.....if.(typeof.windowMetho |
8ee0 | 64 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 | d.===.'function').{.......window |
8f00 | 4d 65 74 68 6f 64 28 66 6f 63 75 73 65 64 57 69 6e 64 6f 77 29 0a 20 20 20 20 7d 20 65 6c 73 65 | Method(focusedWindow).....}.else |
8f20 | 20 7b 0a 20 20 20 20 20 20 66 6f 63 75 73 65 64 57 69 6e 64 6f 77 5b 77 69 6e 64 6f 77 4d 65 74 | .{.......focusedWindow[windowMet |
8f40 | 68 6f 64 5d 28 29 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 7d | hod]().....}.....return.true...} |
8f60 | 0a 0a 20 20 69 66 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 20 26 26 20 66 6f 63 | ....if.(webContentsMethod.&&.foc |
8f80 | 75 73 65 64 57 65 62 43 6f 6e 74 65 6e 74 73 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 69 | usedWebContents.!=.null).{.....i |
8fa0 | 66 20 28 74 79 70 65 6f 66 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 20 3d 3d 3d 20 | f.(typeof.webContentsMethod.===. |
8fc0 | 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d | 'function').{.......webContentsM |
8fe0 | 65 74 68 6f 64 28 66 6f 63 75 73 65 64 57 65 62 43 6f 6e 74 65 6e 74 73 29 0a 20 20 20 20 7d 20 | ethod(focusedWebContents).....}. |
9000 | 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 66 6f 63 75 73 65 64 57 65 62 43 6f 6e 74 65 6e 74 73 5b | else.{.......focusedWebContents[ |
9020 | 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 5d 28 29 0a 20 20 20 20 7d 0a 20 20 20 20 72 | webContentsMethod]().....}.....r |
9040 | 65 74 75 72 6e 20 74 72 75 65 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0a 7d | eturn.true...}....return.false.} |
9060 | 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 72 6f 6c 65 73 20 3d 20 72 65 71 | .'use.strict'..const.roles.=.req |
9080 | 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 | uire('@electron/internal/browser |
90a0 | 2f 61 70 69 2f 6d 65 6e 75 2d 69 74 65 6d 2d 72 6f 6c 65 73 27 29 0a 0a 6c 65 74 20 6e 65 78 74 | /api/menu-item-roles')..let.next |
90c0 | 43 6f 6d 6d 61 6e 64 49 64 20 3d 20 30 0a 0a 63 6f 6e 73 74 20 4d 65 6e 75 49 74 65 6d 20 3d 20 | CommandId.=.0..const.MenuItem.=. |
90e0 | 66 75 6e 63 74 69 6f 6e 20 28 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 7b 20 4d | function.(options).{...const.{.M |
9100 | 65 6e 75 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 20 20 2f | enu.}.=.require('electron')..../ |
9120 | 2f 20 50 72 65 73 65 72 76 65 20 65 78 74 72 61 20 66 69 65 6c 64 73 20 73 70 65 63 69 66 69 65 | /.Preserve.extra.fields.specifie |
9140 | 64 20 62 79 20 75 73 65 72 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 6b 65 79 20 69 6e 20 6f 70 | d.by.user...for.(const.key.in.op |
9160 | 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 69 66 20 28 21 28 6b 65 79 20 69 6e 20 74 68 69 73 29 29 | tions).{.....if.(!(key.in.this)) |
9180 | 20 74 68 69 73 5b 6b 65 79 5d 20 3d 20 6f 70 74 69 6f 6e 73 5b 6b 65 79 5d 0a 20 20 7d 0a 20 20 | .this[key].=.options[key]...}... |
91a0 | 69 66 20 28 74 79 70 65 6f 66 20 74 68 69 73 2e 72 6f 6c 65 20 3d 3d 3d 20 27 73 74 72 69 6e 67 | if.(typeof.this.role.===.'string |
91c0 | 27 20 7c 7c 20 74 68 69 73 2e 72 6f 6c 65 20 69 6e 73 74 61 6e 63 65 6f 66 20 53 74 72 69 6e 67 | '.||.this.role.instanceof.String |
91e0 | 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 72 6f 6c 65 20 3d 20 74 68 69 73 2e 72 6f 6c 65 2e 74 6f | ).{.....this.role.=.this.role.to |
9200 | 4c 6f 77 65 72 43 61 73 65 28 29 0a 20 20 7d 0a 20 20 74 68 69 73 2e 73 75 62 6d 65 6e 75 20 3d | LowerCase()...}...this.submenu.= |
9220 | 20 74 68 69 73 2e 73 75 62 6d 65 6e 75 20 7c 7c 20 72 6f 6c 65 73 2e 67 65 74 44 65 66 61 75 6c | .this.submenu.||.roles.getDefaul |
9240 | 74 53 75 62 6d 65 6e 75 28 74 68 69 73 2e 72 6f 6c 65 29 0a 20 20 69 66 20 28 74 68 69 73 2e 73 | tSubmenu(this.role)...if.(this.s |
9260 | 75 62 6d 65 6e 75 20 21 3d 20 6e 75 6c 6c 20 26 26 20 74 68 69 73 2e 73 75 62 6d 65 6e 75 2e 63 | ubmenu.!=.null.&&.this.submenu.c |
9280 | 6f 6e 73 74 72 75 63 74 6f 72 20 21 3d 3d 20 4d 65 6e 75 29 20 7b 0a 20 20 20 20 74 68 69 73 2e | onstructor.!==.Menu).{.....this. |
92a0 | 73 75 62 6d 65 6e 75 20 3d 20 4d 65 6e 75 2e 62 75 69 6c 64 46 72 6f 6d 54 65 6d 70 6c 61 74 65 | submenu.=.Menu.buildFromTemplate |
92c0 | 28 74 68 69 73 2e 73 75 62 6d 65 6e 75 29 0a 20 20 7d 0a 20 20 69 66 20 28 74 68 69 73 2e 74 79 | (this.submenu)...}...if.(this.ty |
92e0 | 70 65 20 3d 3d 20 6e 75 6c 6c 20 26 26 20 74 68 69 73 2e 73 75 62 6d 65 6e 75 20 21 3d 20 6e 75 | pe.==.null.&&.this.submenu.!=.nu |
9300 | 6c 6c 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 74 79 70 65 20 3d 20 27 73 75 62 6d 65 6e 75 27 0a | ll).{.....this.type.=.'submenu'. |
9320 | 20 20 7d 0a 20 20 69 66 20 28 74 68 69 73 2e 74 79 70 65 20 3d 3d 3d 20 27 73 75 62 6d 65 6e 75 | ..}...if.(this.type.===.'submenu |
9340 | 27 20 26 26 20 28 74 68 69 73 2e 73 75 62 6d 65 6e 75 20 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 74 68 | '.&&.(this.submenu.==.null.||.th |
9360 | 69 73 2e 73 75 62 6d 65 6e 75 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 21 3d 3d 20 4d 65 6e 75 29 | is.submenu.constructor.!==.Menu) |
9380 | 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 49 6e 76 61 6c 69 64 | ).{.....throw.new.Error('Invalid |
93a0 | 20 73 75 62 6d 65 6e 75 27 29 0a 20 20 7d 0a 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 52 | .submenu')...}....this.overrideR |
93c0 | 65 61 64 4f 6e 6c 79 50 72 6f 70 65 72 74 79 28 27 74 79 70 65 27 2c 20 27 6e 6f 72 6d 61 6c 27 | eadOnlyProperty('type',.'normal' |
93e0 | 29 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 52 65 61 64 4f 6e 6c 79 50 72 6f 70 65 72 74 | )...this.overrideReadOnlyPropert |
9400 | 79 28 27 72 6f 6c 65 27 29 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 52 65 61 64 4f 6e 6c | y('role')...this.overrideReadOnl |
9420 | 79 50 72 6f 70 65 72 74 79 28 27 61 63 63 65 6c 65 72 61 74 6f 72 27 29 0a 20 20 74 68 69 73 2e | yProperty('accelerator')...this. |
9440 | 6f 76 65 72 72 69 64 65 52 65 61 64 4f 6e 6c 79 50 72 6f 70 65 72 74 79 28 27 69 63 6f 6e 27 29 | overrideReadOnlyProperty('icon') |
9460 | 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 52 65 61 64 4f 6e 6c 79 50 72 6f 70 65 72 74 79 | ...this.overrideReadOnlyProperty |
9480 | 28 27 73 75 62 6d 65 6e 75 27 29 0a 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 50 72 6f 70 | ('submenu')....this.overrideProp |
94a0 | 65 72 74 79 28 27 6c 61 62 65 6c 27 2c 20 72 6f 6c 65 73 2e 67 65 74 44 65 66 61 75 6c 74 4c 61 | erty('label',.roles.getDefaultLa |
94c0 | 62 65 6c 28 74 68 69 73 2e 72 6f 6c 65 29 29 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 50 | bel(this.role))...this.overrideP |
94e0 | 72 6f 70 65 72 74 79 28 27 73 75 62 6c 61 62 65 6c 27 2c 20 27 27 29 0a 20 20 74 68 69 73 2e 6f | roperty('sublabel',.'')...this.o |
9500 | 76 65 72 72 69 64 65 50 72 6f 70 65 72 74 79 28 27 65 6e 61 62 6c 65 64 27 2c 20 74 72 75 65 29 | verrideProperty('enabled',.true) |
9520 | 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 50 72 6f 70 65 72 74 79 28 27 76 69 73 69 62 6c | ...this.overrideProperty('visibl |
9540 | 65 27 2c 20 74 72 75 65 29 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 50 72 6f 70 65 72 74 | e',.true)...this.overridePropert |
9560 | 79 28 27 63 68 65 63 6b 65 64 27 2c 20 66 61 6c 73 65 29 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 | y('checked',.false)...this.overr |
9580 | 69 64 65 50 72 6f 70 65 72 74 79 28 27 72 65 67 69 73 74 65 72 41 63 63 65 6c 65 72 61 74 6f 72 | ideProperty('registerAccelerator |
95a0 | 27 2c 20 72 6f 6c 65 73 2e 73 68 6f 75 6c 64 52 65 67 69 73 74 65 72 41 63 63 65 6c 65 72 61 74 | ',.roles.shouldRegisterAccelerat |
95c0 | 6f 72 28 74 68 69 73 2e 72 6f 6c 65 29 29 0a 0a 20 20 69 66 20 28 21 4d 65 6e 75 49 74 65 6d 2e | or(this.role))....if.(!MenuItem. |
95e0 | 74 79 70 65 73 2e 69 6e 63 6c 75 64 65 73 28 74 68 69 73 2e 74 79 70 65 29 29 20 7b 0a 20 20 20 | types.includes(this.type)).{.... |
9600 | 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 60 55 6e 6b 6e 6f 77 6e 20 6d 65 6e 75 20 69 | .throw.new.Error(`Unknown.menu.i |
9620 | 74 65 6d 20 74 79 70 65 3a 20 24 7b 74 68 69 73 2e 74 79 70 65 7d 60 29 0a 20 20 7d 0a 0a 20 20 | tem.type:.${this.type}`)...}.... |
9640 | 74 68 69 73 2e 6f 76 65 72 72 69 64 65 52 65 61 64 4f 6e 6c 79 50 72 6f 70 65 72 74 79 28 27 63 | this.overrideReadOnlyProperty('c |
9660 | 6f 6d 6d 61 6e 64 49 64 27 2c 20 2b 2b 6e 65 78 74 43 6f 6d 6d 61 6e 64 49 64 29 0a 0a 20 20 63 | ommandId',.++nextCommandId)....c |
9680 | 6f 6e 73 74 20 63 6c 69 63 6b 20 3d 20 6f 70 74 69 6f 6e 73 2e 63 6c 69 63 6b 0a 20 20 74 68 69 | onst.click.=.options.click...thi |
96a0 | 73 2e 63 6c 69 63 6b 20 3d 20 28 65 76 65 6e 74 2c 20 66 6f 63 75 73 65 64 57 69 6e 64 6f 77 2c | s.click.=.(event,.focusedWindow, |
96c0 | 20 66 6f 63 75 73 65 64 57 65 62 43 6f 6e 74 65 6e 74 73 29 20 3d 3e 20 7b 0a 20 20 20 20 2f 2f | .focusedWebContents).=>.{.....// |
96e0 | 20 4d 61 6e 75 61 6c 6c 79 20 66 6c 69 70 20 74 68 65 20 63 68 65 63 6b 65 64 20 66 6c 61 67 73 | .Manually.flip.the.checked.flags |
9700 | 20 77 68 65 6e 20 63 6c 69 63 6b 65 64 2e 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 74 79 70 65 | .when.clicked......if.(this.type |
9720 | 20 3d 3d 3d 20 27 63 68 65 63 6b 62 6f 78 27 20 7c 7c 20 74 68 69 73 2e 74 79 70 65 20 3d 3d 3d | .===.'checkbox'.||.this.type.=== |
9740 | 20 27 72 61 64 69 6f 27 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 63 68 65 63 6b 65 64 20 3d | .'radio').{.......this.checked.= |
9760 | 20 21 74 68 69 73 2e 63 68 65 63 6b 65 64 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 21 72 | .!this.checked.....}......if.(!r |
9780 | 6f 6c 65 73 2e 65 78 65 63 75 74 65 28 74 68 69 73 2e 72 6f 6c 65 2c 20 66 6f 63 75 73 65 64 57 | oles.execute(this.role,.focusedW |
97a0 | 69 6e 64 6f 77 2c 20 66 6f 63 75 73 65 64 57 65 62 43 6f 6e 74 65 6e 74 73 29 29 20 7b 0a 20 20 | indow,.focusedWebContents)).{... |
97c0 | 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 63 6c 69 63 6b 20 3d 3d 3d 20 27 66 75 6e 63 74 69 | ....if.(typeof.click.===.'functi |
97e0 | 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 20 20 63 6c 69 63 6b 28 74 68 69 73 2c 20 66 6f 63 75 73 | on').{.........click(this,.focus |
9800 | 65 64 57 69 6e 64 6f 77 2c 20 65 76 65 6e 74 29 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 69 66 | edWindow,.event).......}.else.if |
9820 | 20 28 74 79 70 65 6f 66 20 74 68 69 73 2e 73 65 6c 65 63 74 6f 72 20 3d 3d 3d 20 27 73 74 72 69 | .(typeof.this.selector.===.'stri |
9840 | 6e 67 27 20 26 26 20 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 | ng'.&&.process.platform.===.'dar |
9860 | 77 69 6e 27 29 20 7b 0a 20 20 20 20 20 20 20 20 4d 65 6e 75 2e 73 65 6e 64 41 63 74 69 6f 6e 54 | win').{.........Menu.sendActionT |
9880 | 6f 46 69 72 73 74 52 65 73 70 6f 6e 64 65 72 28 74 68 69 73 2e 73 65 6c 65 63 74 6f 72 29 0a 20 | oFirstResponder(this.selector).. |
98a0 | 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 4d 65 6e 75 49 74 65 6d 2e 74 79 70 | .....}.....}...}.}..MenuItem.typ |
98c0 | 65 73 20 3d 20 5b 27 6e 6f 72 6d 61 6c 27 2c 20 27 73 65 70 61 72 61 74 6f 72 27 2c 20 27 73 75 | es.=.['normal',.'separator',.'su |
98e0 | 62 6d 65 6e 75 27 2c 20 27 63 68 65 63 6b 62 6f 78 27 2c 20 27 72 61 64 69 6f 27 5d 0a 0a 4d 65 | bmenu',.'checkbox',.'radio']..Me |
9900 | 6e 75 49 74 65 6d 2e 70 72 6f 74 6f 74 79 70 65 2e 67 65 74 44 65 66 61 75 6c 74 52 6f 6c 65 41 | nuItem.prototype.getDefaultRoleA |
9920 | 63 63 65 6c 65 72 61 74 6f 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 72 65 74 | ccelerator.=.function.().{...ret |
9940 | 75 72 6e 20 72 6f 6c 65 73 2e 67 65 74 44 65 66 61 75 6c 74 41 63 63 65 6c 65 72 61 74 6f 72 28 | urn.roles.getDefaultAccelerator( |
9960 | 74 68 69 73 2e 72 6f 6c 65 29 0a 7d 0a 0a 4d 65 6e 75 49 74 65 6d 2e 70 72 6f 74 6f 74 79 70 65 | this.role).}..MenuItem.prototype |
9980 | 2e 6f 76 65 72 72 69 64 65 50 72 6f 70 65 72 74 79 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6e 61 | .overrideProperty.=.function.(na |
99a0 | 6d 65 2c 20 64 65 66 61 75 6c 74 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 69 66 20 | me,.defaultValue.=.null).{...if. |
99c0 | 28 74 68 69 73 5b 6e 61 6d 65 5d 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 74 68 69 73 5b | (this[name].==.null).{.....this[ |
99e0 | 6e 61 6d 65 5d 20 3d 20 64 65 66 61 75 6c 74 56 61 6c 75 65 0a 20 20 7d 0a 7d 0a 0a 4d 65 6e 75 | name].=.defaultValue...}.}..Menu |
9a00 | 49 74 65 6d 2e 70 72 6f 74 6f 74 79 70 65 2e 6f 76 65 72 72 69 64 65 52 65 61 64 4f 6e 6c 79 50 | Item.prototype.overrideReadOnlyP |
9a20 | 72 6f 70 65 72 74 79 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 2c 20 64 65 66 61 75 6c | roperty.=.function.(name,.defaul |
9a40 | 74 56 61 6c 75 65 29 20 7b 0a 20 20 74 68 69 73 2e 6f 76 65 72 72 69 64 65 50 72 6f 70 65 72 74 | tValue).{...this.overridePropert |
9a60 | 79 28 6e 61 6d 65 2c 20 64 65 66 61 75 6c 74 56 61 6c 75 65 29 0a 20 20 4f 62 6a 65 63 74 2e 64 | y(name,.defaultValue)...Object.d |
9a80 | 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 74 68 69 73 2c 20 6e 61 6d 65 2c 20 7b 0a 20 20 20 20 | efineProperty(this,.name,.{..... |
9aa0 | 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 77 72 69 74 61 62 6c 65 3a 20 | enumerable:.true,.....writable:. |
9ac0 | 66 61 6c 73 65 2c 0a 20 20 20 20 76 61 6c 75 65 3a 20 74 68 69 73 5b 6e 61 6d 65 5d 0a 20 20 7d | false,.....value:.this[name]...} |
9ae0 | 29 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 4d 65 6e 75 49 74 65 6d 0a 27 | ).}..module.exports.=.MenuItem.' |
9b00 | 75 73 65 20 73 74 72 69 63 74 27 0a 0a 66 75 6e 63 74 69 6f 6e 20 73 70 6c 69 74 41 72 72 61 79 | use.strict'..function.splitArray |
9b20 | 20 28 61 72 72 2c 20 70 72 65 64 69 63 61 74 65 29 20 7b 0a 20 20 63 6f 6e 73 74 20 72 65 73 75 | .(arr,.predicate).{...const.resu |
9b40 | 6c 74 20 3d 20 61 72 72 2e 72 65 64 75 63 65 28 28 6d 75 6c 74 69 2c 20 69 74 65 6d 29 20 3d 3e | lt.=.arr.reduce((multi,.item).=> |
9b60 | 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 75 72 72 65 6e 74 20 3d 20 6d 75 6c 74 69 5b 6d 75 6c | .{.....const.current.=.multi[mul |
9b80 | 74 69 2e 6c 65 6e 67 74 68 20 2d 20 31 5d 0a 20 20 20 20 69 66 20 28 70 72 65 64 69 63 61 74 65 | ti.length.-.1].....if.(predicate |
9ba0 | 28 69 74 65 6d 29 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 63 75 72 72 65 6e 74 2e 6c 65 6e 67 | (item)).{.......if.(current.leng |
9bc0 | 74 68 20 3e 20 30 29 20 6d 75 6c 74 69 2e 70 75 73 68 28 5b 5d 29 0a 20 20 20 20 7d 20 65 6c 73 | th.>.0).multi.push([]).....}.els |
9be0 | 65 20 7b 0a 20 20 20 20 20 20 63 75 72 72 65 6e 74 2e 70 75 73 68 28 69 74 65 6d 29 0a 20 20 20 | e.{.......current.push(item).... |
9c00 | 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 6d 75 6c 74 69 0a 20 20 7d 2c 20 5b 5b 5d 5d 29 0a 0a | .}.....return.multi...},.[[]]).. |
9c20 | 20 20 69 66 20 28 72 65 73 75 6c 74 5b 72 65 73 75 6c 74 2e 6c 65 6e 67 74 68 20 2d 20 31 5d 2e | ..if.(result[result.length.-.1]. |
9c40 | 6c 65 6e 67 74 68 20 3d 3d 3d 20 30 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 72 65 73 75 6c | length.===.0).{.....return.resul |
9c60 | 74 2e 73 6c 69 63 65 28 30 2c 20 72 65 73 75 6c 74 2e 6c 65 6e 67 74 68 20 2d 20 31 29 0a 20 20 | t.slice(0,.result.length.-.1)... |
9c80 | 7d 0a 20 20 72 65 74 75 72 6e 20 72 65 73 75 6c 74 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 6a 6f | }...return.result.}..function.jo |
9ca0 | 69 6e 41 72 72 61 79 73 20 28 61 72 72 61 79 73 2c 20 6a 6f 69 6e 49 44 73 29 20 7b 0a 20 20 72 | inArrays.(arrays,.joinIDs).{...r |
9cc0 | 65 74 75 72 6e 20 61 72 72 61 79 73 2e 72 65 64 75 63 65 28 28 6a 6f 69 6e 65 64 2c 20 61 72 72 | eturn.arrays.reduce((joined,.arr |
9ce0 | 2c 20 69 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 69 20 3e 20 30 20 26 26 20 61 72 72 2e 6c | ,.i).=>.{.....if.(i.>.0.&&.arr.l |
9d00 | 65 6e 67 74 68 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 6a 6f 69 6e 49 44 73 2e 6c 65 6e 67 74 | ength).{.......if.(joinIDs.lengt |
9d20 | 68 20 3e 20 30 29 20 7b 0a 20 20 20 20 20 20 20 20 6a 6f 69 6e 65 64 2e 70 75 73 68 28 6a 6f 69 | h.>.0).{.........joined.push(joi |
9d40 | 6e 49 44 73 5b 30 5d 29 0a 20 20 20 20 20 20 20 20 6a 6f 69 6e 49 44 73 2e 73 70 6c 69 63 65 28 | nIDs[0]).........joinIDs.splice( |
9d60 | 30 2c 20 31 29 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 6a 6f 69 | 0,.1).......}.else.{.........joi |
9d80 | 6e 65 64 2e 70 75 73 68 28 7b 20 74 79 70 65 3a 20 27 73 65 70 61 72 61 74 6f 72 27 20 7d 29 0a | ned.push({.type:.'separator'.}). |
9da0 | 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 6a 6f 69 6e 65 64 2e | ......}.....}.....return.joined. |
9dc0 | 63 6f 6e 63 61 74 28 61 72 72 29 0a 20 20 7d 2c 20 5b 5d 29 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e | concat(arr)...},.[]).}..function |
9de0 | 20 70 75 73 68 4f 6e 74 6f 4d 75 6c 74 69 4d 61 70 20 28 6d 61 70 2c 20 6b 65 79 2c 20 76 61 6c | .pushOntoMultiMap.(map,.key,.val |
9e00 | 75 65 29 20 7b 0a 20 20 69 66 20 28 21 6d 61 70 2e 68 61 73 28 6b 65 79 29 29 20 7b 0a 20 20 20 | ue).{...if.(!map.has(key)).{.... |
9e20 | 20 6d 61 70 2e 73 65 74 28 6b 65 79 2c 20 5b 5d 29 0a 20 20 7d 0a 20 20 6d 61 70 2e 67 65 74 28 | .map.set(key,.[])...}...map.get( |
9e40 | 6b 65 79 29 2e 70 75 73 68 28 76 61 6c 75 65 29 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 69 6e 64 | key).push(value).}..function.ind |
9e60 | 65 78 4f 66 47 72 6f 75 70 43 6f 6e 74 61 69 6e 69 6e 67 49 44 20 28 67 72 6f 75 70 73 2c 20 69 | exOfGroupContainingID.(groups,.i |
9e80 | 64 2c 20 69 67 6e 6f 72 65 47 72 6f 75 70 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 67 72 6f 75 70 | d,.ignoreGroup).{...return.group |
9ea0 | 73 2e 66 69 6e 64 49 6e 64 65 78 28 0a 20 20 20 20 63 61 6e 64 69 64 61 74 65 47 72 6f 75 70 20 | s.findIndex(.....candidateGroup. |
9ec0 | 3d 3e 0a 20 20 20 20 20 20 63 61 6e 64 69 64 61 74 65 47 72 6f 75 70 20 21 3d 3d 20 69 67 6e 6f | =>.......candidateGroup.!==.igno |
9ee0 | 72 65 47 72 6f 75 70 20 26 26 0a 20 20 20 20 20 20 63 61 6e 64 69 64 61 74 65 47 72 6f 75 70 2e | reGroup.&&.......candidateGroup. |
9f00 | 73 6f 6d 65 28 0a 20 20 20 20 20 20 20 20 63 61 6e 64 69 64 61 74 65 49 74 65 6d 20 3d 3e 20 63 | some(.........candidateItem.=>.c |
9f20 | 61 6e 64 69 64 61 74 65 49 74 65 6d 2e 69 64 20 3d 3d 3d 20 69 64 0a 20 20 20 20 20 20 29 0a 20 | andidateItem.id.===.id.......).. |
9f40 | 20 29 0a 7d 0a 0a 2f 2f 20 53 6f 72 74 20 6e 6f 64 65 73 20 74 6f 70 6f 6c 6f 67 69 63 61 6c 6c | .).}..//.Sort.nodes.topologicall |
9f60 | 79 20 75 73 69 6e 67 20 61 20 64 65 70 74 68 2d 66 69 72 73 74 20 61 70 70 72 6f 61 63 68 2e 20 | y.using.a.depth-first.approach.. |
9f80 | 45 6e 63 6f 75 6e 74 65 72 65 64 20 63 79 63 6c 65 73 0a 2f 2f 20 61 72 65 20 62 72 6f 6b 65 6e | Encountered.cycles.//.are.broken |
9fa0 | 2e 0a 66 75 6e 63 74 69 6f 6e 20 73 6f 72 74 54 6f 70 6f 6c 6f 67 69 63 61 6c 6c 79 20 28 6f 72 | ..function.sortTopologically.(or |
9fc0 | 69 67 69 6e 61 6c 4f 72 64 65 72 2c 20 65 64 67 65 73 42 79 49 64 29 20 7b 0a 20 20 63 6f 6e 73 | iginalOrder,.edgesById).{...cons |
9fe0 | 74 20 73 6f 72 74 65 64 20 3d 20 5b 5d 0a 20 20 63 6f 6e 73 74 20 6d 61 72 6b 65 64 20 3d 20 6e | t.sorted.=.[]...const.marked.=.n |
a000 | 65 77 20 53 65 74 28 29 0a 0a 20 20 63 6f 6e 73 74 20 76 69 73 69 74 20 3d 20 28 6d 61 72 6b 29 | ew.Set()....const.visit.=.(mark) |
a020 | 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 6d 61 72 6b 65 64 2e 68 61 73 28 6d 61 72 6b 29 29 20 | .=>.{.....if.(marked.has(mark)). |
a040 | 72 65 74 75 72 6e 0a 20 20 20 20 6d 61 72 6b 65 64 2e 61 64 64 28 6d 61 72 6b 29 0a 20 20 20 20 | return.....marked.add(mark)..... |
a060 | 63 6f 6e 73 74 20 65 64 67 65 73 20 3d 20 65 64 67 65 73 42 79 49 64 2e 67 65 74 28 6d 61 72 6b | const.edges.=.edgesById.get(mark |
a080 | 29 0a 20 20 20 20 69 66 20 28 65 64 67 65 73 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 | ).....if.(edges.!=.null).{...... |
a0a0 | 20 65 64 67 65 73 2e 66 6f 72 45 61 63 68 28 76 69 73 69 74 29 0a 20 20 20 20 7d 0a 20 20 20 20 | .edges.forEach(visit).....}..... |
a0c0 | 73 6f 72 74 65 64 2e 70 75 73 68 28 6d 61 72 6b 29 0a 20 20 7d 0a 0a 20 20 6f 72 69 67 69 6e 61 | sorted.push(mark)...}....origina |
a0e0 | 6c 4f 72 64 65 72 2e 66 6f 72 45 61 63 68 28 76 69 73 69 74 29 0a 20 20 72 65 74 75 72 6e 20 73 | lOrder.forEach(visit)...return.s |
a100 | 6f 72 74 65 64 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 61 74 74 65 6d 70 74 54 6f 4d 65 72 67 65 | orted.}..function.attemptToMerge |
a120 | 41 47 72 6f 75 70 20 28 67 72 6f 75 70 73 29 20 7b 0a 20 20 66 6f 72 20 28 6c 65 74 20 69 20 3d | AGroup.(groups).{...for.(let.i.= |
a140 | 20 30 3b 20 69 20 3c 20 67 72 6f 75 70 73 2e 6c 65 6e 67 74 68 3b 20 69 2b 2b 29 20 7b 0a 20 20 | .0;.i.<.groups.length;.i++).{... |
a160 | 20 20 63 6f 6e 73 74 20 67 72 6f 75 70 20 3d 20 67 72 6f 75 70 73 5b 69 5d 0a 20 20 20 20 66 6f | ..const.group.=.groups[i].....fo |
a180 | 72 20 28 63 6f 6e 73 74 20 69 74 65 6d 20 6f 66 20 67 72 6f 75 70 29 20 7b 0a 20 20 20 20 20 20 | r.(const.item.of.group).{....... |
a1a0 | 63 6f 6e 73 74 20 74 6f 49 44 73 20 3d 20 5b 2e 2e 2e 28 69 74 65 6d 2e 62 65 66 6f 72 65 20 7c | const.toIDs.=.[...(item.before.| |
a1c0 | 7c 20 5b 5d 29 2c 20 2e 2e 2e 28 69 74 65 6d 2e 61 66 74 65 72 20 7c 7c 20 5b 5d 29 5d 0a 20 20 | |.[]),....(item.after.||.[])]... |
a1e0 | 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 69 64 20 6f 66 20 74 6f 49 44 73 29 20 7b 0a 20 20 | ....for.(const.id.of.toIDs).{... |
a200 | 20 20 20 20 20 20 63 6f 6e 73 74 20 69 6e 64 65 78 20 3d 20 69 6e 64 65 78 4f 66 47 72 6f 75 70 | ......const.index.=.indexOfGroup |
a220 | 43 6f 6e 74 61 69 6e 69 6e 67 49 44 28 67 72 6f 75 70 73 2c 20 69 64 2c 20 67 72 6f 75 70 29 0a | ContainingID(groups,.id,.group). |
a240 | 20 20 20 20 20 20 20 20 69 66 20 28 69 6e 64 65 78 20 3d 3d 3d 20 2d 31 29 20 63 6f 6e 74 69 6e | ........if.(index.===.-1).contin |
a260 | 75 65 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 6d 65 72 67 65 54 61 72 67 65 74 20 3d 20 67 | ue.........const.mergeTarget.=.g |
a280 | 72 6f 75 70 73 5b 69 6e 64 65 78 5d 0a 0a 20 20 20 20 20 20 20 20 6d 65 72 67 65 54 61 72 67 65 | roups[index]..........mergeTarge |
a2a0 | 74 2e 70 75 73 68 28 2e 2e 2e 67 72 6f 75 70 29 0a 20 20 20 20 20 20 20 20 67 72 6f 75 70 73 2e | t.push(...group).........groups. |
a2c0 | 73 70 6c 69 63 65 28 69 2c 20 31 29 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 | splice(i,.1).........return.true |
a2e0 | 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 66 61 6c 73 | .......}.....}...}...return.fals |
a300 | 65 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 6d 65 72 67 65 47 72 6f 75 70 73 20 28 67 72 6f 75 70 | e.}..function.mergeGroups.(group |
a320 | 73 29 20 7b 0a 20 20 6c 65 74 20 6d 65 72 67 65 64 20 3d 20 74 72 75 65 0a 20 20 77 68 69 6c 65 | s).{...let.merged.=.true...while |
a340 | 20 28 6d 65 72 67 65 64 29 20 7b 0a 20 20 20 20 6d 65 72 67 65 64 20 3d 20 61 74 74 65 6d 70 74 | .(merged).{.....merged.=.attempt |
a360 | 54 6f 4d 65 72 67 65 41 47 72 6f 75 70 28 67 72 6f 75 70 73 29 0a 20 20 7d 0a 20 20 72 65 74 75 | ToMergeAGroup(groups)...}...retu |
a380 | 72 6e 20 67 72 6f 75 70 73 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 73 6f 72 74 49 74 65 6d 73 49 | rn.groups.}..function.sortItemsI |
a3a0 | 6e 47 72 6f 75 70 20 28 67 72 6f 75 70 29 20 7b 0a 20 20 63 6f 6e 73 74 20 6f 72 69 67 69 6e 61 | nGroup.(group).{...const.origina |
a3c0 | 6c 4f 72 64 65 72 20 3d 20 67 72 6f 75 70 2e 6d 61 70 28 28 6e 6f 64 65 2c 20 69 29 20 3d 3e 20 | lOrder.=.group.map((node,.i).=>. |
a3e0 | 69 29 0a 20 20 63 6f 6e 73 74 20 65 64 67 65 73 20 3d 20 6e 65 77 20 4d 61 70 28 29 0a 20 20 63 | i)...const.edges.=.new.Map()...c |
a400 | 6f 6e 73 74 20 69 64 54 6f 49 6e 64 65 78 20 3d 20 6e 65 77 20 4d 61 70 28 67 72 6f 75 70 2e 6d | onst.idToIndex.=.new.Map(group.m |
a420 | 61 70 28 28 69 74 65 6d 2c 20 69 29 20 3d 3e 20 5b 69 74 65 6d 2e 69 64 2c 20 69 5d 29 29 0a 0a | ap((item,.i).=>.[item.id,.i])).. |
a440 | 20 20 67 72 6f 75 70 2e 66 6f 72 45 61 63 68 28 28 69 74 65 6d 2c 20 69 29 20 3d 3e 20 7b 0a 20 | ..group.forEach((item,.i).=>.{.. |
a460 | 20 20 20 69 66 20 28 69 74 65 6d 2e 62 65 66 6f 72 65 29 20 7b 0a 20 20 20 20 20 20 69 74 65 6d | ...if.(item.before).{.......item |
a480 | 2e 62 65 66 6f 72 65 2e 66 6f 72 45 61 63 68 28 74 6f 49 44 20 3d 3e 20 7b 0a 20 20 20 20 20 20 | .before.forEach(toID.=>.{....... |
a4a0 | 20 20 63 6f 6e 73 74 20 74 6f 20 3d 20 69 64 54 6f 49 6e 64 65 78 2e 67 65 74 28 74 6f 49 44 29 | ..const.to.=.idToIndex.get(toID) |
a4c0 | 0a 20 20 20 20 20 20 20 20 69 66 20 28 74 6f 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 | .........if.(to.!=.null).{...... |
a4e0 | 20 20 20 20 20 70 75 73 68 4f 6e 74 6f 4d 75 6c 74 69 4d 61 70 28 65 64 67 65 73 2c 20 74 6f 2c | .....pushOntoMultiMap(edges,.to, |
a500 | 20 69 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 0a 20 20 20 | .i).........}.......}).....}.... |
a520 | 20 69 66 20 28 69 74 65 6d 2e 61 66 74 65 72 29 20 7b 0a 20 20 20 20 20 20 69 74 65 6d 2e 61 66 | .if.(item.after).{.......item.af |
a540 | 74 65 72 2e 66 6f 72 45 61 63 68 28 74 6f 49 44 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 63 6f | ter.forEach(toID.=>.{.........co |
a560 | 6e 73 74 20 74 6f 20 3d 20 69 64 54 6f 49 6e 64 65 78 2e 67 65 74 28 74 6f 49 44 29 0a 20 20 20 | nst.to.=.idToIndex.get(toID).... |
a580 | 20 20 20 20 20 69 66 20 28 74 6f 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 20 | .....if.(to.!=.null).{.......... |
a5a0 | 20 70 75 73 68 4f 6e 74 6f 4d 75 6c 74 69 4d 61 70 28 65 64 67 65 73 2c 20 69 2c 20 74 6f 29 0a | .pushOntoMultiMap(edges,.i,.to). |
a5c0 | 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 0a 20 | ........}.......}).....}...})... |
a5e0 | 20 63 6f 6e 73 74 20 73 6f 72 74 65 64 4e 6f 64 65 73 20 3d 20 73 6f 72 74 54 6f 70 6f 6c 6f 67 | .const.sortedNodes.=.sortTopolog |
a600 | 69 63 61 6c 6c 79 28 6f 72 69 67 69 6e 61 6c 4f 72 64 65 72 2c 20 65 64 67 65 73 29 0a 20 20 72 | ically(originalOrder,.edges)...r |
a620 | 65 74 75 72 6e 20 73 6f 72 74 65 64 4e 6f 64 65 73 2e 6d 61 70 28 69 20 3d 3e 20 67 72 6f 75 70 | eturn.sortedNodes.map(i.=>.group |
a640 | 5b 69 5d 29 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 66 69 6e 64 45 64 67 65 73 49 6e 47 72 6f 75 | [i]).}..function.findEdgesInGrou |
a660 | 70 20 28 67 72 6f 75 70 73 2c 20 69 2c 20 65 64 67 65 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 67 | p.(groups,.i,.edges).{...const.g |
a680 | 72 6f 75 70 20 3d 20 67 72 6f 75 70 73 5b 69 5d 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 69 74 | roup.=.groups[i]...for.(const.it |
a6a0 | 65 6d 20 6f 66 20 67 72 6f 75 70 29 20 7b 0a 20 20 20 20 69 66 20 28 69 74 65 6d 2e 62 65 66 6f | em.of.group).{.....if.(item.befo |
a6c0 | 72 65 47 72 6f 75 70 43 6f 6e 74 61 69 6e 69 6e 67 29 20 7b 0a 20 20 20 20 20 20 66 6f 72 20 28 | reGroupContaining).{.......for.( |
a6e0 | 63 6f 6e 73 74 20 69 64 20 6f 66 20 69 74 65 6d 2e 62 65 66 6f 72 65 47 72 6f 75 70 43 6f 6e 74 | const.id.of.item.beforeGroupCont |
a700 | 61 69 6e 69 6e 67 29 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 74 6f 20 3d 20 69 6e 64 | aining).{.........const.to.=.ind |
a720 | 65 78 4f 66 47 72 6f 75 70 43 6f 6e 74 61 69 6e 69 6e 67 49 44 28 67 72 6f 75 70 73 2c 20 69 64 | exOfGroupContainingID(groups,.id |
a740 | 2c 20 67 72 6f 75 70 29 0a 20 20 20 20 20 20 20 20 69 66 20 28 74 6f 20 21 3d 3d 20 2d 31 29 20 | ,.group).........if.(to.!==.-1). |
a760 | 7b 0a 20 20 20 20 20 20 20 20 20 20 70 75 73 68 4f 6e 74 6f 4d 75 6c 74 69 4d 61 70 28 65 64 67 | {...........pushOntoMultiMap(edg |
a780 | 65 73 2c 20 74 6f 2c 20 69 29 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 | es,.to,.i)...........return..... |
a7a0 | 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 28 69 74 65 6d | ....}.......}.....}.....if.(item |
a7c0 | 2e 61 66 74 65 72 47 72 6f 75 70 43 6f 6e 74 61 69 6e 69 6e 67 29 20 7b 0a 20 20 20 20 20 20 66 | .afterGroupContaining).{.......f |
a7e0 | 6f 72 20 28 63 6f 6e 73 74 20 69 64 20 6f 66 20 69 74 65 6d 2e 61 66 74 65 72 47 72 6f 75 70 43 | or.(const.id.of.item.afterGroupC |
a800 | 6f 6e 74 61 69 6e 69 6e 67 29 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 74 6f 20 3d 20 | ontaining).{.........const.to.=. |
a820 | 69 6e 64 65 78 4f 66 47 72 6f 75 70 43 6f 6e 74 61 69 6e 69 6e 67 49 44 28 67 72 6f 75 70 73 2c | indexOfGroupContainingID(groups, |
a840 | 20 69 64 2c 20 67 72 6f 75 70 29 0a 20 20 20 20 20 20 20 20 69 66 20 28 74 6f 20 21 3d 3d 20 2d | .id,.group).........if.(to.!==.- |
a860 | 31 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 70 75 73 68 4f 6e 74 6f 4d 75 6c 74 69 4d 61 70 28 | 1).{...........pushOntoMultiMap( |
a880 | 65 64 67 65 73 2c 20 69 2c 20 74 6f 29 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 | edges,.i,.to)...........return.. |
a8a0 | 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 66 75 | .......}.......}.....}...}.}..fu |
a8c0 | 6e 63 74 69 6f 6e 20 73 6f 72 74 47 72 6f 75 70 73 20 28 67 72 6f 75 70 73 29 20 7b 0a 20 20 63 | nction.sortGroups.(groups).{...c |
a8e0 | 6f 6e 73 74 20 6f 72 69 67 69 6e 61 6c 4f 72 64 65 72 20 3d 20 67 72 6f 75 70 73 2e 6d 61 70 28 | onst.originalOrder.=.groups.map( |
a900 | 28 69 74 65 6d 2c 20 69 29 20 3d 3e 20 69 29 0a 20 20 63 6f 6e 73 74 20 65 64 67 65 73 20 3d 20 | (item,.i).=>.i)...const.edges.=. |
a920 | 6e 65 77 20 4d 61 70 28 29 0a 0a 20 20 66 6f 72 20 28 6c 65 74 20 69 20 3d 20 30 3b 20 69 20 3c | new.Map()....for.(let.i.=.0;.i.< |
a940 | 20 67 72 6f 75 70 73 2e 6c 65 6e 67 74 68 3b 20 69 2b 2b 29 20 7b 0a 20 20 20 20 66 69 6e 64 45 | .groups.length;.i++).{.....findE |
a960 | 64 67 65 73 49 6e 47 72 6f 75 70 28 67 72 6f 75 70 73 2c 20 69 2c 20 65 64 67 65 73 29 0a 20 20 | dgesInGroup(groups,.i,.edges)... |
a980 | 7d 0a 0a 20 20 63 6f 6e 73 74 20 73 6f 72 74 65 64 47 72 6f 75 70 49 6e 64 65 78 65 73 20 3d 20 | }....const.sortedGroupIndexes.=. |
a9a0 | 73 6f 72 74 54 6f 70 6f 6c 6f 67 69 63 61 6c 6c 79 28 6f 72 69 67 69 6e 61 6c 4f 72 64 65 72 2c | sortTopologically(originalOrder, |
a9c0 | 20 65 64 67 65 73 29 0a 20 20 72 65 74 75 72 6e 20 73 6f 72 74 65 64 47 72 6f 75 70 49 6e 64 65 | .edges)...return.sortedGroupInde |
a9e0 | 78 65 73 2e 6d 61 70 28 69 20 3d 3e 20 67 72 6f 75 70 73 5b 69 5d 29 0a 7d 0a 0a 66 75 6e 63 74 | xes.map(i.=>.groups[i]).}..funct |
aa00 | 69 6f 6e 20 73 6f 72 74 4d 65 6e 75 49 74 65 6d 73 20 28 6d 65 6e 75 49 74 65 6d 73 29 20 7b 0a | ion.sortMenuItems.(menuItems).{. |
aa20 | 20 20 63 6f 6e 73 74 20 69 73 53 65 70 61 72 61 74 6f 72 20 3d 20 28 69 74 65 6d 29 20 3d 3e 20 | ..const.isSeparator.=.(item).=>. |
aa40 | 69 74 65 6d 2e 74 79 70 65 20 3d 3d 3d 20 27 73 65 70 61 72 61 74 6f 72 27 0a 20 20 63 6f 6e 73 | item.type.===.'separator'...cons |
aa60 | 74 20 73 65 70 61 72 61 74 6f 72 73 20 3d 20 6d 65 6e 75 49 74 65 6d 73 2e 66 69 6c 74 65 72 28 | t.separators.=.menuItems.filter( |
aa80 | 69 20 3d 3e 20 69 2e 74 79 70 65 20 3d 3d 3d 20 27 73 65 70 61 72 61 74 6f 72 27 29 0a 0a 20 20 | i.=>.i.type.===.'separator').... |
aaa0 | 2f 2f 20 53 70 6c 69 74 20 74 68 65 20 69 74 65 6d 73 20 69 6e 74 6f 20 74 68 65 69 72 20 69 6d | //.Split.the.items.into.their.im |
aac0 | 70 6c 69 63 69 74 20 67 72 6f 75 70 73 20 62 61 73 65 64 20 75 70 6f 6e 20 73 65 70 61 72 61 74 | plicit.groups.based.upon.separat |
aae0 | 6f 72 73 2e 0a 20 20 63 6f 6e 73 74 20 67 72 6f 75 70 73 20 3d 20 73 70 6c 69 74 41 72 72 61 79 | ors....const.groups.=.splitArray |
ab00 | 28 6d 65 6e 75 49 74 65 6d 73 2c 20 69 73 53 65 70 61 72 61 74 6f 72 29 0a 20 20 63 6f 6e 73 74 | (menuItems,.isSeparator)...const |
ab20 | 20 6d 65 72 67 65 64 47 72 6f 75 70 73 20 3d 20 6d 65 72 67 65 47 72 6f 75 70 73 28 67 72 6f 75 | .mergedGroups.=.mergeGroups(grou |
ab40 | 70 73 29 0a 20 20 63 6f 6e 73 74 20 6d 65 72 67 65 64 47 72 6f 75 70 73 57 69 74 68 53 6f 72 74 | ps)...const.mergedGroupsWithSort |
ab60 | 65 64 49 74 65 6d 73 20 3d 20 6d 65 72 67 65 64 47 72 6f 75 70 73 2e 6d 61 70 28 73 6f 72 74 49 | edItems.=.mergedGroups.map(sortI |
ab80 | 74 65 6d 73 49 6e 47 72 6f 75 70 29 0a 20 20 63 6f 6e 73 74 20 73 6f 72 74 65 64 47 72 6f 75 70 | temsInGroup)...const.sortedGroup |
aba0 | 73 20 3d 20 73 6f 72 74 47 72 6f 75 70 73 28 6d 65 72 67 65 64 47 72 6f 75 70 73 57 69 74 68 53 | s.=.sortGroups(mergedGroupsWithS |
abc0 | 6f 72 74 65 64 49 74 65 6d 73 29 0a 0a 20 20 63 6f 6e 73 74 20 6a 6f 69 6e 65 64 20 3d 20 6a 6f | ortedItems)....const.joined.=.jo |
abe0 | 69 6e 41 72 72 61 79 73 28 73 6f 72 74 65 64 47 72 6f 75 70 73 2c 20 73 65 70 61 72 61 74 6f 72 | inArrays(sortedGroups,.separator |
ac00 | 73 29 0a 20 20 72 65 74 75 72 6e 20 6a 6f 69 6e 65 64 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 | s)...return.joined.}..module.exp |
ac20 | 6f 72 74 73 20 3d 20 7b 20 73 6f 72 74 4d 65 6e 75 49 74 65 6d 73 20 7d 0a 27 75 73 65 20 73 74 | orts.=.{.sortMenuItems.}.'use.st |
ac40 | 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 54 6f 70 4c 65 76 65 6c 57 69 6e 64 6f 77 2c 20 4d | rict'..const.{.TopLevelWindow,.M |
ac60 | 65 6e 75 49 74 65 6d 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 7d 20 3d 20 72 65 71 75 69 72 65 | enuItem,.webContents.}.=.require |
ac80 | 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 7b 20 73 6f 72 74 4d 65 6e 75 49 74 65 | ('electron').const.{.sortMenuIte |
aca0 | 6d 73 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e | ms.}.=.require('@electron/intern |
acc0 | 61 6c 2f 62 72 6f 77 73 65 72 2f 61 70 69 2f 6d 65 6e 75 2d 75 74 69 6c 73 27 29 0a 63 6f 6e 73 | al/browser/api/menu-utils').cons |
ace0 | 74 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 | t.EventEmitter.=.require('events |
ad00 | 27 29 2e 45 76 65 6e 74 45 6d 69 74 74 65 72 0a 63 6f 6e 73 74 20 76 38 55 74 69 6c 20 3d 20 70 | ').EventEmitter.const.v8Util.=.p |
ad20 | 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 29 0a 63 6f | rocess.atomBinding('v8_util').co |
ad40 | 6e 73 74 20 62 69 6e 64 69 6e 67 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 | nst.bindings.=.process.atomBindi |
ad60 | 6e 67 28 27 6d 65 6e 75 27 29 0a 0a 63 6f 6e 73 74 20 7b 20 4d 65 6e 75 20 7d 20 3d 20 62 69 6e | ng('menu')..const.{.Menu.}.=.bin |
ad80 | 64 69 6e 67 73 0a 6c 65 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 20 3d 20 6e 75 6c 6c | dings.let.applicationMenu.=.null |
ada0 | 0a 6c 65 74 20 67 72 6f 75 70 49 64 49 6e 64 65 78 20 3d 20 30 0a 0a 4f 62 6a 65 63 74 2e 73 65 | .let.groupIdIndex.=.0..Object.se |
adc0 | 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 4d 65 6e 75 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 | tPrototypeOf(Menu.prototype,.Eve |
ade0 | 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 0a 2f 2f 20 4d 65 6e 75 20 44 65 | ntEmitter.prototype)..//.Menu.De |
ae00 | 6c 65 67 61 74 65 2e 0a 2f 2f 20 54 68 69 73 20 6f 62 6a 65 63 74 20 73 68 6f 75 6c 64 20 68 6f | legate..//.This.object.should.ho |
ae20 | 6c 64 20 6e 6f 20 72 65 66 65 72 65 6e 63 65 20 74 6f 20 7c 4d 65 6e 75 7c 20 74 6f 20 61 76 6f | ld.no.reference.to.|Menu|.to.avo |
ae40 | 69 64 20 63 79 63 6c 69 63 20 72 65 66 65 72 65 6e 63 65 2e 0a 63 6f 6e 73 74 20 64 65 6c 65 67 | id.cyclic.reference..const.deleg |
ae60 | 61 74 65 20 3d 20 7b 0a 20 20 69 73 43 6f 6d 6d 61 6e 64 49 64 43 68 65 63 6b 65 64 3a 20 28 6d | ate.=.{...isCommandIdChecked:.(m |
ae80 | 65 6e 75 2c 20 69 64 29 20 3d 3e 20 6d 65 6e 75 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 64 5d | enu,.id).=>.menu.commandsMap[id] |
aea0 | 20 3f 20 6d 65 6e 75 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 64 5d 2e 63 68 65 63 6b 65 64 20 | .?.menu.commandsMap[id].checked. |
aec0 | 3a 20 75 6e 64 65 66 69 6e 65 64 2c 0a 20 20 69 73 43 6f 6d 6d 61 6e 64 49 64 45 6e 61 62 6c 65 | :.undefined,...isCommandIdEnable |
aee0 | 64 3a 20 28 6d 65 6e 75 2c 20 69 64 29 20 3d 3e 20 6d 65 6e 75 2e 63 6f 6d 6d 61 6e 64 73 4d 61 | d:.(menu,.id).=>.menu.commandsMa |
af00 | 70 5b 69 64 5d 20 3f 20 6d 65 6e 75 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 64 5d 2e 65 6e 61 | p[id].?.menu.commandsMap[id].ena |
af20 | 62 6c 65 64 20 3a 20 75 6e 64 65 66 69 6e 65 64 2c 0a 20 20 69 73 43 6f 6d 6d 61 6e 64 49 64 56 | bled.:.undefined,...isCommandIdV |
af40 | 69 73 69 62 6c 65 3a 20 28 6d 65 6e 75 2c 20 69 64 29 20 3d 3e 20 6d 65 6e 75 2e 63 6f 6d 6d 61 | isible:.(menu,.id).=>.menu.comma |
af60 | 6e 64 73 4d 61 70 5b 69 64 5d 20 3f 20 6d 65 6e 75 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 64 | ndsMap[id].?.menu.commandsMap[id |
af80 | 5d 2e 76 69 73 69 62 6c 65 20 3a 20 75 6e 64 65 66 69 6e 65 64 2c 0a 20 20 67 65 74 41 63 63 65 | ].visible.:.undefined,...getAcce |
afa0 | 6c 65 72 61 74 6f 72 46 6f 72 43 6f 6d 6d 61 6e 64 49 64 3a 20 28 6d 65 6e 75 2c 20 69 64 2c 20 | leratorForCommandId:.(menu,.id,. |
afc0 | 75 73 65 44 65 66 61 75 6c 74 41 63 63 65 6c 65 72 61 74 6f 72 29 20 3d 3e 20 7b 0a 20 20 20 20 | useDefaultAccelerator).=>.{..... |
afe0 | 63 6f 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 6d 65 6e 75 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 | const.command.=.menu.commandsMap |
b000 | 5b 69 64 5d 0a 20 20 20 20 69 66 20 28 21 63 6f 6d 6d 61 6e 64 29 20 72 65 74 75 72 6e 0a 20 20 | [id].....if.(!command).return... |
b020 | 20 20 69 66 20 28 63 6f 6d 6d 61 6e 64 2e 61 63 63 65 6c 65 72 61 74 6f 72 20 21 3d 20 6e 75 6c | ..if.(command.accelerator.!=.nul |
b040 | 6c 29 20 72 65 74 75 72 6e 20 63 6f 6d 6d 61 6e 64 2e 61 63 63 65 6c 65 72 61 74 6f 72 0a 20 20 | l).return.command.accelerator... |
b060 | 20 20 69 66 20 28 75 73 65 44 65 66 61 75 6c 74 41 63 63 65 6c 65 72 61 74 6f 72 29 20 72 65 74 | ..if.(useDefaultAccelerator).ret |
b080 | 75 72 6e 20 63 6f 6d 6d 61 6e 64 2e 67 65 74 44 65 66 61 75 6c 74 52 6f 6c 65 41 63 63 65 6c 65 | urn.command.getDefaultRoleAccele |
b0a0 | 72 61 74 6f 72 28 29 0a 20 20 7d 2c 0a 20 20 73 68 6f 75 6c 64 52 65 67 69 73 74 65 72 41 63 63 | rator()...},...shouldRegisterAcc |
b0c0 | 65 6c 65 72 61 74 6f 72 46 6f 72 43 6f 6d 6d 61 6e 64 49 64 3a 20 28 6d 65 6e 75 2c 20 69 64 29 | eleratorForCommandId:.(menu,.id) |
b0e0 | 20 3d 3e 20 6d 65 6e 75 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 64 5d 20 3f 20 6d 65 6e 75 2e | .=>.menu.commandsMap[id].?.menu. |
b100 | 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 64 5d 2e 72 65 67 69 73 74 65 72 41 63 63 65 6c 65 72 61 | commandsMap[id].registerAccelera |
b120 | 74 6f 72 20 3a 20 75 6e 64 65 66 69 6e 65 64 2c 0a 20 20 65 78 65 63 75 74 65 43 6f 6d 6d 61 6e | tor.:.undefined,...executeComman |
b140 | 64 3a 20 28 6d 65 6e 75 2c 20 65 76 65 6e 74 2c 20 69 64 29 20 3d 3e 20 7b 0a 20 20 20 20 63 6f | d:.(menu,.event,.id).=>.{.....co |
b160 | 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 6d 65 6e 75 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 5b 69 | nst.command.=.menu.commandsMap[i |
b180 | 64 5d 0a 20 20 20 20 69 66 20 28 21 63 6f 6d 6d 61 6e 64 29 20 72 65 74 75 72 6e 0a 20 20 20 20 | d].....if.(!command).return..... |
b1a0 | 63 6f 6d 6d 61 6e 64 2e 63 6c 69 63 6b 28 65 76 65 6e 74 2c 20 54 6f 70 4c 65 76 65 6c 57 69 6e | command.click(event,.TopLevelWin |
b1c0 | 64 6f 77 2e 67 65 74 46 6f 63 75 73 65 64 57 69 6e 64 6f 77 28 29 2c 20 77 65 62 43 6f 6e 74 65 | dow.getFocusedWindow(),.webConte |
b1e0 | 6e 74 73 2e 67 65 74 46 6f 63 75 73 65 64 57 65 62 43 6f 6e 74 65 6e 74 73 28 29 29 0a 20 20 7d | nts.getFocusedWebContents())...} |
b200 | 2c 0a 20 20 6d 65 6e 75 57 69 6c 6c 53 68 6f 77 3a 20 28 6d 65 6e 75 29 20 3d 3e 20 7b 0a 20 20 | ,...menuWillShow:.(menu).=>.{... |
b220 | 20 20 2f 2f 20 45 6e 73 75 72 65 20 72 61 64 69 6f 20 67 72 6f 75 70 73 20 68 61 76 65 20 61 74 | ..//.Ensure.radio.groups.have.at |
b240 | 20 6c 65 61 73 74 20 6f 6e 65 20 6d 65 6e 75 20 69 74 65 6d 20 73 65 6c 65 74 65 64 0a 20 20 20 | .least.one.menu.item.seleted.... |
b260 | 20 66 6f 72 20 28 63 6f 6e 73 74 20 69 64 20 69 6e 20 6d 65 6e 75 2e 67 72 6f 75 70 73 4d 61 70 | .for.(const.id.in.menu.groupsMap |
b280 | 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 66 6f 75 6e 64 20 3d 20 6d 65 6e 75 2e 67 72 6f | ).{.......const.found.=.menu.gro |
b2a0 | 75 70 73 4d 61 70 5b 69 64 5d 2e 66 69 6e 64 28 69 74 65 6d 20 3d 3e 20 69 74 65 6d 2e 63 68 65 | upsMap[id].find(item.=>.item.che |
b2c0 | 63 6b 65 64 29 20 7c 7c 20 6e 75 6c 6c 0a 20 20 20 20 20 20 69 66 20 28 21 66 6f 75 6e 64 29 20 | cked).||.null.......if.(!found). |
b2e0 | 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 6d 65 6e 75 2e 67 72 6f 75 70 | v8Util.setHiddenValue(menu.group |
b300 | 73 4d 61 70 5b 69 64 5d 5b 30 5d 2c 20 27 63 68 65 63 6b 65 64 27 2c 20 74 72 75 65 29 0a 20 20 | sMap[id][0],.'checked',.true)... |
b320 | 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 2f 2a 20 49 6e 73 74 61 6e 63 65 20 4d 65 74 68 6f 64 73 20 2a | ..}...}.}../*.Instance.Methods.* |
b340 | 2f 0a 0a 4d 65 6e 75 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 69 6e 69 74 20 3d 20 66 75 6e 63 74 69 | /..Menu.prototype._init.=.functi |
b360 | 6f 6e 20 28 29 20 7b 0a 20 20 74 68 69 73 2e 63 6f 6d 6d 61 6e 64 73 4d 61 70 20 3d 20 7b 7d 0a | on.().{...this.commandsMap.=.{}. |
b380 | 20 20 74 68 69 73 2e 67 72 6f 75 70 73 4d 61 70 20 3d 20 7b 7d 0a 20 20 74 68 69 73 2e 69 74 65 | ..this.groupsMap.=.{}...this.ite |
b3a0 | 6d 73 20 3d 20 5b 5d 0a 20 20 74 68 69 73 2e 64 65 6c 65 67 61 74 65 20 3d 20 64 65 6c 65 67 61 | ms.=.[]...this.delegate.=.delega |
b3c0 | 74 65 0a 7d 0a 0a 4d 65 6e 75 2e 70 72 6f 74 6f 74 79 70 65 2e 70 6f 70 75 70 20 3d 20 66 75 6e | te.}..Menu.prototype.popup.=.fun |
b3e0 | 63 74 69 6f 6e 20 28 6f 70 74 69 6f 6e 73 20 3d 20 7b 7d 29 20 7b 0a 20 20 69 66 20 28 6f 70 74 | ction.(options.=.{}).{...if.(opt |
b400 | 69 6f 6e 73 20 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 74 79 70 65 6f 66 20 6f 70 74 69 6f 6e 73 20 21 | ions.==.null.||.typeof.options.! |
b420 | 3d 3d 20 27 6f 62 6a 65 63 74 27 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 | ==.'object').{.....throw.new.Typ |
b440 | 65 45 72 72 6f 72 28 27 4f 70 74 69 6f 6e 73 20 6d 75 73 74 20 62 65 20 61 6e 20 6f 62 6a 65 63 | eError('Options.must.be.an.objec |
b460 | 74 27 29 0a 20 20 7d 0a 20 20 6c 65 74 20 7b 20 77 69 6e 64 6f 77 2c 20 78 2c 20 79 2c 20 70 6f | t')...}...let.{.window,.x,.y,.po |
b480 | 73 69 74 69 6f 6e 69 6e 67 49 74 65 6d 2c 20 63 61 6c 6c 62 61 63 6b 20 7d 20 3d 20 6f 70 74 69 | sitioningItem,.callback.}.=.opti |
b4a0 | 6f 6e 73 0a 0a 20 20 2f 2f 20 6e 6f 20 63 61 6c 6c 62 61 63 6b 20 70 61 73 73 65 64 0a 20 20 69 | ons....//.no.callback.passed...i |
b4c0 | 66 20 28 21 63 61 6c 6c 62 61 63 6b 20 7c 7c 20 74 79 70 65 6f 66 20 63 61 6c 6c 62 61 63 6b 20 | f.(!callback.||.typeof.callback. |
b4e0 | 21 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 63 61 6c 6c 62 61 63 6b 20 3d 20 28 29 20 3d 3e | !==.'function').callback.=.().=> |
b500 | 20 7b 7d 0a 0a 20 20 2f 2f 20 73 65 74 20 64 65 66 61 75 6c 74 73 0a 20 20 69 66 20 28 74 79 70 | .{}....//.set.defaults...if.(typ |
b520 | 65 6f 66 20 78 20 21 3d 3d 20 27 6e 75 6d 62 65 72 27 29 20 78 20 3d 20 2d 31 0a 20 20 69 66 20 | eof.x.!==.'number').x.=.-1...if. |
b540 | 28 74 79 70 65 6f 66 20 79 20 21 3d 3d 20 27 6e 75 6d 62 65 72 27 29 20 79 20 3d 20 2d 31 0a 20 | (typeof.y.!==.'number').y.=.-1.. |
b560 | 20 69 66 20 28 74 79 70 65 6f 66 20 70 6f 73 69 74 69 6f 6e 69 6e 67 49 74 65 6d 20 21 3d 3d 20 | .if.(typeof.positioningItem.!==. |
b580 | 27 6e 75 6d 62 65 72 27 29 20 70 6f 73 69 74 69 6f 6e 69 6e 67 49 74 65 6d 20 3d 20 2d 31 0a 0a | 'number').positioningItem.=.-1.. |
b5a0 | 20 20 2f 2f 20 66 69 6e 64 20 77 68 69 63 68 20 77 69 6e 64 6f 77 20 74 6f 20 75 73 65 0a 20 20 | ..//.find.which.window.to.use... |
b5c0 | 63 6f 6e 73 74 20 77 69 6e 73 20 3d 20 54 6f 70 4c 65 76 65 6c 57 69 6e 64 6f 77 2e 67 65 74 41 | const.wins.=.TopLevelWindow.getA |
b5e0 | 6c 6c 57 69 6e 64 6f 77 73 28 29 0a 20 20 69 66 20 28 21 77 69 6e 73 20 7c 7c 20 77 69 6e 73 2e | llWindows()...if.(!wins.||.wins. |
b600 | 69 6e 64 65 78 4f 66 28 77 69 6e 64 6f 77 29 20 3d 3d 3d 20 2d 31 29 20 7b 0a 20 20 20 20 77 69 | indexOf(window).===.-1).{.....wi |
b620 | 6e 64 6f 77 20 3d 20 54 6f 70 4c 65 76 65 6c 57 69 6e 64 6f 77 2e 67 65 74 46 6f 63 75 73 65 64 | ndow.=.TopLevelWindow.getFocused |
b640 | 57 69 6e 64 6f 77 28 29 0a 20 20 20 20 69 66 20 28 21 77 69 6e 64 6f 77 20 26 26 20 77 69 6e 73 | Window().....if.(!window.&&.wins |
b660 | 20 26 26 20 77 69 6e 73 2e 6c 65 6e 67 74 68 20 3e 20 30 29 20 7b 0a 20 20 20 20 20 20 77 69 6e | .&&.wins.length.>.0).{.......win |
b680 | 64 6f 77 20 3d 20 77 69 6e 73 5b 30 5d 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 28 21 77 69 6e | dow.=.wins[0].....}.....if.(!win |
b6a0 | 64 6f 77 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 60 43 61 | dow).{.......throw.new.Error(`Ca |
b6c0 | 6e 6e 6f 74 20 6f 70 65 6e 20 4d 65 6e 75 20 77 69 74 68 6f 75 74 20 61 20 54 6f 70 4c 65 76 65 | nnot.open.Menu.without.a.TopLeve |
b6e0 | 6c 57 69 6e 64 6f 77 20 70 72 65 73 65 6e 74 60 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 74 | lWindow.present`).....}...}....t |
b700 | 68 69 73 2e 70 6f 70 75 70 41 74 28 77 69 6e 64 6f 77 2c 20 78 2c 20 79 2c 20 70 6f 73 69 74 69 | his.popupAt(window,.x,.y,.positi |
b720 | 6f 6e 69 6e 67 49 74 65 6d 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 72 65 74 75 72 6e 20 7b 20 | oningItem,.callback)...return.{. |
b740 | 62 72 6f 77 73 65 72 57 69 6e 64 6f 77 3a 20 77 69 6e 64 6f 77 2c 20 78 2c 20 79 2c 20 70 6f 73 | browserWindow:.window,.x,.y,.pos |
b760 | 69 74 69 6f 6e 3a 20 70 6f 73 69 74 69 6f 6e 69 6e 67 49 74 65 6d 20 7d 0a 7d 0a 0a 4d 65 6e 75 | ition:.positioningItem.}.}..Menu |
b780 | 2e 70 72 6f 74 6f 74 79 70 65 2e 63 6c 6f 73 65 50 6f 70 75 70 20 3d 20 66 75 6e 63 74 69 6f 6e | .prototype.closePopup.=.function |
b7a0 | 20 28 77 69 6e 64 6f 77 29 20 7b 0a 20 20 69 66 20 28 77 69 6e 64 6f 77 20 69 6e 73 74 61 6e 63 | .(window).{...if.(window.instanc |
b7c0 | 65 6f 66 20 54 6f 70 4c 65 76 65 6c 57 69 6e 64 6f 77 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 63 | eof.TopLevelWindow).{.....this.c |
b7e0 | 6c 6f 73 65 50 6f 70 75 70 41 74 28 77 69 6e 64 6f 77 2e 69 64 29 0a 20 20 7d 20 65 6c 73 65 20 | losePopupAt(window.id)...}.else. |
b800 | 7b 0a 20 20 20 20 2f 2f 20 50 61 73 73 69 6e 67 20 2d 31 20 28 69 6e 76 61 6c 69 64 29 20 77 6f | {.....//.Passing.-1.(invalid).wo |
b820 | 75 6c 64 20 6d 61 6b 65 20 63 6c 6f 73 65 50 6f 70 75 70 41 74 20 63 6c 6f 73 65 20 74 68 65 20 | uld.make.closePopupAt.close.the. |
b840 | 61 6c 6c 20 6d 65 6e 75 20 72 75 6e 6e 65 72 73 0a 20 20 20 20 2f 2f 20 62 65 6c 6f 6e 67 20 74 | all.menu.runners.....//.belong.t |
b860 | 6f 20 74 68 69 73 20 6d 65 6e 75 2e 0a 20 20 20 20 74 68 69 73 2e 63 6c 6f 73 65 50 6f 70 75 70 | o.this.menu......this.closePopup |
b880 | 41 74 28 2d 31 29 0a 20 20 7d 0a 7d 0a 0a 4d 65 6e 75 2e 70 72 6f 74 6f 74 79 70 65 2e 67 65 74 | At(-1)...}.}..Menu.prototype.get |
b8a0 | 4d 65 6e 75 49 74 65 6d 42 79 49 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 69 64 29 20 7b 0a 20 | MenuItemById.=.function.(id).{.. |
b8c0 | 20 63 6f 6e 73 74 20 69 74 65 6d 73 20 3d 20 74 68 69 73 2e 69 74 65 6d 73 0a 0a 20 20 6c 65 74 | .const.items.=.this.items....let |
b8e0 | 20 66 6f 75 6e 64 20 3d 20 69 74 65 6d 73 2e 66 69 6e 64 28 69 74 65 6d 20 3d 3e 20 69 74 65 6d | .found.=.items.find(item.=>.item |
b900 | 2e 69 64 20 3d 3d 3d 20 69 64 29 20 7c 7c 20 6e 75 6c 6c 0a 20 20 66 6f 72 20 28 6c 65 74 20 69 | .id.===.id).||.null...for.(let.i |
b920 | 20 3d 20 30 3b 20 21 66 6f 75 6e 64 20 26 26 20 69 20 3c 20 69 74 65 6d 73 2e 6c 65 6e 67 74 68 | .=.0;.!found.&&.i.<.items.length |
b940 | 3b 20 69 2b 2b 29 20 7b 0a 20 20 20 20 69 66 20 28 69 74 65 6d 73 5b 69 5d 2e 73 75 62 6d 65 6e | ;.i++).{.....if.(items[i].submen |
b960 | 75 29 20 7b 0a 20 20 20 20 20 20 66 6f 75 6e 64 20 3d 20 69 74 65 6d 73 5b 69 5d 2e 73 75 62 6d | u).{.......found.=.items[i].subm |
b980 | 65 6e 75 2e 67 65 74 4d 65 6e 75 49 74 65 6d 42 79 49 64 28 69 64 29 0a 20 20 20 20 7d 0a 20 20 | enu.getMenuItemById(id).....}... |
b9a0 | 7d 0a 20 20 72 65 74 75 72 6e 20 66 6f 75 6e 64 0a 7d 0a 0a 4d 65 6e 75 2e 70 72 6f 74 6f 74 79 | }...return.found.}..Menu.prototy |
b9c0 | 70 65 2e 61 70 70 65 6e 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 69 74 65 6d 29 20 7b 0a 20 20 | pe.append.=.function.(item).{... |
b9e0 | 72 65 74 75 72 6e 20 74 68 69 73 2e 69 6e 73 65 72 74 28 74 68 69 73 2e 67 65 74 49 74 65 6d 43 | return.this.insert(this.getItemC |
ba00 | 6f 75 6e 74 28 29 2c 20 69 74 65 6d 29 0a 7d 0a 0a 4d 65 6e 75 2e 70 72 6f 74 6f 74 79 70 65 2e | ount(),.item).}..Menu.prototype. |
ba20 | 69 6e 73 65 72 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 70 6f 73 2c 20 69 74 65 6d 29 20 7b 0a | insert.=.function.(pos,.item).{. |
ba40 | 20 20 69 66 20 28 28 69 74 65 6d 20 3f 20 69 74 65 6d 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 3a | ..if.((item.?.item.constructor.: |
ba60 | 20 76 6f 69 64 20 30 29 20 21 3d 3d 20 4d 65 6e 75 49 74 65 6d 29 20 7b 0a 20 20 20 20 74 68 72 | .void.0).!==.MenuItem).{.....thr |
ba80 | 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 49 6e 76 61 6c 69 64 20 69 74 65 6d 27 29 | ow.new.TypeError('Invalid.item') |
baa0 | 0a 20 20 7d 0a 0a 20 20 69 66 20 28 70 6f 73 20 3c 20 30 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 | ...}....if.(pos.<.0).{.....throw |
bac0 | 20 6e 65 77 20 52 61 6e 67 65 45 72 72 6f 72 28 60 50 6f 73 69 74 69 6f 6e 20 24 7b 70 6f 73 7d | .new.RangeError(`Position.${pos} |
bae0 | 20 63 61 6e 6e 6f 74 20 62 65 20 6c 65 73 73 20 74 68 61 6e 20 30 60 29 0a 20 20 7d 20 65 6c 73 | .cannot.be.less.than.0`)...}.els |
bb00 | 65 20 69 66 20 28 70 6f 73 20 3e 20 74 68 69 73 2e 67 65 74 49 74 65 6d 43 6f 75 6e 74 28 29 29 | e.if.(pos.>.this.getItemCount()) |
bb20 | 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 52 61 6e 67 65 45 72 72 6f 72 28 60 50 6f 73 | .{.....throw.new.RangeError(`Pos |
bb40 | 69 74 69 6f 6e 20 24 7b 70 6f 73 7d 20 63 61 6e 6e 6f 74 20 62 65 20 67 72 65 61 74 65 72 20 74 | ition.${pos}.cannot.be.greater.t |
bb60 | 68 61 6e 20 74 68 65 20 74 6f 74 61 6c 20 4d 65 6e 75 49 74 65 6d 20 63 6f 75 6e 74 60 29 0a 20 | han.the.total.MenuItem.count`).. |
bb80 | 20 7d 0a 0a 20 20 2f 2f 20 69 6e 73 65 72 74 20 69 74 65 6d 20 64 65 70 65 6e 64 69 6e 67 20 6f | .}....//.insert.item.depending.o |
bba0 | 6e 20 69 74 73 20 74 79 70 65 0a 20 20 69 6e 73 65 72 74 49 74 65 6d 42 79 54 79 70 65 2e 63 61 | n.its.type...insertItemByType.ca |
bbc0 | 6c 6c 28 74 68 69 73 2c 20 69 74 65 6d 2c 20 70 6f 73 29 0a 0a 20 20 2f 2f 20 73 65 74 20 69 74 | ll(this,.item,.pos)....//.set.it |
bbe0 | 65 6d 20 70 72 6f 70 65 72 74 69 65 73 0a 20 20 69 66 20 28 69 74 65 6d 2e 73 75 62 6c 61 62 65 | em.properties...if.(item.sublabe |
bc00 | 6c 29 20 74 68 69 73 2e 73 65 74 53 75 62 6c 61 62 65 6c 28 70 6f 73 2c 20 69 74 65 6d 2e 73 75 | l).this.setSublabel(pos,.item.su |
bc20 | 62 6c 61 62 65 6c 29 0a 20 20 69 66 20 28 69 74 65 6d 2e 69 63 6f 6e 29 20 74 68 69 73 2e 73 65 | blabel)...if.(item.icon).this.se |
bc40 | 74 49 63 6f 6e 28 70 6f 73 2c 20 69 74 65 6d 2e 69 63 6f 6e 29 0a 20 20 69 66 20 28 69 74 65 6d | tIcon(pos,.item.icon)...if.(item |
bc60 | 2e 72 6f 6c 65 29 20 74 68 69 73 2e 73 65 74 52 6f 6c 65 28 70 6f 73 2c 20 69 74 65 6d 2e 72 6f | .role).this.setRole(pos,.item.ro |
bc80 | 6c 65 29 0a 0a 20 20 2f 2f 20 4d 61 6b 65 20 6d 65 6e 75 20 61 63 63 65 73 73 61 62 6c 65 20 74 | le)....//.Make.menu.accessable.t |
bca0 | 6f 20 69 74 65 6d 73 2e 0a 20 20 69 74 65 6d 2e 6f 76 65 72 72 69 64 65 52 65 61 64 4f 6e 6c 79 | o.items....item.overrideReadOnly |
bcc0 | 50 72 6f 70 65 72 74 79 28 27 6d 65 6e 75 27 2c 20 74 68 69 73 29 0a 0a 20 20 2f 2f 20 52 65 6d | Property('menu',.this)....//.Rem |
bce0 | 65 6d 62 65 72 20 74 68 65 20 69 74 65 6d 73 2e 0a 20 20 74 68 69 73 2e 69 74 65 6d 73 2e 73 70 | ember.the.items....this.items.sp |
bd00 | 6c 69 63 65 28 70 6f 73 2c 20 30 2c 20 69 74 65 6d 29 0a 20 20 74 68 69 73 2e 63 6f 6d 6d 61 6e | lice(pos,.0,.item)...this.comman |
bd20 | 64 73 4d 61 70 5b 69 74 65 6d 2e 63 6f 6d 6d 61 6e 64 49 64 5d 20 3d 20 69 74 65 6d 0a 7d 0a 0a | dsMap[item.commandId].=.item.}.. |
bd40 | 4d 65 6e 75 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 63 61 6c 6c 4d 65 6e 75 57 69 6c 6c 53 68 6f 77 | Menu.prototype._callMenuWillShow |
bd60 | 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 69 66 20 28 74 68 69 73 2e 64 65 6c 65 | .=.function.().{...if.(this.dele |
bd80 | 67 61 74 65 29 20 74 68 69 73 2e 64 65 6c 65 67 61 74 65 2e 6d 65 6e 75 57 69 6c 6c 53 68 6f 77 | gate).this.delegate.menuWillShow |
bda0 | 28 74 68 69 73 29 0a 20 20 74 68 69 73 2e 69 74 65 6d 73 2e 66 6f 72 45 61 63 68 28 69 74 65 6d | (this)...this.items.forEach(item |
bdc0 | 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 69 74 65 6d 2e 73 75 62 6d 65 6e 75 29 20 69 74 65 6d | .=>.{.....if.(item.submenu).item |
bde0 | 2e 73 75 62 6d 65 6e 75 2e 5f 63 61 6c 6c 4d 65 6e 75 57 69 6c 6c 53 68 6f 77 28 29 0a 20 20 7d | .submenu._callMenuWillShow()...} |
be00 | 29 0a 7d 0a 0a 2f 2a 20 53 74 61 74 69 63 20 4d 65 74 68 6f 64 73 20 2a 2f 0a 0a 4d 65 6e 75 2e | ).}../*.Static.Methods.*/..Menu. |
be20 | 67 65 74 41 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 20 3d 20 28 29 20 3d 3e 20 61 70 70 6c 69 | getApplicationMenu.=.().=>.appli |
be40 | 63 61 74 69 6f 6e 4d 65 6e 75 0a 0a 4d 65 6e 75 2e 73 65 6e 64 41 63 74 69 6f 6e 54 6f 46 69 72 | cationMenu..Menu.sendActionToFir |
be60 | 73 74 52 65 73 70 6f 6e 64 65 72 20 3d 20 62 69 6e 64 69 6e 67 73 2e 73 65 6e 64 41 63 74 69 6f | stResponder.=.bindings.sendActio |
be80 | 6e 54 6f 46 69 72 73 74 52 65 73 70 6f 6e 64 65 72 0a 0a 2f 2f 20 73 65 74 20 61 70 70 6c 69 63 | nToFirstResponder..//.set.applic |
bea0 | 61 74 69 6f 6e 20 6d 65 6e 75 20 77 69 74 68 20 61 20 70 72 65 65 78 69 73 74 69 6e 67 20 6d 65 | ation.menu.with.a.preexisting.me |
bec0 | 6e 75 0a 4d 65 6e 75 2e 73 65 74 41 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 20 3d 20 66 75 6e | nu.Menu.setApplicationMenu.=.fun |
bee0 | 63 74 69 6f 6e 20 28 6d 65 6e 75 29 20 7b 0a 20 20 69 66 20 28 6d 65 6e 75 20 26 26 20 6d 65 6e | ction.(menu).{...if.(menu.&&.men |
bf00 | 75 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 21 3d 3d 20 4d 65 6e 75 29 20 7b 0a 20 20 20 20 74 68 | u.constructor.!==.Menu).{.....th |
bf20 | 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 49 6e 76 61 6c 69 64 20 6d 65 6e 75 27 | row.new.TypeError('Invalid.menu' |
bf40 | 29 0a 20 20 7d 0a 0a 20 20 61 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 20 3d 20 6d 65 6e 75 0a | )...}....applicationMenu.=.menu. |
bf60 | 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 64 61 72 77 | ..if.(process.platform.===.'darw |
bf80 | 69 6e 27 29 20 7b 0a 20 20 20 20 69 66 20 28 21 6d 65 6e 75 29 20 72 65 74 75 72 6e 0a 20 20 20 | in').{.....if.(!menu).return.... |
bfa0 | 20 6d 65 6e 75 2e 5f 63 61 6c 6c 4d 65 6e 75 57 69 6c 6c 53 68 6f 77 28 29 0a 20 20 20 20 62 69 | .menu._callMenuWillShow().....bi |
bfc0 | 6e 64 69 6e 67 73 2e 73 65 74 41 70 70 6c 69 63 61 74 69 6f 6e 4d 65 6e 75 28 6d 65 6e 75 29 0a | ndings.setApplicationMenu(menu). |
bfe0 | 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 77 69 6e 64 6f 77 73 20 3d 20 54 | ..}.else.{.....const.windows.=.T |
c000 | 6f 70 4c 65 76 65 6c 57 69 6e 64 6f 77 2e 67 65 74 41 6c 6c 57 69 6e 64 6f 77 73 28 29 0a 20 20 | opLevelWindow.getAllWindows()... |
c020 | 20 20 72 65 74 75 72 6e 20 77 69 6e 64 6f 77 73 2e 6d 61 70 28 77 20 3d 3e 20 77 2e 73 65 74 4d | ..return.windows.map(w.=>.w.setM |
c040 | 65 6e 75 28 6d 65 6e 75 29 29 0a 20 20 7d 0a 7d 0a 0a 4d 65 6e 75 2e 62 75 69 6c 64 46 72 6f 6d | enu(menu))...}.}..Menu.buildFrom |
c060 | 54 65 6d 70 6c 61 74 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 74 65 6d 70 6c 61 74 65 29 20 7b | Template.=.function.(template).{ |
c080 | 0a 20 20 69 66 20 28 21 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 74 65 6d 70 6c 61 74 65 29 29 | ...if.(!Array.isArray(template)) |
c0a0 | 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 49 6e 76 61 | .{.....throw.new.TypeError('Inva |
c0c0 | 6c 69 64 20 74 65 6d 70 6c 61 74 65 20 66 6f 72 20 4d 65 6e 75 3a 20 4d 65 6e 75 20 74 65 6d 70 | lid.template.for.Menu:.Menu.temp |
c0e0 | 6c 61 74 65 20 6d 75 73 74 20 62 65 20 61 6e 20 61 72 72 61 79 27 29 0a 20 20 7d 0a 20 20 63 6f | late.must.be.an.array')...}...co |
c100 | 6e 73 74 20 6d 65 6e 75 20 3d 20 6e 65 77 20 4d 65 6e 75 28 29 0a 20 20 69 66 20 28 21 61 72 65 | nst.menu.=.new.Menu()...if.(!are |
c120 | 56 61 6c 69 64 54 65 6d 70 6c 61 74 65 49 74 65 6d 73 28 74 65 6d 70 6c 61 74 65 29 29 20 7b 0a | ValidTemplateItems(template)).{. |
c140 | 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 49 6e 76 61 6c 69 64 | ....throw.new.TypeError('Invalid |
c160 | 20 74 65 6d 70 6c 61 74 65 20 66 6f 72 20 4d 65 6e 75 49 74 65 6d 3a 20 6d 75 73 74 20 68 61 76 | .template.for.MenuItem:.must.hav |
c180 | 65 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 20 6f 66 20 6c 61 62 65 6c 2c 20 72 6f 6c 65 20 6f 72 | e.at.least.one.of.label,.role.or |
c1a0 | 20 74 79 70 65 27 29 0a 20 20 7d 0a 20 20 63 6f 6e 73 74 20 66 69 6c 74 65 72 65 64 20 3d 20 72 | .type')...}...const.filtered.=.r |
c1c0 | 65 6d 6f 76 65 45 78 74 72 61 53 65 70 61 72 61 74 6f 72 73 28 74 65 6d 70 6c 61 74 65 29 0a 20 | emoveExtraSeparators(template).. |
c1e0 | 20 63 6f 6e 73 74 20 73 6f 72 74 65 64 20 3d 20 73 6f 72 74 54 65 6d 70 6c 61 74 65 28 66 69 6c | .const.sorted.=.sortTemplate(fil |
c200 | 74 65 72 65 64 29 0a 0a 20 20 73 6f 72 74 65 64 2e 66 6f 72 45 61 63 68 28 28 69 74 65 6d 29 20 | tered)....sorted.forEach((item). |
c220 | 3d 3e 20 6d 65 6e 75 2e 61 70 70 65 6e 64 28 6e 65 77 20 4d 65 6e 75 49 74 65 6d 28 69 74 65 6d | =>.menu.append(new.MenuItem(item |
c240 | 29 29 29 0a 0a 20 20 72 65 74 75 72 6e 20 6d 65 6e 75 0a 7d 0a 0a 2f 2a 20 48 65 6c 70 65 72 20 | )))....return.menu.}../*.Helper. |
c260 | 46 75 6e 63 74 69 6f 6e 73 20 2a 2f 0a 0a 2f 2f 20 76 61 6c 69 64 61 74 65 20 74 68 65 20 74 65 | Functions.*/..//.validate.the.te |
c280 | 6d 70 6c 61 74 65 20 61 67 61 69 6e 73 74 20 68 61 76 69 6e 67 20 74 68 65 20 77 72 6f 6e 67 20 | mplate.against.having.the.wrong. |
c2a0 | 61 74 74 72 69 62 75 74 65 0a 66 75 6e 63 74 69 6f 6e 20 61 72 65 56 61 6c 69 64 54 65 6d 70 6c | attribute.function.areValidTempl |
c2c0 | 61 74 65 49 74 65 6d 73 20 28 74 65 6d 70 6c 61 74 65 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 74 | ateItems.(template).{...return.t |
c2e0 | 65 6d 70 6c 61 74 65 2e 65 76 65 72 79 28 69 74 65 6d 20 3d 3e 0a 20 20 20 20 69 74 65 6d 20 21 | emplate.every(item.=>.....item.! |
c300 | 3d 20 6e 75 6c 6c 20 26 26 20 74 79 70 65 6f 66 20 69 74 65 6d 20 3d 3d 3d 20 27 6f 62 6a 65 63 | =.null.&&.typeof.item.===.'objec |
c320 | 74 27 20 26 26 20 28 69 74 65 6d 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 27 6c 61 62 65 | t'.&&.(item.hasOwnProperty('labe |
c340 | 6c 27 29 20 7c 7c 20 69 74 65 6d 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 27 72 6f 6c 65 | l').||.item.hasOwnProperty('role |
c360 | 27 29 20 7c 7c 20 69 74 65 6d 2e 74 79 70 65 20 3d 3d 3d 20 27 73 65 70 61 72 61 74 6f 72 27 29 | ').||.item.type.===.'separator') |
c380 | 29 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 73 6f 72 74 54 65 6d 70 6c 61 74 65 20 28 74 65 6d 70 | ).}..function.sortTemplate.(temp |
c3a0 | 6c 61 74 65 29 20 7b 0a 20 20 63 6f 6e 73 74 20 73 6f 72 74 65 64 20 3d 20 73 6f 72 74 4d 65 6e | late).{...const.sorted.=.sortMen |
c3c0 | 75 49 74 65 6d 73 28 74 65 6d 70 6c 61 74 65 29 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 69 64 | uItems(template)...for.(const.id |
c3e0 | 20 69 6e 20 73 6f 72 74 65 64 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 69 74 65 6d 20 3d 20 73 | .in.sorted).{.....const.item.=.s |
c400 | 6f 72 74 65 64 5b 69 64 5d 0a 20 20 20 20 69 66 20 28 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 | orted[id].....if.(Array.isArray( |
c420 | 69 74 65 6d 2e 73 75 62 6d 65 6e 75 29 29 20 7b 0a 20 20 20 20 20 20 69 74 65 6d 2e 73 75 62 6d | item.submenu)).{.......item.subm |
c440 | 65 6e 75 20 3d 20 73 6f 72 74 54 65 6d 70 6c 61 74 65 28 69 74 65 6d 2e 73 75 62 6d 65 6e 75 29 | enu.=.sortTemplate(item.submenu) |
c460 | 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 73 6f 72 74 65 64 0a 7d 0a 0a 2f 2f | .....}...}...return.sorted.}..// |
c480 | 20 53 65 61 72 63 68 20 62 65 74 77 65 65 6e 20 73 65 70 61 72 61 74 6f 72 73 20 74 6f 20 66 69 | .Search.between.separators.to.fi |
c4a0 | 6e 64 20 61 20 72 61 64 69 6f 20 6d 65 6e 75 20 69 74 65 6d 20 61 6e 64 20 72 65 74 75 72 6e 20 | nd.a.radio.menu.item.and.return. |
c4c0 | 69 74 73 20 67 72 6f 75 70 20 69 64 0a 66 75 6e 63 74 69 6f 6e 20 67 65 6e 65 72 61 74 65 47 72 | its.group.id.function.generateGr |
c4e0 | 6f 75 70 49 64 20 28 69 74 65 6d 73 2c 20 70 6f 73 29 20 7b 0a 20 20 69 66 20 28 70 6f 73 20 3e | oupId.(items,.pos).{...if.(pos.> |
c500 | 20 30 29 20 7b 0a 20 20 20 20 66 6f 72 20 28 6c 65 74 20 69 64 78 20 3d 20 70 6f 73 20 2d 20 31 | .0).{.....for.(let.idx.=.pos.-.1 |
c520 | 3b 20 69 64 78 20 3e 3d 20 30 3b 20 69 64 78 2d 2d 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 69 | ;.idx.>=.0;.idx--).{.......if.(i |
c540 | 74 65 6d 73 5b 69 64 78 5d 2e 74 79 70 65 20 3d 3d 3d 20 27 72 61 64 69 6f 27 29 20 72 65 74 75 | tems[idx].type.===.'radio').retu |
c560 | 72 6e 20 69 74 65 6d 73 5b 69 64 78 5d 2e 67 72 6f 75 70 49 64 0a 20 20 20 20 20 20 69 66 20 28 | rn.items[idx].groupId.......if.( |
c580 | 69 74 65 6d 73 5b 69 64 78 5d 2e 74 79 70 65 20 3d 3d 3d 20 27 73 65 70 61 72 61 74 6f 72 27 29 | items[idx].type.===.'separator') |
c5a0 | 20 62 72 65 61 6b 0a 20 20 20 20 7d 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 70 6f 73 20 3c 20 | .break.....}...}.else.if.(pos.<. |
c5c0 | 69 74 65 6d 73 2e 6c 65 6e 67 74 68 29 20 7b 0a 20 20 20 20 66 6f 72 20 28 6c 65 74 20 69 64 78 | items.length).{.....for.(let.idx |
c5e0 | 20 3d 20 70 6f 73 3b 20 69 64 78 20 3c 3d 20 69 74 65 6d 73 2e 6c 65 6e 67 74 68 20 2d 20 31 3b | .=.pos;.idx.<=.items.length.-.1; |
c600 | 20 69 64 78 2b 2b 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 69 74 65 6d 73 5b 69 64 78 5d 2e 74 | .idx++).{.......if.(items[idx].t |
c620 | 79 70 65 20 3d 3d 3d 20 27 72 61 64 69 6f 27 29 20 72 65 74 75 72 6e 20 69 74 65 6d 73 5b 69 64 | ype.===.'radio').return.items[id |
c640 | 78 5d 2e 67 72 6f 75 70 49 64 0a 20 20 20 20 20 20 69 66 20 28 69 74 65 6d 73 5b 69 64 78 5d 2e | x].groupId.......if.(items[idx]. |
c660 | 74 79 70 65 20 3d 3d 3d 20 27 73 65 70 61 72 61 74 6f 72 27 29 20 62 72 65 61 6b 0a 20 20 20 20 | type.===.'separator').break..... |
c680 | 7d 0a 20 20 7d 0a 20 20 67 72 6f 75 70 49 64 49 6e 64 65 78 20 2b 3d 20 31 0a 20 20 72 65 74 75 | }...}...groupIdIndex.+=.1...retu |
c6a0 | 72 6e 20 67 72 6f 75 70 49 64 49 6e 64 65 78 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 72 65 6d 6f | rn.groupIdIndex.}..function.remo |
c6c0 | 76 65 45 78 74 72 61 53 65 70 61 72 61 74 6f 72 73 20 28 69 74 65 6d 73 29 20 7b 0a 20 20 2f 2f | veExtraSeparators.(items).{...// |
c6e0 | 20 66 6f 6c 64 20 61 64 6a 61 63 65 6e 74 20 73 65 70 61 72 61 74 6f 72 73 20 74 6f 67 65 74 68 | .fold.adjacent.separators.togeth |
c700 | 65 72 0a 20 20 6c 65 74 20 72 65 74 20 3d 20 69 74 65 6d 73 2e 66 69 6c 74 65 72 28 28 65 2c 20 | er...let.ret.=.items.filter((e,. |
c720 | 69 64 78 2c 20 61 72 72 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 65 2e 76 69 73 69 62 6c 65 | idx,.arr).=>.{.....if.(e.visible |
c740 | 20 3d 3d 3d 20 66 61 6c 73 65 29 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 20 20 72 65 74 75 | .===.false).return.true.....retu |
c760 | 72 6e 20 65 2e 74 79 70 65 20 21 3d 3d 20 27 73 65 70 61 72 61 74 6f 72 27 20 7c 7c 20 69 64 78 | rn.e.type.!==.'separator'.||.idx |
c780 | 20 3d 3d 3d 20 30 20 7c 7c 20 61 72 72 5b 69 64 78 20 2d 20 31 5d 2e 74 79 70 65 20 21 3d 3d 20 | .===.0.||.arr[idx.-.1].type.!==. |
c7a0 | 27 73 65 70 61 72 61 74 6f 72 27 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 72 65 6d 6f 76 65 20 65 64 | 'separator'...})....//.remove.ed |
c7c0 | 67 65 20 73 65 70 61 72 61 74 6f 72 73 0a 20 20 72 65 74 20 3d 20 72 65 74 2e 66 69 6c 74 65 72 | ge.separators...ret.=.ret.filter |
c7e0 | 28 28 65 2c 20 69 64 78 2c 20 61 72 72 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 65 2e 76 69 | ((e,.idx,.arr).=>.{.....if.(e.vi |
c800 | 73 69 62 6c 65 20 3d 3d 3d 20 66 61 6c 73 65 29 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 20 | sible.===.false).return.true.... |
c820 | 20 72 65 74 75 72 6e 20 65 2e 74 79 70 65 20 21 3d 3d 20 27 73 65 70 61 72 61 74 6f 72 27 20 7c | .return.e.type.!==.'separator'.| |
c840 | 7c 20 28 69 64 78 20 21 3d 3d 20 30 20 26 26 20 69 64 78 20 21 3d 3d 20 61 72 72 2e 6c 65 6e 67 | |.(idx.!==.0.&&.idx.!==.arr.leng |
c860 | 74 68 20 2d 20 31 29 0a 20 20 7d 29 0a 0a 20 20 72 65 74 75 72 6e 20 72 65 74 0a 7d 0a 0a 66 75 | th.-.1)...})....return.ret.}..fu |
c880 | 6e 63 74 69 6f 6e 20 69 6e 73 65 72 74 49 74 65 6d 42 79 54 79 70 65 20 28 69 74 65 6d 2c 20 70 | nction.insertItemByType.(item,.p |
c8a0 | 6f 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 74 79 70 65 73 20 3d 20 7b 0a 20 20 20 20 6e 6f 72 6d | os).{...const.types.=.{.....norm |
c8c0 | 61 6c 3a 20 28 29 20 3d 3e 20 74 68 69 73 2e 69 6e 73 65 72 74 49 74 65 6d 28 70 6f 73 2c 20 69 | al:.().=>.this.insertItem(pos,.i |
c8e0 | 74 65 6d 2e 63 6f 6d 6d 61 6e 64 49 64 2c 20 69 74 65 6d 2e 6c 61 62 65 6c 29 2c 0a 20 20 20 20 | tem.commandId,.item.label),..... |
c900 | 63 68 65 63 6b 62 6f 78 3a 20 28 29 20 3d 3e 20 74 68 69 73 2e 69 6e 73 65 72 74 43 68 65 63 6b | checkbox:.().=>.this.insertCheck |
c920 | 49 74 65 6d 28 70 6f 73 2c 20 69 74 65 6d 2e 63 6f 6d 6d 61 6e 64 49 64 2c 20 69 74 65 6d 2e 6c | Item(pos,.item.commandId,.item.l |
c940 | 61 62 65 6c 29 2c 0a 20 20 20 20 73 65 70 61 72 61 74 6f 72 3a 20 28 29 20 3d 3e 20 74 68 69 73 | abel),.....separator:.().=>.this |
c960 | 2e 69 6e 73 65 72 74 53 65 70 61 72 61 74 6f 72 28 70 6f 73 29 2c 0a 20 20 20 20 73 75 62 6d 65 | .insertSeparator(pos),.....subme |
c980 | 6e 75 3a 20 28 29 20 3d 3e 20 74 68 69 73 2e 69 6e 73 65 72 74 53 75 62 4d 65 6e 75 28 70 6f 73 | nu:.().=>.this.insertSubMenu(pos |
c9a0 | 2c 20 69 74 65 6d 2e 63 6f 6d 6d 61 6e 64 49 64 2c 20 69 74 65 6d 2e 6c 61 62 65 6c 2c 20 69 74 | ,.item.commandId,.item.label,.it |
c9c0 | 65 6d 2e 73 75 62 6d 65 6e 75 29 2c 0a 20 20 20 20 72 61 64 69 6f 3a 20 28 29 20 3d 3e 20 7b 0a | em.submenu),.....radio:.().=>.{. |
c9e0 | 20 20 20 20 20 20 2f 2f 20 47 72 6f 75 70 69 6e 67 20 72 61 64 69 6f 20 6d 65 6e 75 20 69 74 65 | ......//.Grouping.radio.menu.ite |
ca00 | 6d 73 0a 20 20 20 20 20 20 69 74 65 6d 2e 6f 76 65 72 72 69 64 65 52 65 61 64 4f 6e 6c 79 50 72 | ms.......item.overrideReadOnlyPr |
ca20 | 6f 70 65 72 74 79 28 27 67 72 6f 75 70 49 64 27 2c 20 67 65 6e 65 72 61 74 65 47 72 6f 75 70 49 | operty('groupId',.generateGroupI |
ca40 | 64 28 74 68 69 73 2e 69 74 65 6d 73 2c 20 70 6f 73 29 29 0a 20 20 20 20 20 20 69 66 20 28 74 68 | d(this.items,.pos)).......if.(th |
ca60 | 69 73 2e 67 72 6f 75 70 73 4d 61 70 5b 69 74 65 6d 2e 67 72 6f 75 70 49 64 5d 20 3d 3d 20 6e 75 | is.groupsMap[item.groupId].==.nu |
ca80 | 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 67 72 6f 75 70 73 4d 61 70 5b 69 74 65 | ll).{.........this.groupsMap[ite |
caa0 | 6d 2e 67 72 6f 75 70 49 64 5d 20 3d 20 5b 5d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 74 68 | m.groupId].=.[].......}.......th |
cac0 | 69 73 2e 67 72 6f 75 70 73 4d 61 70 5b 69 74 65 6d 2e 67 72 6f 75 70 49 64 5d 2e 70 75 73 68 28 | is.groupsMap[item.groupId].push( |
cae0 | 69 74 65 6d 29 0a 0a 20 20 20 20 20 20 2f 2f 20 53 65 74 74 69 6e 67 20 61 20 72 61 64 69 6f 20 | item)........//.Setting.a.radio. |
cb00 | 6d 65 6e 75 20 69 74 65 6d 20 73 68 6f 75 6c 64 20 66 6c 69 70 20 6f 74 68 65 72 20 69 74 65 6d | menu.item.should.flip.other.item |
cb20 | 73 20 69 6e 20 74 68 65 20 67 72 6f 75 70 2e 0a 20 20 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 | s.in.the.group........v8Util.set |
cb40 | 48 69 64 64 65 6e 56 61 6c 75 65 28 69 74 65 6d 2c 20 27 63 68 65 63 6b 65 64 27 2c 20 69 74 65 | HiddenValue(item,.'checked',.ite |
cb60 | 6d 2e 63 68 65 63 6b 65 64 29 0a 20 20 20 20 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 | m.checked).......Object.definePr |
cb80 | 6f 70 65 72 74 79 28 69 74 65 6d 2c 20 27 63 68 65 63 6b 65 64 27 2c 20 7b 0a 20 20 20 20 20 20 | operty(item,.'checked',.{....... |
cba0 | 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 20 20 20 20 67 65 74 3a | ..enumerable:.true,.........get: |
cbc0 | 20 28 29 20 3d 3e 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 69 74 65 | .().=>.v8Util.getHiddenValue(ite |
cbe0 | 6d 2c 20 27 63 68 65 63 6b 65 64 27 29 2c 0a 20 20 20 20 20 20 20 20 73 65 74 3a 20 28 29 20 3d | m,.'checked'),.........set:.().= |
cc00 | 3e 20 7b 0a 20 20 20 20 20 20 20 20 20 20 74 68 69 73 2e 67 72 6f 75 70 73 4d 61 70 5b 69 74 65 | >.{...........this.groupsMap[ite |
cc20 | 6d 2e 67 72 6f 75 70 49 64 5d 2e 66 6f 72 45 61 63 68 28 6f 74 68 65 72 20 3d 3e 20 7b 0a 20 20 | m.groupId].forEach(other.=>.{... |
cc40 | 20 20 20 20 20 20 20 20 20 20 69 66 20 28 6f 74 68 65 72 20 21 3d 3d 20 69 74 65 6d 29 20 76 38 | ..........if.(other.!==.item).v8 |
cc60 | 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 6f 74 68 65 72 2c 20 27 63 68 65 63 | Util.setHiddenValue(other,.'chec |
cc80 | 6b 65 64 27 2c 20 66 61 6c 73 65 29 0a 20 20 20 20 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 | ked',.false)...........})....... |
cca0 | 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 69 74 65 6d 2c 20 | ....v8Util.setHiddenValue(item,. |
ccc0 | 27 63 68 65 63 6b 65 64 27 2c 20 74 72 75 65 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 | 'checked',.true).........}...... |
cce0 | 20 7d 29 0a 20 20 20 20 20 20 74 68 69 73 2e 69 6e 73 65 72 74 52 61 64 69 6f 49 74 65 6d 28 70 | .}).......this.insertRadioItem(p |
cd00 | 6f 73 2c 20 69 74 65 6d 2e 63 6f 6d 6d 61 6e 64 49 64 2c 20 69 74 65 6d 2e 6c 61 62 65 6c 2c 20 | os,.item.commandId,.item.label,. |
cd20 | 69 74 65 6d 2e 67 72 6f 75 70 49 64 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 74 79 70 65 73 5b | item.groupId).....}...}...types[ |
cd40 | 69 74 65 6d 2e 74 79 70 65 5d 28 29 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d | item.type]().}..module.exports.= |
cd60 | 20 4d 65 6e 75 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 66 65 61 74 75 72 | .Menu.'use.strict'..const.featur |
cd80 | 65 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 66 65 61 74 75 72 | es.=.process.atomBinding('featur |
cda0 | 65 73 27 29 0a 0a 2f 2f 20 42 72 6f 77 73 65 72 20 73 69 64 65 20 6d 6f 64 75 6c 65 73 2c 20 70 | es')..//.Browser.side.modules,.p |
cdc0 | 6c 65 61 73 65 20 73 6f 72 74 20 61 6c 70 68 61 62 65 74 69 63 61 6c 6c 79 2e 0a 6d 6f 64 75 6c | lease.sort.alphabetically..modul |
cde0 | 65 2e 65 78 70 6f 72 74 73 20 3d 20 5b 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 61 70 70 27 2c 20 66 | e.exports.=.[...{.name:.'app',.f |
ce00 | 69 6c 65 3a 20 27 61 70 70 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 61 75 74 6f 55 70 64 | ile:.'app'.},...{.name:.'autoUpd |
ce20 | 61 74 65 72 27 2c 20 66 69 6c 65 3a 20 27 61 75 74 6f 2d 75 70 64 61 74 65 72 27 20 7d 2c 0a 20 | ater',.file:.'auto-updater'.},.. |
ce40 | 20 7b 20 6e 61 6d 65 3a 20 27 42 72 6f 77 73 65 72 56 69 65 77 27 2c 20 66 69 6c 65 3a 20 27 62 | .{.name:.'BrowserView',.file:.'b |
ce60 | 72 6f 77 73 65 72 2d 76 69 65 77 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 42 72 6f 77 73 | rowser-view'.},...{.name:.'Brows |
ce80 | 65 72 57 69 6e 64 6f 77 27 2c 20 66 69 6c 65 3a 20 27 62 72 6f 77 73 65 72 2d 77 69 6e 64 6f 77 | erWindow',.file:.'browser-window |
cea0 | 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 63 6f 6e 74 65 6e 74 54 72 61 63 69 6e 67 27 2c | '.},...{.name:.'contentTracing', |
cec0 | 20 66 69 6c 65 3a 20 27 63 6f 6e 74 65 6e 74 2d 74 72 61 63 69 6e 67 27 20 7d 2c 0a 20 20 7b 20 | .file:.'content-tracing'.},...{. |
cee0 | 6e 61 6d 65 3a 20 27 63 72 61 73 68 52 65 70 6f 72 74 65 72 27 2c 20 66 69 6c 65 3a 20 27 63 72 | name:.'crashReporter',.file:.'cr |
cf00 | 61 73 68 2d 72 65 70 6f 72 74 65 72 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 64 69 61 6c | ash-reporter'.},...{.name:.'dial |
cf20 | 6f 67 27 2c 20 66 69 6c 65 3a 20 27 64 69 61 6c 6f 67 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a | og',.file:.'dialog'.},...{.name: |
cf40 | 20 27 67 6c 6f 62 61 6c 53 68 6f 72 74 63 75 74 27 2c 20 66 69 6c 65 3a 20 27 67 6c 6f 62 61 6c | .'globalShortcut',.file:.'global |
cf60 | 2d 73 68 6f 72 74 63 75 74 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 69 70 63 4d 61 69 6e | -shortcut'.},...{.name:.'ipcMain |
cf80 | 27 2c 20 66 69 6c 65 3a 20 27 69 70 63 2d 6d 61 69 6e 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a | ',.file:.'ipc-main'.},...{.name: |
cfa0 | 20 27 69 6e 41 70 70 50 75 72 63 68 61 73 65 27 2c 20 66 69 6c 65 3a 20 27 69 6e 2d 61 70 70 2d | .'inAppPurchase',.file:.'in-app- |
cfc0 | 70 75 72 63 68 61 73 65 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 4d 65 6e 75 27 2c 20 66 | purchase'.},...{.name:.'Menu',.f |
cfe0 | 69 6c 65 3a 20 27 6d 65 6e 75 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 4d 65 6e 75 49 74 | ile:.'menu'.},...{.name:.'MenuIt |
d000 | 65 6d 27 2c 20 66 69 6c 65 3a 20 27 6d 65 6e 75 2d 69 74 65 6d 27 20 7d 2c 0a 20 20 7b 20 6e 61 | em',.file:.'menu-item'.},...{.na |
d020 | 6d 65 3a 20 27 6e 65 74 27 2c 20 66 69 6c 65 3a 20 27 6e 65 74 27 20 7d 2c 0a 20 20 7b 20 6e 61 | me:.'net',.file:.'net'.},...{.na |
d040 | 6d 65 3a 20 27 6e 65 74 4c 6f 67 27 2c 20 66 69 6c 65 3a 20 27 6e 65 74 2d 6c 6f 67 27 20 7d 2c | me:.'netLog',.file:.'net-log'.}, |
d060 | 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 4e 6f 74 69 66 69 63 61 74 69 6f 6e 27 2c 20 66 69 6c 65 3a | ...{.name:.'Notification',.file: |
d080 | 20 27 6e 6f 74 69 66 69 63 61 74 69 6f 6e 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 70 6f | .'notification'.},...{.name:.'po |
d0a0 | 77 65 72 4d 6f 6e 69 74 6f 72 27 2c 20 66 69 6c 65 3a 20 27 70 6f 77 65 72 2d 6d 6f 6e 69 74 6f | werMonitor',.file:.'power-monito |
d0c0 | 72 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 70 6f 77 65 72 53 61 76 65 42 6c 6f 63 6b 65 | r'.},...{.name:.'powerSaveBlocke |
d0e0 | 72 27 2c 20 66 69 6c 65 3a 20 27 70 6f 77 65 72 2d 73 61 76 65 2d 62 6c 6f 63 6b 65 72 27 20 7d | r',.file:.'power-save-blocker'.} |
d100 | 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 70 72 6f 74 6f 63 6f 6c 27 2c 20 66 69 6c 65 3a 20 27 70 | ,...{.name:.'protocol',.file:.'p |
d120 | 72 6f 74 6f 63 6f 6c 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 73 63 72 65 65 6e 27 2c 20 | rotocol'.},...{.name:.'screen',. |
d140 | 66 69 6c 65 3a 20 27 73 63 72 65 65 6e 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 73 65 73 | file:.'screen'.},...{.name:.'ses |
d160 | 73 69 6f 6e 27 2c 20 66 69 6c 65 3a 20 27 73 65 73 73 69 6f 6e 27 20 7d 2c 0a 20 20 7b 20 6e 61 | sion',.file:.'session'.},...{.na |
d180 | 6d 65 3a 20 27 73 79 73 74 65 6d 50 72 65 66 65 72 65 6e 63 65 73 27 2c 20 66 69 6c 65 3a 20 27 | me:.'systemPreferences',.file:.' |
d1a0 | 73 79 73 74 65 6d 2d 70 72 65 66 65 72 65 6e 63 65 73 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a | system-preferences'.},...{.name: |
d1c0 | 20 27 54 6f 70 4c 65 76 65 6c 57 69 6e 64 6f 77 27 2c 20 66 69 6c 65 3a 20 27 74 6f 70 2d 6c 65 | .'TopLevelWindow',.file:.'top-le |
d1e0 | 76 65 6c 2d 77 69 6e 64 6f 77 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 54 6f 75 63 68 42 | vel-window'.},...{.name:.'TouchB |
d200 | 61 72 27 2c 20 66 69 6c 65 3a 20 27 74 6f 75 63 68 2d 62 61 72 27 20 7d 2c 0a 20 20 7b 20 6e 61 | ar',.file:.'touch-bar'.},...{.na |
d220 | 6d 65 3a 20 27 54 72 61 79 27 2c 20 66 69 6c 65 3a 20 27 74 72 61 79 27 20 7d 2c 0a 20 20 7b 20 | me:.'Tray',.file:.'tray'.},...{. |
d240 | 6e 61 6d 65 3a 20 27 56 69 65 77 27 2c 20 66 69 6c 65 3a 20 27 76 69 65 77 27 20 7d 2c 0a 20 20 | name:.'View',.file:.'view'.},... |
d260 | 7b 20 6e 61 6d 65 3a 20 27 77 65 62 43 6f 6e 74 65 6e 74 73 27 2c 20 66 69 6c 65 3a 20 27 77 65 | {.name:.'webContents',.file:.'we |
d280 | 62 2d 63 6f 6e 74 65 6e 74 73 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 57 65 62 43 6f 6e | b-contents'.},...{.name:.'WebCon |
d2a0 | 74 65 6e 74 73 56 69 65 77 27 2c 20 66 69 6c 65 3a 20 27 77 65 62 2d 63 6f 6e 74 65 6e 74 73 2d | tentsView',.file:.'web-contents- |
d2c0 | 76 69 65 77 27 20 7d 2c 0a 20 20 2f 2f 20 54 68 65 20 69 6e 74 65 72 6e 61 6c 20 6d 6f 64 75 6c | view'.},...//.The.internal.modul |
d2e0 | 65 73 2c 20 69 6e 76 69 73 69 62 6c 65 20 75 6e 6c 65 73 73 20 79 6f 75 20 6b 6e 6f 77 20 74 68 | es,.invisible.unless.you.know.th |
d300 | 65 69 72 20 6e 61 6d 65 73 2e 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 4e 61 76 69 67 61 74 69 6f 6e | eir.names....{.name:.'Navigation |
d320 | 43 6f 6e 74 72 6f 6c 6c 65 72 27 2c 20 66 69 6c 65 3a 20 27 6e 61 76 69 67 61 74 69 6f 6e 2d 63 | Controller',.file:.'navigation-c |
d340 | 6f 6e 74 72 6f 6c 6c 65 72 27 2c 20 70 72 69 76 61 74 65 3a 20 74 72 75 65 20 7d 0a 5d 0a 0a 69 | ontroller',.private:.true.}.]..i |
d360 | 66 20 28 66 65 61 74 75 72 65 73 2e 69 73 56 69 65 77 41 70 69 45 6e 61 62 6c 65 64 28 29 29 20 | f.(features.isViewApiEnabled()). |
d380 | 7b 0a 20 20 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 2e 70 75 73 68 28 0a 20 20 20 20 7b 20 6e | {...module.exports.push(.....{.n |
d3a0 | 61 6d 65 3a 20 27 42 6f 78 4c 61 79 6f 75 74 27 2c 20 66 69 6c 65 3a 20 27 76 69 65 77 73 2f 62 | ame:.'BoxLayout',.file:.'views/b |
d3c0 | 6f 78 2d 6c 61 79 6f 75 74 27 20 7d 2c 0a 20 20 20 20 7b 20 6e 61 6d 65 3a 20 27 42 75 74 74 6f | ox-layout'.},.....{.name:.'Butto |
d3e0 | 6e 27 2c 20 66 69 6c 65 3a 20 27 76 69 65 77 73 2f 62 75 74 74 6f 6e 27 20 7d 2c 0a 20 20 20 20 | n',.file:.'views/button'.},..... |
d400 | 7b 20 6e 61 6d 65 3a 20 27 4c 61 62 65 6c 42 75 74 74 6f 6e 27 2c 20 66 69 6c 65 3a 20 27 76 69 | {.name:.'LabelButton',.file:.'vi |
d420 | 65 77 73 2f 6c 61 62 65 6c 2d 62 75 74 74 6f 6e 27 20 7d 2c 0a 20 20 20 20 7b 20 6e 61 6d 65 3a | ews/label-button'.},.....{.name: |
d440 | 20 27 4c 61 79 6f 75 74 4d 61 6e 61 67 65 72 27 2c 20 66 69 6c 65 3a 20 27 76 69 65 77 73 2f 6c | .'LayoutManager',.file:.'views/l |
d460 | 61 79 6f 75 74 2d 6d 61 6e 61 67 65 72 27 20 7d 2c 0a 20 20 20 20 7b 20 6e 61 6d 65 3a 20 27 54 | ayout-manager'.},.....{.name:.'T |
d480 | 65 78 74 46 69 65 6c 64 27 2c 20 66 69 6c 65 3a 20 27 76 69 65 77 73 2f 74 65 78 74 2d 66 69 65 | extField',.file:.'views/text-fie |
d4a0 | 6c 64 27 20 7d 0a 20 20 29 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 | ld'.}...).}.'use.strict'..const. |
d4c0 | 69 70 63 4d 61 69 6e 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 | ipcMain.=.require('@electron/int |
d4e0 | 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 69 70 63 2d 6d 61 69 6e 2d 69 6e 74 65 72 6e 61 6c 27 | ernal/browser/ipc-main-internal' |
d500 | 29 0a 0a 2f 2f 20 54 68 65 20 68 69 73 74 6f 72 79 20 6f 70 65 72 61 74 69 6f 6e 20 69 6e 20 72 | )..//.The.history.operation.in.r |
d520 | 65 6e 64 65 72 65 72 20 69 73 20 72 65 64 69 72 65 63 74 65 64 20 74 6f 20 62 72 6f 77 73 65 72 | enderer.is.redirected.to.browser |
d540 | 2e 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 4e 41 56 49 47 41 54 49 4f | ..ipcMain.on('ELECTRON_NAVIGATIO |
d560 | 4e 5f 43 4f 4e 54 52 4f 4c 4c 45 52 5f 47 4f 5f 42 41 43 4b 27 2c 20 66 75 6e 63 74 69 6f 6e 20 | N_CONTROLLER_GO_BACK',.function. |
d580 | 28 65 76 65 6e 74 29 20 7b 0a 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 6f 42 61 63 6b 28 | (event).{...event.sender.goBack( |
d5a0 | 29 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 4e 41 56 49 47 | ).})..ipcMain.on('ELECTRON_NAVIG |
d5c0 | 41 54 49 4f 4e 5f 43 4f 4e 54 52 4f 4c 4c 45 52 5f 47 4f 5f 46 4f 52 57 41 52 44 27 2c 20 66 75 | ATION_CONTROLLER_GO_FORWARD',.fu |
d5e0 | 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 29 20 7b 0a 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e | nction.(event).{...event.sender. |
d600 | 67 6f 46 6f 72 77 61 72 64 28 29 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 | goForward().})..ipcMain.on('ELEC |
d620 | 54 52 4f 4e 5f 4e 41 56 49 47 41 54 49 4f 4e 5f 43 4f 4e 54 52 4f 4c 4c 45 52 5f 47 4f 5f 54 4f | TRON_NAVIGATION_CONTROLLER_GO_TO |
d640 | 5f 4f 46 46 53 45 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 6f 66 66 73 65 | _OFFSET',.function.(event,.offse |
d660 | 74 29 20 7b 0a 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 6f 54 6f 4f 66 66 73 65 74 28 6f | t).{...event.sender.goToOffset(o |
d680 | 66 66 73 65 74 29 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f | ffset).})..ipcMain.on('ELECTRON_ |
d6a0 | 4e 41 56 49 47 41 54 49 4f 4e 5f 43 4f 4e 54 52 4f 4c 4c 45 52 5f 4c 45 4e 47 54 48 27 2c 20 66 | NAVIGATION_CONTROLLER_LENGTH',.f |
d6c0 | 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 29 20 7b 0a 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e | unction.(event).{...event.return |
d6e0 | 56 61 6c 75 65 20 3d 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 6c 65 6e 67 74 68 28 29 0a 7d 29 | Value.=.event.sender.length().}) |
d700 | 0a 0a 2f 2f 20 4a 61 76 61 53 63 72 69 70 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f | ..//.JavaScript.implementation.o |
d720 | 66 20 43 68 72 6f 6d 69 75 6d 27 73 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 | f.Chromium's.NavigationControlle |
d740 | 72 2e 0a 2f 2f 20 49 6e 73 74 65 61 64 20 6f 66 20 72 65 6c 79 69 6e 67 20 6f 6e 20 43 68 72 6f | r..//.Instead.of.relying.on.Chro |
d760 | 6d 69 75 6d 20 66 6f 72 20 68 69 73 74 6f 72 79 20 63 6f 6e 74 72 6f 6c 2c 20 77 65 20 63 6f 6d | mium.for.history.control,.we.com |
d780 | 70 65 6c 65 74 65 6c 79 20 64 6f 20 68 69 73 74 6f 72 79 0a 2f 2f 20 63 6f 6e 74 72 6f 6c 20 6f | peletely.do.history.//.control.o |
d7a0 | 6e 20 75 73 65 72 20 6c 61 6e 64 2c 20 61 6e 64 20 6f 6e 6c 79 20 72 65 6c 79 20 6f 6e 20 57 65 | n.user.land,.and.only.rely.on.We |
d7c0 | 62 43 6f 6e 74 65 6e 74 73 2e 6c 6f 61 64 55 52 4c 20 66 6f 72 20 6e 61 76 69 67 61 74 69 6f 6e | bContents.loadURL.for.navigation |
d7e0 | 2e 0a 2f 2f 20 54 68 69 73 20 68 65 6c 70 73 20 75 73 20 61 76 6f 69 64 20 43 68 72 6f 6d 69 75 | ..//.This.helps.us.avoid.Chromiu |
d800 | 6d 27 73 20 76 61 72 69 6f 75 73 20 6f 70 74 69 6d 69 7a 61 74 69 6f 6e 73 20 73 6f 20 77 65 20 | m's.various.optimizations.so.we. |
d820 | 63 61 6e 20 65 6e 73 75 72 65 20 72 65 6e 64 65 72 65 72 0a 2f 2f 20 70 72 6f 63 65 73 73 20 69 | can.ensure.renderer.//.process.i |
d840 | 73 20 72 65 73 74 61 72 74 65 64 20 65 76 65 72 79 74 69 6d 65 2e 0a 63 6f 6e 73 74 20 4e 61 76 | s.restarted.everytime..const.Nav |
d860 | 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 20 3d 20 28 66 75 6e 63 74 69 6f 6e 20 28 29 | igationController.=.(function.() |
d880 | 20 7b 0a 20 20 66 75 6e 63 74 69 6f 6e 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c | .{...function.NavigationControll |
d8a0 | 65 72 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 77 65 62 43 | er.(webContents).{.....this.webC |
d8c0 | 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 0a 20 20 20 20 74 68 69 73 2e 63 | ontents.=.webContents.....this.c |
d8e0 | 6c 65 61 72 48 69 73 74 6f 72 79 28 29 0a 0a 20 20 20 20 2f 2f 20 77 65 62 43 6f 6e 74 65 6e 74 | learHistory()......//.webContent |
d900 | 73 20 6d 61 79 20 68 61 76 65 20 61 6c 72 65 61 64 79 20 6e 61 76 69 67 61 74 65 64 20 74 6f 20 | s.may.have.already.navigated.to. |
d920 | 61 20 70 61 67 65 2e 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 | a.page......if.(this.webContents |
d940 | 2e 5f 67 65 74 55 52 4c 28 29 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 63 75 72 72 65 6e 74 | ._getURL()).{.......this.current |
d960 | 49 6e 64 65 78 2b 2b 0a 20 20 20 20 20 20 74 68 69 73 2e 68 69 73 74 6f 72 79 2e 70 75 73 68 28 | Index++.......this.history.push( |
d980 | 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 67 65 74 55 52 4c 28 29 29 0a 20 20 20 20 | this.webContents._getURL())..... |
d9a0 | 7d 0a 20 20 20 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 6e 61 76 69 67 | }.....this.webContents.on('navig |
d9c0 | 61 74 69 6f 6e 2d 65 6e 74 72 79 2d 63 6f 6d 6d 69 74 65 64 27 2c 20 28 65 76 65 6e 74 2c 20 75 | ation-entry-commited',.(event,.u |
d9e0 | 72 6c 2c 20 69 6e 50 61 67 65 2c 20 72 65 70 6c 61 63 65 45 6e 74 72 79 29 20 3d 3e 20 7b 0a 20 | rl,.inPage,.replaceEntry).=>.{.. |
da00 | 20 20 20 20 20 69 66 20 28 74 68 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 20 3e 20 2d 31 20 26 | .....if.(this.inPageIndex.>.-1.& |
da20 | 26 20 21 69 6e 50 61 67 65 29 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 4e 61 76 69 67 61 74 65 | &.!inPage).{.........//.Navigate |
da40 | 64 20 74 6f 20 61 20 6e 65 77 20 70 61 67 65 2c 20 63 6c 65 61 72 20 69 6e 2d 70 61 67 65 20 6d | d.to.a.new.page,.clear.in-page.m |
da60 | 61 72 6b 2e 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 20 3d 20 | ark..........this.inPageIndex.=. |
da80 | 2d 31 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 74 68 69 73 2e 69 6e 50 61 67 65 49 | -1.......}.else.if.(this.inPageI |
daa0 | 6e 64 65 78 20 3d 3d 3d 20 2d 31 20 26 26 20 69 6e 50 61 67 65 20 26 26 20 21 72 65 70 6c 61 63 | ndex.===.-1.&&.inPage.&&.!replac |
dac0 | 65 45 6e 74 72 79 29 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 53 74 61 72 74 65 64 20 69 6e 2d | eEntry).{.........//.Started.in- |
dae0 | 70 61 67 65 20 6e 61 76 69 67 61 74 69 6f 6e 73 2e 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 69 | page.navigations..........this.i |
db00 | 6e 50 61 67 65 49 6e 64 65 78 20 3d 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 0a 20 | nPageIndex.=.this.currentIndex.. |
db20 | 20 20 20 20 20 7d 0a 20 20 20 20 20 20 69 66 20 28 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 | .....}.......if.(this.pendingInd |
db40 | 65 78 20 3e 3d 20 30 29 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 47 6f 20 74 6f 20 69 6e 64 65 | ex.>=.0).{.........//.Go.to.inde |
db60 | 78 2e 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 20 3d 20 74 | x..........this.currentIndex.=.t |
db80 | 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 70 65 | his.pendingIndex.........this.pe |
dba0 | 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 2d 31 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 68 69 73 | ndingIndex.=.-1.........this.his |
dbc0 | 74 6f 72 79 5b 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 5d 20 3d 20 75 72 6c 0a 20 20 | tory[this.currentIndex].=.url... |
dbe0 | 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 72 65 70 6c 61 63 65 45 6e 74 72 79 29 20 7b 0a 20 | ....}.else.if.(replaceEntry).{.. |
dc00 | 20 20 20 20 20 20 20 2f 2f 20 4e 6f 6e 2d 75 73 65 72 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 6e | .......//.Non-user.initialized.n |
dc20 | 61 76 69 67 61 74 69 6f 6e 2e 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 68 69 73 74 6f 72 79 5b | avigation..........this.history[ |
dc40 | 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 5d 20 3d 20 75 72 6c 0a 20 20 20 20 20 20 7d | this.currentIndex].=.url.......} |
dc60 | 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 4e 6f 72 6d 61 6c 20 6e 61 76 69 67 61 | .else.{.........//.Normal.naviga |
dc80 | 74 69 6f 6e 2e 20 43 6c 65 61 72 20 68 69 73 74 6f 72 79 2e 0a 20 20 20 20 20 20 20 20 74 68 69 | tion..Clear.history..........thi |
dca0 | 73 2e 68 69 73 74 6f 72 79 20 3d 20 74 68 69 73 2e 68 69 73 74 6f 72 79 2e 73 6c 69 63 65 28 30 | s.history.=.this.history.slice(0 |
dcc0 | 2c 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 20 2b 20 31 29 0a 20 20 20 20 20 20 20 | ,.this.currentIndex.+.1)........ |
dce0 | 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 2b 2b 0a 20 20 20 20 20 20 20 20 74 68 69 | .this.currentIndex++.........thi |
dd00 | 73 2e 68 69 73 74 6f 72 79 2e 70 75 73 68 28 75 72 6c 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 | s.history.push(url).......}..... |
dd20 | 7d 29 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 | })...}....NavigationController.p |
dd40 | 72 6f 74 6f 74 79 70 65 2e 6c 6f 61 64 55 52 4c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 75 72 6c | rototype.loadURL.=.function.(url |
dd60 | 2c 20 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 20 3d 3d 20 | ,.options).{.....if.(options.==. |
dd80 | 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 20 3d 20 7b 7d 0a 20 20 20 20 7d | null).{.......options.=.{}.....} |
dda0 | 0a 20 20 20 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 2d 31 0a 20 20 20 20 | .....this.pendingIndex.=.-1..... |
ddc0 | 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 6c 6f 61 64 55 52 4c 28 75 72 6c 2c 20 6f | this.webContents._loadURL(url,.o |
dde0 | 70 74 69 6f 6e 73 29 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 | ptions).....return.this.webConte |
de00 | 6e 74 73 2e 65 6d 69 74 28 27 6c 6f 61 64 2d 75 72 6c 27 2c 20 75 72 6c 2c 20 6f 70 74 69 6f 6e | nts.emit('load-url',.url,.option |
de20 | 73 29 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 | s)...}....NavigationController.p |
de40 | 72 6f 74 6f 74 79 70 65 2e 67 65 74 55 52 4c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a | rototype.getURL.=.function.().{. |
de60 | 20 20 20 20 69 66 20 28 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 20 3d 3d 3d 20 2d 31 | ....if.(this.currentIndex.===.-1 |
de80 | 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 27 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b | ).{.......return.''.....}.else.{ |
dea0 | 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 68 69 73 74 6f 72 79 5b 74 68 69 73 2e | .......return.this.history[this. |
dec0 | 63 75 72 72 65 6e 74 49 6e 64 65 78 5d 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 | currentIndex].....}...}....Navig |
dee0 | 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 73 74 6f 70 20 3d | ationController.prototype.stop.= |
df00 | 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 | .function.().{.....this.pendingI |
df20 | 6e 64 65 78 20 3d 20 2d 31 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e | ndex.=.-1.....return.this.webCon |
df40 | 74 65 6e 74 73 2e 5f 73 74 6f 70 28 29 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 | tents._stop()...}....NavigationC |
df60 | 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 72 65 6c 6f 61 64 20 3d 20 66 75 6e | ontroller.prototype.reload.=.fun |
df80 | 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 | ction.().{.....this.pendingIndex |
dfa0 | 20 3d 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 0a 20 20 20 20 72 65 74 75 72 6e 20 | .=.this.currentIndex.....return. |
dfc0 | 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 6c 6f 61 64 55 52 4c 28 74 68 69 73 2e 67 | this.webContents._loadURL(this.g |
dfe0 | 65 74 55 52 4c 28 29 2c 20 7b 7d 29 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f | etURL(),.{})...}....NavigationCo |
e000 | 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 72 65 6c 6f 61 64 49 67 6e 6f 72 69 6e | ntroller.prototype.reloadIgnorin |
e020 | 67 43 61 63 68 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e | gCache.=.function.().{.....this. |
e040 | 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 | pendingIndex.=.this.currentIndex |
e060 | 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 6c 6f | .....return.this.webContents._lo |
e080 | 61 64 55 52 4c 28 74 68 69 73 2e 67 65 74 55 52 4c 28 29 2c 20 7b 0a 20 20 20 20 20 20 65 78 74 | adURL(this.getURL(),.{.......ext |
e0a0 | 72 61 48 65 61 64 65 72 73 3a 20 27 70 72 61 67 6d 61 3a 20 6e 6f 2d 63 61 63 68 65 5c 6e 27 0a | raHeaders:.'pragma:.no-cache\n'. |
e0c0 | 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c | ....})...}....NavigationControll |
e0e0 | 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 63 61 6e 47 6f 42 61 63 6b 20 3d 20 66 75 6e 63 74 69 6f | er.prototype.canGoBack.=.functio |
e100 | 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 67 65 74 41 63 74 69 76 65 | n.().{.....return.this.getActive |
e120 | 49 6e 64 65 78 28 29 20 3e 20 30 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e | Index().>.0...}....NavigationCon |
e140 | 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 63 61 6e 47 6f 46 6f 72 77 61 72 64 20 3d | troller.prototype.canGoForward.= |
e160 | 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 67 | .function.().{.....return.this.g |
e180 | 65 74 41 63 74 69 76 65 49 6e 64 65 78 28 29 20 3c 20 74 68 69 73 2e 68 69 73 74 6f 72 79 2e 6c | etActiveIndex().<.this.history.l |
e1a0 | 65 6e 67 74 68 20 2d 20 31 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 | ength.-.1...}....NavigationContr |
e1c0 | 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 63 61 6e 47 6f 54 6f 49 6e 64 65 78 20 3d 20 66 | oller.prototype.canGoToIndex.=.f |
e1e0 | 75 6e 63 74 69 6f 6e 20 28 69 6e 64 65 78 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 69 6e 64 | unction.(index).{.....return.ind |
e200 | 65 78 20 3e 3d 20 30 20 26 26 20 69 6e 64 65 78 20 3c 20 74 68 69 73 2e 68 69 73 74 6f 72 79 2e | ex.>=.0.&&.index.<.this.history. |
e220 | 6c 65 6e 67 74 68 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c | length...}....NavigationControll |
e240 | 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 63 61 6e 47 6f 54 6f 4f 66 66 73 65 74 20 3d 20 66 75 6e | er.prototype.canGoToOffset.=.fun |
e260 | 63 74 69 6f 6e 20 28 6f 66 66 73 65 74 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 | ction.(offset).{.....return.this |
e280 | 2e 63 61 6e 47 6f 54 6f 49 6e 64 65 78 28 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 20 | .canGoToIndex(this.currentIndex. |
e2a0 | 2b 20 6f 66 66 73 65 74 29 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 | +.offset)...}....NavigationContr |
e2c0 | 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 63 6c 65 61 72 48 69 73 74 6f 72 79 20 3d 20 66 | oller.prototype.clearHistory.=.f |
e2e0 | 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 68 69 73 74 6f 72 79 20 3d 20 | unction.().{.....this.history.=. |
e300 | 5b 5d 0a 20 20 20 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 20 3d 20 2d 31 0a 20 20 | [].....this.currentIndex.=.-1... |
e320 | 20 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 2d 31 0a 20 20 20 20 74 68 69 | ..this.pendingIndex.=.-1.....thi |
e340 | 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 20 3d 20 2d 31 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 | s.inPageIndex.=.-1...}....Naviga |
e360 | 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 67 6f 42 61 63 6b 20 | tionController.prototype.goBack. |
e380 | 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 63 61 | =.function.().{.....if.(!this.ca |
e3a0 | 6e 47 6f 42 61 63 6b 28 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a | nGoBack()).{.......return.....}. |
e3c0 | 20 20 20 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 74 68 69 73 2e 67 65 74 | ....this.pendingIndex.=.this.get |
e3e0 | 41 63 74 69 76 65 49 6e 64 65 78 28 29 20 2d 20 31 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 69 | ActiveIndex().-.1.....if.(this.i |
e400 | 6e 50 61 67 65 49 6e 64 65 78 20 3e 20 2d 31 20 26 26 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 | nPageIndex.>.-1.&&.this.pendingI |
e420 | 6e 64 65 78 20 3e 3d 20 74 68 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 29 20 7b 0a 20 20 20 20 | ndex.>=.this.inPageIndex).{..... |
e440 | 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 67 6f 42 61 63 | ..return.this.webContents._goBac |
e460 | 6b 28 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 | k().....}.else.{.......return.th |
e480 | 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 6c 6f 61 64 55 52 4c 28 74 68 69 73 2e 68 69 73 | is.webContents._loadURL(this.his |
e4a0 | 74 6f 72 79 5b 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 5d 2c 20 7b 7d 29 0a 20 20 20 | tory[this.pendingIndex],.{}).... |
e4c0 | 20 7d 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 | .}...}....NavigationController.p |
e4e0 | 72 6f 74 6f 74 79 70 65 2e 67 6f 46 6f 72 77 61 72 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 | rototype.goForward.=.function.() |
e500 | 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 63 61 6e 47 6f 46 6f 72 77 61 72 64 28 29 29 | .{.....if.(!this.canGoForward()) |
e520 | 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 73 2e 70 | .{.......return.....}.....this.p |
e540 | 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 74 68 69 73 2e 67 65 74 41 63 74 69 76 65 49 6e 64 65 | endingIndex.=.this.getActiveInde |
e560 | 78 28 29 20 2b 20 31 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 | x().+.1.....if.(this.inPageIndex |
e580 | 20 3e 20 2d 31 20 26 26 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3e 3d 20 74 68 | .>.-1.&&.this.pendingIndex.>=.th |
e5a0 | 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 | is.inPageIndex).{.......return.t |
e5c0 | 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 67 6f 46 6f 72 77 61 72 64 28 29 0a 20 20 20 | his.webContents._goForward().... |
e5e0 | 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 | .}.else.{.......return.this.webC |
e600 | 6f 6e 74 65 6e 74 73 2e 5f 6c 6f 61 64 55 52 4c 28 74 68 69 73 2e 68 69 73 74 6f 72 79 5b 74 68 | ontents._loadURL(this.history[th |
e620 | 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 5d 2c 20 7b 7d 29 0a 20 20 20 20 7d 0a 20 20 7d 0a | is.pendingIndex],.{}).....}...}. |
e640 | 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 | ...NavigationController.prototyp |
e660 | 65 2e 67 6f 54 6f 49 6e 64 65 78 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 69 6e 64 65 78 29 20 7b | e.goToIndex.=.function.(index).{ |
e680 | 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 63 61 6e 47 6f 54 6f 49 6e 64 65 78 28 69 6e 64 65 | .....if.(!this.canGoToIndex(inde |
e6a0 | 78 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 | x)).{.......return.....}.....thi |
e6c0 | 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 69 6e 64 65 78 0a 20 20 20 20 72 65 74 75 72 | s.pendingIndex.=.index.....retur |
e6e0 | 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 6c 6f 61 64 55 52 4c 28 74 68 69 73 | n.this.webContents._loadURL(this |
e700 | 2e 68 69 73 74 6f 72 79 5b 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 5d 2c 20 7b 7d 29 | .history[this.pendingIndex],.{}) |
e720 | 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f | ...}....NavigationController.pro |
e740 | 74 6f 74 79 70 65 2e 67 6f 54 6f 4f 66 66 73 65 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6f 66 | totype.goToOffset.=.function.(of |
e760 | 66 73 65 74 29 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 63 61 6e 47 6f 54 6f 4f 66 66 | fset).{.....if.(!this.canGoToOff |
e780 | 73 65 74 28 6f 66 66 73 65 74 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 | set(offset)).{.......return..... |
e7a0 | 7d 0a 20 20 20 20 63 6f 6e 73 74 20 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 74 68 69 73 2e | }.....const.pendingIndex.=.this. |
e7c0 | 63 75 72 72 65 6e 74 49 6e 64 65 78 20 2b 20 6f 66 66 73 65 74 0a 20 20 20 20 69 66 20 28 74 68 | currentIndex.+.offset.....if.(th |
e7e0 | 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 20 3e 20 2d 31 20 26 26 20 70 65 6e 64 69 6e 67 49 6e | is.inPageIndex.>.-1.&&.pendingIn |
e800 | 64 65 78 20 3e 3d 20 74 68 69 73 2e 69 6e 50 61 67 65 49 6e 64 65 78 29 20 7b 0a 20 20 20 20 20 | dex.>=.this.inPageIndex).{...... |
e820 | 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 20 70 65 6e 64 69 6e 67 49 6e 64 65 | .this.pendingIndex.=.pendingInde |
e840 | 78 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e | x.......return.this.webContents. |
e860 | 5f 67 6f 54 6f 4f 66 66 73 65 74 28 6f 66 66 73 65 74 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b | _goToOffset(offset).....}.else.{ |
e880 | 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 67 6f 54 6f 49 6e 64 65 78 28 70 65 6e | .......return.this.goToIndex(pen |
e8a0 | 64 69 6e 67 49 6e 64 65 78 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 | dingIndex).....}...}....Navigati |
e8c0 | 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 67 65 74 41 63 74 69 76 65 | onController.prototype.getActive |
e8e0 | 49 6e 64 65 78 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 74 68 | Index.=.function.().{.....if.(th |
e900 | 69 73 2e 70 65 6e 64 69 6e 67 49 6e 64 65 78 20 3d 3d 3d 20 2d 31 29 20 7b 0a 20 20 20 20 20 20 | is.pendingIndex.===.-1).{....... |
e920 | 72 65 74 75 72 6e 20 74 68 69 73 2e 63 75 72 72 65 6e 74 49 6e 64 65 78 0a 20 20 20 20 7d 20 65 | return.this.currentIndex.....}.e |
e940 | 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 70 65 6e 64 69 6e 67 49 | lse.{.......return.this.pendingI |
e960 | 6e 64 65 78 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 | ndex.....}...}....NavigationCont |
e980 | 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 2e 6c 65 6e 67 74 68 20 3d 20 66 75 6e 63 74 69 | roller.prototype.length.=.functi |
e9a0 | 6f 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 68 69 73 74 6f 72 79 2e | on.().{.....return.this.history. |
e9c0 | 6c 65 6e 67 74 68 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 4e 61 76 69 67 61 74 69 6f 6e 43 | length...}....return.NavigationC |
e9e0 | 6f 6e 74 72 6f 6c 6c 65 72 0a 7d 29 28 29 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d | ontroller.})()..module.exports.= |
ea00 | 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 0a 27 75 73 65 20 73 74 72 69 63 | .NavigationController.'use.stric |
ea20 | 74 27 0a 0a 2f 2f 20 54 4f 44 4f 28 64 65 65 70 61 6b 31 35 35 36 29 3a 20 44 65 70 72 65 63 61 | t'..//.TODO(deepak1556):.Depreca |
ea40 | 74 65 20 61 6e 64 20 72 65 6d 6f 76 65 20 73 74 61 6e 64 61 6c 6f 6e 65 20 6e 65 74 4c 6f 67 20 | te.and.remove.standalone.netLog. |
ea60 | 6d 6f 64 75 6c 65 2c 0a 2f 2f 20 69 74 20 69 73 20 6e 6f 77 20 61 20 70 72 6f 70 65 72 74 79 20 | module,.//.it.is.now.a.property. |
ea80 | 6f 66 20 73 65 73 73 69 6f 20 6d 6f 64 75 6c 65 2e 0a 63 6f 6e 73 74 20 7b 20 61 70 70 2c 20 73 | of.sessio.module..const.{.app,.s |
eaa0 | 65 73 73 69 6f 6e 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a | ession.}.=.require('electron').. |
eac0 | 2f 2f 20 46 61 6c 6c 62 61 63 6b 20 74 6f 20 64 65 66 61 75 6c 74 20 73 65 73 73 69 6f 6e 2e 0a | //.Fallback.to.default.session.. |
eae0 | 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 6d 6f 64 75 6c 65 2e 65 78 70 | Object.setPrototypeOf(module.exp |
eb00 | 6f 72 74 73 2c 20 6e 65 77 20 50 72 6f 78 79 28 7b 7d 2c 20 7b 0a 20 20 67 65 74 20 28 74 61 72 | orts,.new.Proxy({},.{...get.(tar |
eb20 | 67 65 74 2c 20 70 72 6f 70 65 72 74 79 29 20 7b 0a 20 20 20 20 69 66 20 28 21 61 70 70 2e 69 73 | get,.property).{.....if.(!app.is |
eb40 | 52 65 61 64 79 28 29 29 20 72 65 74 75 72 6e 0a 0a 20 20 20 20 63 6f 6e 73 74 20 6e 65 74 4c 6f | Ready()).return......const.netLo |
eb60 | 67 20 3d 20 73 65 73 73 69 6f 6e 2e 64 65 66 61 75 6c 74 53 65 73 73 69 6f 6e 2e 6e 65 74 4c 6f | g.=.session.defaultSession.netLo |
eb80 | 67 0a 0a 20 20 20 20 69 66 20 28 21 4f 62 6a 65 63 74 2e 67 65 74 50 72 6f 74 6f 74 79 70 65 4f | g......if.(!Object.getPrototypeO |
eba0 | 66 28 6e 65 74 4c 6f 67 29 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 70 72 6f 70 65 72 74 | f(netLog).hasOwnProperty(propert |
ebc0 | 79 29 29 20 72 65 74 75 72 6e 0a 0a 20 20 20 20 2f 2f 20 63 68 65 63 6b 20 66 6f 72 20 70 72 6f | y)).return......//.check.for.pro |
ebe0 | 70 65 72 74 69 65 73 20 6f 6e 20 74 68 65 20 70 72 6f 74 6f 74 79 70 65 20 63 68 61 69 6e 20 20 | perties.on.the.prototype.chain.. |
ec00 | 74 68 61 74 20 61 72 65 6e 27 74 20 66 75 6e 63 74 69 6f 6e 73 0a 20 20 20 20 69 66 20 28 74 79 | that.aren't.functions.....if.(ty |
ec20 | 70 65 6f 66 20 6e 65 74 4c 6f 67 5b 70 72 6f 70 65 72 74 79 5d 20 21 3d 3d 20 27 66 75 6e 63 74 | peof.netLog[property].!==.'funct |
ec40 | 69 6f 6e 27 29 20 72 65 74 75 72 6e 20 6e 65 74 4c 6f 67 5b 70 72 6f 70 65 72 74 79 5d 0a 0a 20 | ion').return.netLog[property]... |
ec60 | 20 20 20 2f 2f 20 52 65 74 75 72 6e 69 6e 67 20 61 20 6e 61 74 69 76 65 20 66 75 6e 63 74 69 6f | ...//.Returning.a.native.functio |
ec80 | 6e 20 64 69 72 65 63 74 6c 79 20 77 6f 75 6c 64 20 74 68 72 6f 77 20 65 72 72 6f 72 2e 0a 20 20 | n.directly.would.throw.error.... |
eca0 | 20 20 72 65 74 75 72 6e 20 28 2e 2e 2e 61 72 67 73 29 20 3d 3e 20 6e 65 74 4c 6f 67 5b 70 72 6f | ..return.(...args).=>.netLog[pro |
ecc0 | 70 65 72 74 79 5d 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 2c 0a 0a 20 20 6f 77 6e 4b 65 79 73 20 | perty](...args)...},....ownKeys. |
ece0 | 28 29 20 7b 0a 20 20 20 20 69 66 20 28 21 61 70 70 2e 69 73 52 65 61 64 79 28 29 29 20 72 65 74 | ().{.....if.(!app.isReady()).ret |
ed00 | 75 72 6e 20 5b 5d 0a 0a 20 20 20 20 72 65 74 75 72 6e 20 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e | urn.[]......return.Object.getOwn |
ed20 | 50 72 6f 70 65 72 74 79 4e 61 6d 65 73 28 4f 62 6a 65 63 74 2e 67 65 74 50 72 6f 74 6f 74 79 70 | PropertyNames(Object.getPrototyp |
ed40 | 65 4f 66 28 73 65 73 73 69 6f 6e 2e 64 65 66 61 75 6c 74 53 65 73 73 69 6f 6e 2e 6e 65 74 4c 6f | eOf(session.defaultSession.netLo |
ed60 | 67 29 29 0a 20 20 7d 2c 0a 0a 20 20 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 44 65 73 63 72 69 | g))...},....getOwnPropertyDescri |
ed80 | 70 74 6f 72 20 28 74 61 72 67 65 74 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 7b 20 63 6f 6e | ptor.(target).{.....return.{.con |
eda0 | 66 69 67 75 72 61 62 6c 65 3a 20 74 72 75 65 2c 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 | figurable:.true,.enumerable:.tru |
edc0 | 65 20 7d 0a 20 20 7d 0a 7d 29 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 | e.}...}.})).'use.strict'..const. |
ede0 | 75 72 6c 20 3d 20 72 65 71 75 69 72 65 28 27 75 72 6c 27 29 0a 63 6f 6e 73 74 20 7b 20 45 76 65 | url.=.require('url').const.{.Eve |
ee00 | 6e 74 45 6d 69 74 74 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a | ntEmitter.}.=.require('events'). |
ee20 | 63 6f 6e 73 74 20 7b 20 52 65 61 64 61 62 6c 65 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 73 74 | const.{.Readable.}.=.require('st |
ee40 | 72 65 61 6d 27 29 0a 63 6f 6e 73 74 20 7b 20 61 70 70 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 | ream').const.{.app.}.=.require(' |
ee60 | 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 7b 20 53 65 73 73 69 6f 6e 20 7d 20 3d 20 70 | electron').const.{.Session.}.=.p |
ee80 | 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 73 65 73 73 69 6f 6e 27 29 0a 63 6f | rocess.atomBinding('session').co |
eea0 | 6e 73 74 20 7b 20 6e 65 74 2c 20 4e 65 74 20 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 | nst.{.net,.Net.}.=.process.atomB |
eec0 | 69 6e 64 69 6e 67 28 27 6e 65 74 27 29 0a 63 6f 6e 73 74 20 7b 20 55 52 4c 52 65 71 75 65 73 74 | inding('net').const.{.URLRequest |
eee0 | 20 7d 20 3d 20 6e 65 74 0a 0a 2f 2f 20 4e 65 74 20 69 73 20 61 6e 20 45 76 65 6e 74 45 6d 69 74 | .}.=.net..//.Net.is.an.EventEmit |
ef00 | 74 65 72 2e 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 4e 65 74 2e 70 | ter..Object.setPrototypeOf(Net.p |
ef20 | 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 | rototype,.EventEmitter.prototype |
ef40 | 29 0a 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 63 61 6c 6c 28 6e 65 74 29 0a 0a 4f 62 6a 65 63 74 | ).EventEmitter.call(net)..Object |
ef60 | 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 55 52 4c 52 65 71 75 65 73 74 2e 70 72 6f 74 6f | .setPrototypeOf(URLRequest.proto |
ef80 | 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 0a 63 | type,.EventEmitter.prototype)..c |
efa0 | 6f 6e 73 74 20 6b 53 75 70 70 6f 72 74 65 64 50 72 6f 74 6f 63 6f 6c 73 20 3d 20 6e 65 77 20 53 | onst.kSupportedProtocols.=.new.S |
efc0 | 65 74 28 5b 27 68 74 74 70 3a 27 2c 20 27 68 74 74 70 73 3a 27 5d 29 0a 0a 63 6c 61 73 73 20 49 | et(['http:',.'https:'])..class.I |
efe0 | 6e 63 6f 6d 69 6e 67 4d 65 73 73 61 67 65 20 65 78 74 65 6e 64 73 20 52 65 61 64 61 62 6c 65 20 | ncomingMessage.extends.Readable. |
f000 | 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 75 72 6c 52 65 71 75 65 73 74 29 20 7b 0a 20 | {...constructor.(urlRequest).{.. |
f020 | 20 20 20 73 75 70 65 72 28 29 0a 20 20 20 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 20 3d | ...super().....this.urlRequest.= |
f040 | 20 75 72 6c 52 65 71 75 65 73 74 0a 20 20 20 20 74 68 69 73 2e 73 68 6f 75 6c 64 50 75 73 68 20 | .urlRequest.....this.shouldPush. |
f060 | 3d 20 66 61 6c 73 65 0a 20 20 20 20 74 68 69 73 2e 64 61 74 61 20 3d 20 5b 5d 0a 20 20 20 20 74 | =.false.....this.data.=.[].....t |
f080 | 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 6f 6e 28 27 64 61 74 61 27 2c 20 28 65 76 65 6e 74 | his.urlRequest.on('data',.(event |
f0a0 | 2c 20 63 68 75 6e 6b 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 73 74 6f 72 65 49 | ,.chunk).=>.{.......this._storeI |
f0c0 | 6e 74 65 72 6e 61 6c 44 61 74 61 28 63 68 75 6e 6b 29 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 70 | nternalData(chunk).......this._p |
f0e0 | 75 73 68 49 6e 74 65 72 6e 61 6c 44 61 74 61 28 29 0a 20 20 20 20 7d 29 0a 20 20 20 20 74 68 69 | ushInternalData().....}).....thi |
f100 | 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 6f 6e 28 27 65 6e 64 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 | s.urlRequest.on('end',.().=>.{.. |
f120 | 20 20 20 20 20 74 68 69 73 2e 5f 73 74 6f 72 65 49 6e 74 65 72 6e 61 6c 44 61 74 61 28 6e 75 6c | .....this._storeInternalData(nul |
f140 | 6c 29 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 70 75 73 68 49 6e 74 65 72 6e 61 6c 44 61 74 61 28 | l).......this._pushInternalData( |
f160 | 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 67 65 74 20 73 74 61 74 75 73 43 6f 64 65 20 28 | ).....})...}....get.statusCode.( |
f180 | 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 73 | ).{.....return.this.urlRequest.s |
f1a0 | 74 61 74 75 73 43 6f 64 65 0a 20 20 7d 0a 0a 20 20 67 65 74 20 73 74 61 74 75 73 4d 65 73 73 61 | tatusCode...}....get.statusMessa |
f1c0 | 67 65 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 | ge.().{.....return.this.urlReque |
f1e0 | 73 74 2e 73 74 61 74 75 73 4d 65 73 73 61 67 65 0a 20 20 7d 0a 0a 20 20 67 65 74 20 68 65 61 64 | st.statusMessage...}....get.head |
f200 | 65 72 73 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 75 72 6c 52 65 71 75 | ers.().{.....return.this.urlRequ |
f220 | 65 73 74 2e 72 61 77 52 65 73 70 6f 6e 73 65 48 65 61 64 65 72 73 0a 20 20 7d 0a 0a 20 20 67 65 | est.rawResponseHeaders...}....ge |
f240 | 74 20 68 74 74 70 56 65 72 73 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 60 24 | t.httpVersion.().{.....return.`$ |
f260 | 7b 74 68 69 73 2e 68 74 74 70 56 65 72 73 69 6f 6e 4d 61 6a 6f 72 7d 2e 24 7b 74 68 69 73 2e 68 | {this.httpVersionMajor}.${this.h |
f280 | 74 74 70 56 65 72 73 69 6f 6e 4d 69 6e 6f 72 7d 60 0a 20 20 7d 0a 0a 20 20 67 65 74 20 68 74 74 | ttpVersionMinor}`...}....get.htt |
f2a0 | 70 56 65 72 73 69 6f 6e 4d 61 6a 6f 72 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 | pVersionMajor.().{.....return.th |
f2c0 | 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 68 74 74 70 56 65 72 73 69 6f 6e 4d 61 6a 6f 72 0a 20 | is.urlRequest.httpVersionMajor.. |
f2e0 | 20 7d 0a 0a 20 20 67 65 74 20 68 74 74 70 56 65 72 73 69 6f 6e 4d 69 6e 6f 72 20 28 29 20 7b 0a | .}....get.httpVersionMinor.().{. |
f300 | 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 68 74 74 70 56 | ....return.this.urlRequest.httpV |
f320 | 65 72 73 69 6f 6e 4d 69 6e 6f 72 0a 20 20 7d 0a 0a 20 20 67 65 74 20 72 61 77 54 72 61 69 6c 65 | ersionMinor...}....get.rawTraile |
f340 | 72 73 20 28 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 48 54 54 | rs.().{.....throw.new.Error('HTT |
f360 | 50 20 74 72 61 69 6c 65 72 73 20 61 72 65 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 2e 27 29 0a | P.trailers.are.not.supported.'). |
f380 | 20 20 7d 0a 0a 20 20 67 65 74 20 74 72 61 69 6c 65 72 73 20 28 29 20 7b 0a 20 20 20 20 74 68 72 | ..}....get.trailers.().{.....thr |
f3a0 | 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 48 54 54 50 20 74 72 61 69 6c 65 72 73 20 61 72 65 20 | ow.new.Error('HTTP.trailers.are. |
f3c0 | 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 2e 27 29 0a 20 20 7d 0a 0a 20 20 5f 73 74 6f 72 65 49 6e | not.supported.')...}...._storeIn |
f3e0 | 74 65 72 6e 61 6c 44 61 74 61 20 28 63 68 75 6e 6b 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 64 61 | ternalData.(chunk).{.....this.da |
f400 | 74 61 2e 70 75 73 68 28 63 68 75 6e 6b 29 0a 20 20 7d 0a 0a 20 20 5f 70 75 73 68 49 6e 74 65 72 | ta.push(chunk)...}...._pushInter |
f420 | 6e 61 6c 44 61 74 61 20 28 29 20 7b 0a 20 20 20 20 77 68 69 6c 65 20 28 74 68 69 73 2e 73 68 6f | nalData.().{.....while.(this.sho |
f440 | 75 6c 64 50 75 73 68 20 26 26 20 74 68 69 73 2e 64 61 74 61 2e 6c 65 6e 67 74 68 20 3e 20 30 29 | uldPush.&&.this.data.length.>.0) |
f460 | 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 63 68 75 6e 6b 20 3d 20 74 68 69 73 2e 64 61 74 61 | .{.......const.chunk.=.this.data |
f480 | 2e 73 68 69 66 74 28 29 0a 20 20 20 20 20 20 74 68 69 73 2e 73 68 6f 75 6c 64 50 75 73 68 20 3d | .shift().......this.shouldPush.= |
f4a0 | 20 74 68 69 73 2e 70 75 73 68 28 63 68 75 6e 6b 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 5f | .this.push(chunk).....}...}...._ |
f4c0 | 72 65 61 64 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 73 68 6f 75 6c 64 50 75 73 68 20 3d 20 | read.().{.....this.shouldPush.=. |
f4e0 | 74 72 75 65 0a 20 20 20 20 74 68 69 73 2e 5f 70 75 73 68 49 6e 74 65 72 6e 61 6c 44 61 74 61 28 | true.....this._pushInternalData( |
f500 | 29 0a 20 20 7d 0a 7d 0a 0a 55 52 4c 52 65 71 75 65 73 74 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 65 | )...}.}..URLRequest.prototype._e |
f520 | 6d 69 74 52 65 71 75 65 73 74 45 76 65 6e 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 69 73 41 73 | mitRequestEvent.=.function.(isAs |
f540 | 79 6e 63 2c 20 2e 2e 2e 72 65 73 74 29 20 7b 0a 20 20 69 66 20 28 69 73 41 73 79 6e 63 29 20 7b | ync,....rest).{...if.(isAsync).{ |
f560 | 0a 20 20 20 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 28 29 20 3d 3e 20 7b 0a 20 20 | .....process.nextTick(().=>.{... |
f580 | 20 20 20 20 74 68 69 73 2e 63 6c 69 65 6e 74 52 65 71 75 65 73 74 2e 65 6d 69 74 28 2e 2e 2e 72 | ....this.clientRequest.emit(...r |
f5a0 | 65 73 74 29 0a 20 20 20 20 7d 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 74 68 69 73 2e | est).....})...}.else.{.....this. |
f5c0 | 63 6c 69 65 6e 74 52 65 71 75 65 73 74 2e 65 6d 69 74 28 2e 2e 2e 72 65 73 74 29 0a 20 20 7d 0a | clientRequest.emit(...rest)...}. |
f5e0 | 7d 0a 0a 55 52 4c 52 65 71 75 65 73 74 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 65 6d 69 74 52 65 73 | }..URLRequest.prototype._emitRes |
f600 | 70 6f 6e 73 65 45 76 65 6e 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 69 73 41 73 79 6e 63 2c 20 | ponseEvent.=.function.(isAsync,. |
f620 | 2e 2e 2e 72 65 73 74 29 20 7b 0a 20 20 69 66 20 28 69 73 41 73 79 6e 63 29 20 7b 0a 20 20 20 20 | ...rest).{...if.(isAsync).{..... |
f640 | 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 | process.nextTick(().=>.{.......t |
f660 | 68 69 73 2e 5f 72 65 73 70 6f 6e 73 65 2e 65 6d 69 74 28 2e 2e 2e 72 65 73 74 29 0a 20 20 20 20 | his._response.emit(...rest)..... |
f680 | 7d 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 74 68 69 73 2e 5f 72 65 73 70 6f 6e 73 65 | })...}.else.{.....this._response |
f6a0 | 2e 65 6d 69 74 28 2e 2e 2e 72 65 73 74 29 0a 20 20 7d 0a 7d 0a 0a 63 6c 61 73 73 20 43 6c 69 65 | .emit(...rest)...}.}..class.Clie |
f6c0 | 6e 74 52 65 71 75 65 73 74 20 65 78 74 65 6e 64 73 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7b | ntRequest.extends.EventEmitter.{ |
f6e0 | 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 | ...constructor.(options,.callbac |
f700 | 6b 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 0a 20 20 20 20 69 66 20 28 21 61 70 70 2e 69 | k).{.....super()......if.(!app.i |
f720 | 73 52 65 61 64 79 28 29 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f | sReady()).{.......throw.new.Erro |
f740 | 72 28 27 6e 65 74 20 6d 6f 64 75 6c 65 20 63 61 6e 20 6f 6e 6c 79 20 62 65 20 75 73 65 64 20 61 | r('net.module.can.only.be.used.a |
f760 | 66 74 65 72 20 61 70 70 20 69 73 20 72 65 61 64 79 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 | fter.app.is.ready').....}......i |
f780 | 66 20 28 74 79 70 65 6f 66 20 6f 70 74 69 6f 6e 73 20 3d 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 | f.(typeof.options.===.'string'). |
f7a0 | 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 20 3d 20 75 72 6c 2e 70 61 72 73 65 28 6f 70 74 69 | {.......options.=.url.parse(opti |
f7c0 | 6f 6e 73 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 20 | ons).....}.else.{.......options. |
f7e0 | 3d 20 4f 62 6a 65 63 74 2e 61 73 73 69 67 6e 28 7b 7d 2c 20 6f 70 74 69 6f 6e 73 29 0a 20 20 20 | =.Object.assign({},.options).... |
f800 | 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 6d 65 74 68 6f 64 20 3d 20 28 6f 70 74 69 6f 6e 73 2e | .}......const.method.=.(options. |
f820 | 6d 65 74 68 6f 64 20 7c 7c 20 27 47 45 54 27 29 2e 74 6f 55 70 70 65 72 43 61 73 65 28 29 0a 20 | method.||.'GET').toUpperCase().. |
f840 | 20 20 20 6c 65 74 20 75 72 6c 53 74 72 20 3d 20 6f 70 74 69 6f 6e 73 2e 75 72 6c 0a 0a 20 20 20 | ...let.urlStr.=.options.url..... |
f860 | 20 69 66 20 28 21 75 72 6c 53 74 72 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 75 72 6c 4f | .if.(!urlStr).{.......const.urlO |
f880 | 62 6a 20 3d 20 7b 7d 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 70 72 6f 74 6f 63 6f 6c 20 3d 20 6f | bj.=.{}.......const.protocol.=.o |
f8a0 | 70 74 69 6f 6e 73 2e 70 72 6f 74 6f 63 6f 6c 20 7c 7c 20 27 68 74 74 70 3a 27 0a 20 20 20 20 20 | ptions.protocol.||.'http:'...... |
f8c0 | 20 69 66 20 28 21 6b 53 75 70 70 6f 72 74 65 64 50 72 6f 74 6f 63 6f 6c 73 2e 68 61 73 28 70 72 | .if.(!kSupportedProtocols.has(pr |
f8e0 | 6f 74 6f 63 6f 6c 29 29 20 7b 0a 20 20 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 | otocol)).{.........throw.new.Err |
f900 | 6f 72 28 27 50 72 6f 74 6f 63 6f 6c 20 22 27 20 2b 20 70 72 6f 74 6f 63 6f 6c 20 2b 20 27 22 20 | or('Protocol."'.+.protocol.+.'". |
f920 | 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 2e 20 27 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 | not.supported..').......}....... |
f940 | 75 72 6c 4f 62 6a 2e 70 72 6f 74 6f 63 6f 6c 20 3d 20 70 72 6f 74 6f 63 6f 6c 0a 0a 20 20 20 20 | urlObj.protocol.=.protocol...... |
f960 | 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 68 6f 73 74 29 20 7b 0a 20 20 20 20 20 20 20 20 75 72 | ..if.(options.host).{.........ur |
f980 | 6c 4f 62 6a 2e 68 6f 73 74 20 3d 20 6f 70 74 69 6f 6e 73 2e 68 6f 73 74 0a 20 20 20 20 20 20 7d | lObj.host.=.options.host.......} |
f9a0 | 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 68 6f 73 74 | .else.{.........if.(options.host |
f9c0 | 6e 61 6d 65 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 75 72 6c 4f 62 6a 2e 68 6f 73 74 6e 61 6d | name).{...........urlObj.hostnam |
f9e0 | 65 20 3d 20 6f 70 74 69 6f 6e 73 2e 68 6f 73 74 6e 61 6d 65 0a 20 20 20 20 20 20 20 20 7d 20 65 | e.=.options.hostname.........}.e |
fa00 | 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 20 20 75 72 6c 4f 62 6a 2e 68 6f 73 74 6e 61 6d 65 20 | lse.{...........urlObj.hostname. |
fa20 | 3d 20 27 6c 6f 63 61 6c 68 6f 73 74 27 0a 20 20 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 20 | =.'localhost'.........}......... |
fa40 | 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 70 6f 72 74 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 75 | .if.(options.port).{...........u |
fa60 | 72 6c 4f 62 6a 2e 70 6f 72 74 20 3d 20 6f 70 74 69 6f 6e 73 2e 70 6f 72 74 0a 20 20 20 20 20 20 | rlObj.port.=.options.port....... |
fa80 | 20 20 7d 0a 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 70 | ..}.......}........if.(options.p |
faa0 | 61 74 68 20 26 26 20 2f 20 2f 2e 74 65 73 74 28 6f 70 74 69 6f 6e 73 2e 70 61 74 68 29 29 20 7b | ath.&&././.test(options.path)).{ |
fac0 | 0a 20 20 20 20 20 20 20 20 2f 2f 20 54 68 65 20 61 63 74 75 61 6c 20 72 65 67 65 78 20 69 73 20 | .........//.The.actual.regex.is. |
fae0 | 6d 6f 72 65 20 6c 69 6b 65 20 2f 5b 5e 41 2d 5a 61 2d 7a 30 2d 39 5c 2d 2e 5f 7e 21 24 26 27 28 | more.like./[^A-Za-z0-9\-._~!$&'( |
fb00 | 29 2a 2b 2c 3b 3d 2f 3a 40 5d 2f 0a 20 20 20 20 20 20 20 20 2f 2f 20 77 69 74 68 20 61 6e 20 61 | )*+,;=/:@]/.........//.with.an.a |
fb20 | 64 64 69 74 69 6f 6e 61 6c 20 72 75 6c 65 20 66 6f 72 20 69 67 6e 6f 72 69 6e 67 20 70 65 72 63 | dditional.rule.for.ignoring.perc |
fb40 | 65 6e 74 61 67 65 2d 65 73 63 61 70 65 64 20 63 68 61 72 61 63 74 65 72 73 0a 20 20 20 20 20 20 | entage-escaped.characters....... |
fb60 | 20 20 2f 2f 20 62 75 74 20 74 68 61 74 27 73 20 61 29 20 68 61 72 64 20 74 6f 20 63 61 70 74 75 | ..//.but.that's.a).hard.to.captu |
fb80 | 72 65 20 69 6e 20 61 20 72 65 67 75 6c 61 72 20 65 78 70 72 65 73 73 69 6f 6e 20 74 68 61 74 20 | re.in.a.regular.expression.that. |
fba0 | 70 65 72 66 6f 72 6d 73 0a 20 20 20 20 20 20 20 20 2f 2f 20 77 65 6c 6c 2c 20 61 6e 64 20 62 29 | performs.........//.well,.and.b) |
fbc0 | 20 70 6f 73 73 69 62 6c 79 20 74 6f 6f 20 72 65 73 74 72 69 63 74 69 76 65 20 66 6f 72 20 72 65 | .possibly.too.restrictive.for.re |
fbe0 | 61 6c 2d 77 6f 72 6c 64 20 75 73 61 67 65 2e 20 54 68 61 74 27 73 0a 20 20 20 20 20 20 20 20 2f | al-world.usage..That's........./ |
fc00 | 2f 20 77 68 79 20 69 74 20 6f 6e 6c 79 20 73 63 61 6e 73 20 66 6f 72 20 73 70 61 63 65 73 20 62 | /.why.it.only.scans.for.spaces.b |
fc20 | 65 63 61 75 73 65 20 74 68 6f 73 65 20 61 72 65 20 67 75 61 72 61 6e 74 65 65 64 20 74 6f 20 63 | ecause.those.are.guaranteed.to.c |
fc40 | 72 65 61 74 65 0a 20 20 20 20 20 20 20 20 2f 2f 20 61 6e 20 69 6e 76 61 6c 69 64 20 72 65 71 75 | reate.........//.an.invalid.requ |
fc60 | 65 73 74 2e 0a 20 20 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 | est..........throw.new.TypeError |
fc80 | 28 27 52 65 71 75 65 73 74 20 70 61 74 68 20 63 6f 6e 74 61 69 6e 73 20 75 6e 65 73 63 61 70 65 | ('Request.path.contains.unescape |
fca0 | 64 20 63 68 61 72 61 63 74 65 72 73 2e 27 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 63 6f | d.characters.').......}.......co |
fcc0 | 6e 73 74 20 70 61 74 68 4f 62 6a 20 3d 20 75 72 6c 2e 70 61 72 73 65 28 6f 70 74 69 6f 6e 73 2e | nst.pathObj.=.url.parse(options. |
fce0 | 70 61 74 68 20 7c 7c 20 27 2f 27 29 0a 20 20 20 20 20 20 75 72 6c 4f 62 6a 2e 70 61 74 68 6e 61 | path.||.'/').......urlObj.pathna |
fd00 | 6d 65 20 3d 20 70 61 74 68 4f 62 6a 2e 70 61 74 68 6e 61 6d 65 0a 20 20 20 20 20 20 75 72 6c 4f | me.=.pathObj.pathname.......urlO |
fd20 | 62 6a 2e 73 65 61 72 63 68 20 3d 20 70 61 74 68 4f 62 6a 2e 73 65 61 72 63 68 0a 20 20 20 20 20 | bj.search.=.pathObj.search...... |
fd40 | 20 75 72 6c 4f 62 6a 2e 68 61 73 68 20 3d 20 70 61 74 68 4f 62 6a 2e 68 61 73 68 0a 20 20 20 20 | .urlObj.hash.=.pathObj.hash..... |
fd60 | 20 20 75 72 6c 53 74 72 20 3d 20 75 72 6c 2e 66 6f 72 6d 61 74 28 75 72 6c 4f 62 6a 29 0a 20 20 | ..urlStr.=.url.format(urlObj)... |
fd80 | 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 72 65 64 69 72 65 63 74 50 6f 6c 69 63 79 20 3d 20 | ..}......const.redirectPolicy.=. |
fda0 | 6f 70 74 69 6f 6e 73 2e 72 65 64 69 72 65 63 74 20 7c 7c 20 27 66 6f 6c 6c 6f 77 27 0a 20 20 20 | options.redirect.||.'follow'.... |
fdc0 | 20 69 66 20 28 21 5b 27 66 6f 6c 6c 6f 77 27 2c 20 27 65 72 72 6f 72 27 2c 20 27 6d 61 6e 75 61 | .if.(!['follow',.'error',.'manua |
fde0 | 6c 27 5d 2e 69 6e 63 6c 75 64 65 73 28 72 65 64 69 72 65 63 74 50 6f 6c 69 63 79 29 29 20 7b 0a | l'].includes(redirectPolicy)).{. |
fe00 | 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 72 65 64 69 72 65 63 74 20 | ......throw.new.Error('redirect. |
fe20 | 6d 6f 64 65 20 73 68 6f 75 6c 64 20 62 65 20 6f 6e 65 20 6f 66 20 66 6f 6c 6c 6f 77 2c 20 65 72 | mode.should.be.one.of.follow,.er |
fe40 | 72 6f 72 20 6f 72 20 6d 61 6e 75 61 6c 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 | ror.or.manual').....}......const |
fe60 | 20 75 72 6c 52 65 71 75 65 73 74 4f 70 74 69 6f 6e 73 20 3d 20 7b 0a 20 20 20 20 20 20 6d 65 74 | .urlRequestOptions.=.{.......met |
fe80 | 68 6f 64 3a 20 6d 65 74 68 6f 64 2c 0a 20 20 20 20 20 20 75 72 6c 3a 20 75 72 6c 53 74 72 2c 0a | hod:.method,.......url:.urlStr,. |
fea0 | 20 20 20 20 20 20 72 65 64 69 72 65 63 74 3a 20 72 65 64 69 72 65 63 74 50 6f 6c 69 63 79 0a 20 | ......redirect:.redirectPolicy.. |
fec0 | 20 20 20 7d 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 73 65 73 73 69 6f 6e 29 20 7b 0a | ...}.....if.(options.session).{. |
fee0 | 20 20 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 73 65 73 73 69 6f 6e 20 69 6e 73 74 61 6e | ......if.(options.session.instan |
ff00 | 63 65 6f 66 20 53 65 73 73 69 6f 6e 29 20 7b 0a 20 20 20 20 20 20 20 20 75 72 6c 52 65 71 75 65 | ceof.Session).{.........urlReque |
ff20 | 73 74 4f 70 74 69 6f 6e 73 2e 73 65 73 73 69 6f 6e 20 3d 20 6f 70 74 69 6f 6e 73 2e 73 65 73 73 | stOptions.session.=.options.sess |
ff40 | 69 6f 6e 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 74 68 72 6f 77 | ion.......}.else.{.........throw |
ff60 | 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 60 73 65 73 73 69 6f 6e 60 20 73 68 6f 75 6c 64 | .new.TypeError('`session`.should |
ff80 | 20 62 65 20 61 6e 20 69 6e 73 74 61 6e 63 65 20 6f 66 20 74 68 65 20 53 65 73 73 69 6f 6e 20 63 | .be.an.instance.of.the.Session.c |
ffa0 | 6c 61 73 73 2e 27 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 6f | lass.').......}.....}.else.if.(o |
ffc0 | 70 74 69 6f 6e 73 2e 70 61 72 74 69 74 69 6f 6e 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 74 79 | ptions.partition).{.......if.(ty |
ffe0 | 70 65 6f 66 20 6f 70 74 69 6f 6e 73 2e 70 61 72 74 69 74 69 6f 6e 20 3d 3d 3d 20 27 73 74 72 69 | peof.options.partition.===.'stri |
10000 | 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 20 20 75 72 6c 52 65 71 75 65 73 74 4f 70 74 69 6f 6e 73 | ng').{.........urlRequestOptions |
10020 | 2e 70 61 72 74 69 74 69 6f 6e 20 3d 20 6f 70 74 69 6f 6e 73 2e 70 61 72 74 69 74 69 6f 6e 0a 20 | .partition.=.options.partition.. |
10040 | 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 | .....}.else.{.........throw.new. |
10060 | 54 79 70 65 45 72 72 6f 72 28 27 60 70 61 72 74 69 74 69 6f 6e 60 20 73 68 6f 75 6c 64 20 62 65 | TypeError('`partition`.should.be |
10080 | 20 61 6e 20 61 20 73 74 72 69 6e 67 2e 27 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 | .an.a.string.').......}.....}... |
100a0 | 20 20 20 63 6f 6e 73 74 20 75 72 6c 52 65 71 75 65 73 74 20 3d 20 6e 65 77 20 55 52 4c 52 65 71 | ...const.urlRequest.=.new.URLReq |
100c0 | 75 65 73 74 28 75 72 6c 52 65 71 75 65 73 74 4f 70 74 69 6f 6e 73 29 0a 0a 20 20 20 20 2f 2f 20 | uest(urlRequestOptions)......//. |
100e0 | 53 65 74 20 62 61 63 6b 20 61 6e 64 20 66 6f 72 77 61 72 64 20 6c 69 6e 6b 73 2e 0a 20 20 20 20 | Set.back.and.forward.links...... |
10100 | 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 20 3d 20 75 72 6c 52 65 71 75 65 73 74 0a 20 20 20 | this.urlRequest.=.urlRequest.... |
10120 | 20 75 72 6c 52 65 71 75 65 73 74 2e 63 6c 69 65 6e 74 52 65 71 75 65 73 74 20 3d 20 74 68 69 73 | .urlRequest.clientRequest.=.this |
10140 | 0a 0a 20 20 20 20 2f 2f 20 54 68 69 73 20 69 73 20 61 20 63 6f 70 79 20 6f 66 20 74 68 65 20 65 | ......//.This.is.a.copy.of.the.e |
10160 | 78 74 72 61 20 68 65 61 64 65 72 73 20 73 74 72 75 63 74 75 72 65 20 68 65 6c 64 20 62 79 20 74 | xtra.headers.structure.held.by.t |
10180 | 68 65 20 6e 61 74 69 76 65 0a 20 20 20 20 2f 2f 20 6e 65 74 3a 3a 55 52 4c 52 65 71 75 65 73 74 | he.native.....//.net::URLRequest |
101a0 | 2e 20 54 68 65 20 6d 61 69 6e 20 72 65 61 73 6f 6e 20 69 73 20 74 6f 20 6b 65 65 70 20 74 68 65 | ..The.main.reason.is.to.keep.the |
101c0 | 20 67 65 74 48 65 61 64 65 72 20 41 50 49 20 73 79 6e 63 68 72 6f 6e 6f 75 73 0a 20 20 20 20 2f | .getHeader.API.synchronous...../ |
101e0 | 2f 20 61 66 74 65 72 20 74 68 65 20 72 65 71 75 65 73 74 20 73 74 61 72 74 73 2e 0a 20 20 20 20 | /.after.the.request.starts...... |
10200 | 74 68 69 73 2e 65 78 74 72 61 48 65 61 64 65 72 73 20 3d 20 7b 7d 0a 0a 20 20 20 20 69 66 20 28 | this.extraHeaders.=.{}......if.( |
10220 | 6f 70 74 69 6f 6e 73 2e 68 65 61 64 65 72 73 29 20 7b 0a 20 20 20 20 20 20 66 6f 72 20 28 63 6f | options.headers).{.......for.(co |
10240 | 6e 73 74 20 6b 65 79 20 69 6e 20 6f 70 74 69 6f 6e 73 2e 68 65 61 64 65 72 73 29 20 7b 0a 20 20 | nst.key.in.options.headers).{... |
10260 | 20 20 20 20 20 20 74 68 69 73 2e 73 65 74 48 65 61 64 65 72 28 6b 65 79 2c 20 6f 70 74 69 6f 6e | ......this.setHeader(key,.option |
10280 | 73 2e 68 65 61 64 65 72 73 5b 6b 65 79 5d 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 | s.headers[key]).......}.....}... |
102a0 | 20 20 20 2f 2f 20 53 65 74 20 77 68 65 6e 20 74 68 65 20 72 65 71 75 65 73 74 20 75 73 65 73 20 | ...//.Set.when.the.request.uses. |
102c0 | 63 68 75 6e 6b 65 64 20 65 6e 63 6f 64 69 6e 67 2e 20 43 61 6e 20 62 65 20 73 77 69 74 63 68 65 | chunked.encoding..Can.be.switche |
102e0 | 64 0a 20 20 20 20 2f 2f 20 74 6f 20 74 72 75 65 20 6f 6e 6c 79 20 6f 6e 63 65 20 61 6e 64 20 6e | d.....//.to.true.only.once.and.n |
10300 | 65 76 65 72 20 73 65 74 20 62 61 63 6b 20 74 6f 20 66 61 6c 73 65 2e 0a 20 20 20 20 74 68 69 73 | ever.set.back.to.false......this |
10320 | 2e 63 68 75 6e 6b 65 64 45 6e 63 6f 64 69 6e 67 45 6e 61 62 6c 65 64 20 3d 20 66 61 6c 73 65 0a | .chunkedEncodingEnabled.=.false. |
10340 | 0a 20 20 20 20 75 72 6c 52 65 71 75 65 73 74 2e 6f 6e 28 27 72 65 73 70 6f 6e 73 65 27 2c 20 28 | .....urlRequest.on('response',.( |
10360 | 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 73 70 6f 6e 73 65 20 3d 20 6e 65 | ).=>.{.......const.response.=.ne |
10380 | 77 20 49 6e 63 6f 6d 69 6e 67 4d 65 73 73 61 67 65 28 75 72 6c 52 65 71 75 65 73 74 29 0a 20 20 | w.IncomingMessage(urlRequest)... |
103a0 | 20 20 20 20 75 72 6c 52 65 71 75 65 73 74 2e 5f 72 65 73 70 6f 6e 73 65 20 3d 20 72 65 73 70 6f | ....urlRequest._response.=.respo |
103c0 | 6e 73 65 0a 20 20 20 20 20 20 74 68 69 73 2e 65 6d 69 74 28 27 72 65 73 70 6f 6e 73 65 27 2c 20 | nse.......this.emit('response',. |
103e0 | 72 65 73 70 6f 6e 73 65 29 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 75 72 6c 52 65 71 75 65 73 74 | response).....})......urlRequest |
10400 | 2e 6f 6e 28 27 6c 6f 67 69 6e 27 2c 20 28 65 76 65 6e 74 2c 20 61 75 74 68 49 6e 66 6f 2c 20 63 | .on('login',.(event,.authInfo,.c |
10420 | 61 6c 6c 62 61 63 6b 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 65 6d 69 74 28 27 6c | allback).=>.{.......this.emit('l |
10440 | 6f 67 69 6e 27 2c 20 61 75 74 68 49 6e 66 6f 2c 20 28 75 73 65 72 6e 61 6d 65 2c 20 70 61 73 73 | ogin',.authInfo,.(username,.pass |
10460 | 77 6f 72 64 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 49 66 20 6e 75 6c 6c 20 6f 72 | word).=>.{.........//.If.null.or |
10480 | 20 75 6e 64 65 66 69 6e 65 64 20 75 73 65 72 6e 61 6d 65 2f 70 61 73 73 77 6f 72 64 2c 20 66 6f | .undefined.username/password,.fo |
104a0 | 72 63 65 20 74 6f 20 65 6d 70 74 79 20 73 74 72 69 6e 67 2e 0a 20 20 20 20 20 20 20 20 69 66 20 | rce.to.empty.string..........if. |
104c0 | 28 75 73 65 72 6e 61 6d 65 20 3d 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 75 73 65 72 6e 61 6d 65 20 3d | (username.===.null.||.username.= |
104e0 | 3d 3d 20 75 6e 64 65 66 69 6e 65 64 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 75 73 65 72 6e 61 | ==.undefined).{...........userna |
10500 | 6d 65 20 3d 20 27 27 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 69 66 20 28 74 79 | me.=.''.........}.........if.(ty |
10520 | 70 65 6f 66 20 75 73 65 72 6e 61 6d 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 | peof.username.!==.'string').{... |
10540 | 20 20 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 75 73 65 72 6e 61 6d | ........throw.new.Error('usernam |
10560 | 65 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 | e.must.be.a.string').........}.. |
10580 | 20 20 20 20 20 20 20 69 66 20 28 70 61 73 73 77 6f 72 64 20 3d 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 | .......if.(password.===.null.||. |
105a0 | 70 61 73 73 77 6f 72 64 20 3d 3d 3d 20 75 6e 64 65 66 69 6e 65 64 29 20 7b 0a 20 20 20 20 20 20 | password.===.undefined).{....... |
105c0 | 20 20 20 20 70 61 73 73 77 6f 72 64 20 3d 20 27 27 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 | ....password.=.''.........}..... |
105e0 | 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 70 61 73 73 77 6f 72 64 20 21 3d 3d 20 27 73 74 72 | ....if.(typeof.password.!==.'str |
10600 | 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f | ing').{...........throw.new.Erro |
10620 | 72 28 27 70 61 73 73 77 6f 72 64 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 6e 67 27 29 0a 20 | r('password.must.be.a.string').. |
10640 | 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 75 73 65 72 6e 61 | .......}.........callback(userna |
10660 | 6d 65 2c 20 70 61 73 73 77 6f 72 64 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 29 0a 0a 20 | me,.password).......}).....})... |
10680 | 20 20 20 69 66 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 6f 6e | ...if.(callback).{.......this.on |
106a0 | 63 65 28 27 72 65 73 70 6f 6e 73 65 27 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 20 20 7d 0a 20 | ce('response',.callback).....}.. |
106c0 | 20 7d 0a 0a 20 20 67 65 74 20 63 68 75 6e 6b 65 64 45 6e 63 6f 64 69 6e 67 20 28 29 20 7b 0a 20 | .}....get.chunkedEncoding.().{.. |
106e0 | 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 63 68 75 6e 6b 65 64 45 6e 63 6f 64 69 6e 67 45 6e | ...return.this.chunkedEncodingEn |
10700 | 61 62 6c 65 64 0a 20 20 7d 0a 0a 20 20 73 65 74 20 63 68 75 6e 6b 65 64 45 6e 63 6f 64 69 6e 67 | abled...}....set.chunkedEncoding |
10720 | 20 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 75 72 6c 52 65 71 75 | .(value).{.....if.(!this.urlRequ |
10740 | 65 73 74 2e 6e 6f 74 53 74 61 72 74 65 64 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 | est.notStarted).{.......throw.ne |
10760 | 77 20 45 72 72 6f 72 28 27 43 61 6e 5c 27 74 20 73 65 74 20 74 68 65 20 74 72 61 6e 73 66 65 72 | w.Error('Can\'t.set.the.transfer |
10780 | 20 65 6e 63 6f 64 69 6e 67 2c 20 68 65 61 64 65 72 73 20 68 61 76 65 20 62 65 65 6e 20 73 65 6e | .encoding,.headers.have.been.sen |
107a0 | 74 2e 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 73 2e 63 68 75 6e 6b 65 64 45 6e 63 6f 64 | t.').....}.....this.chunkedEncod |
107c0 | 69 6e 67 45 6e 61 62 6c 65 64 20 3d 20 76 61 6c 75 65 0a 20 20 7d 0a 0a 20 20 73 65 74 48 65 61 | ingEnabled.=.value...}....setHea |
107e0 | 64 65 72 20 28 6e 61 6d 65 2c 20 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 69 66 20 28 74 79 70 65 | der.(name,.value).{.....if.(type |
10800 | 6f 66 20 6e 61 6d 65 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 74 68 | of.name.!==.'string').{.......th |
10820 | 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 60 6e 61 6d 65 60 20 73 68 6f 75 6c 64 | row.new.TypeError('`name`.should |
10840 | 20 62 65 20 61 20 73 74 72 69 6e 67 20 69 6e 20 73 65 74 48 65 61 64 65 72 28 6e 61 6d 65 2c 20 | .be.a.string.in.setHeader(name,. |
10860 | 76 61 6c 75 65 29 2e 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 28 76 61 6c 75 65 20 3d 3d | value).').....}.....if.(value.== |
10880 | 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 | .null).{.......throw.new.Error(' |
108a0 | 60 76 61 6c 75 65 60 20 72 65 71 75 69 72 65 64 20 69 6e 20 73 65 74 48 65 61 64 65 72 28 22 27 | `value`.required.in.setHeader("' |
108c0 | 20 2b 20 6e 61 6d 65 20 2b 20 27 22 2c 20 76 61 6c 75 65 29 2e 27 29 0a 20 20 20 20 7d 0a 20 20 | .+.name.+.'",.value).').....}... |
108e0 | 20 20 69 66 20 28 21 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 6e 6f 74 53 74 61 72 74 65 | ..if.(!this.urlRequest.notStarte |
10900 | 64 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 43 61 6e 5c | d).{.......throw.new.Error('Can\ |
10920 | 27 74 20 73 65 74 20 68 65 61 64 65 72 73 20 61 66 74 65 72 20 74 68 65 79 20 61 72 65 20 73 65 | 't.set.headers.after.they.are.se |
10940 | 6e 74 2e 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 6b 65 79 20 3d 20 6e 61 6d | nt.').....}......const.key.=.nam |
10960 | 65 2e 74 6f 4c 6f 77 65 72 43 61 73 65 28 29 0a 20 20 20 20 74 68 69 73 2e 65 78 74 72 61 48 65 | e.toLowerCase().....this.extraHe |
10980 | 61 64 65 72 73 5b 6b 65 79 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 74 68 69 73 2e 75 72 6c 52 | aders[key].=.value.....this.urlR |
109a0 | 65 71 75 65 73 74 2e 73 65 74 45 78 74 72 61 48 65 61 64 65 72 28 6e 61 6d 65 2c 20 76 61 6c 75 | equest.setExtraHeader(name,.valu |
109c0 | 65 2e 74 6f 53 74 72 69 6e 67 28 29 29 0a 20 20 7d 0a 0a 20 20 67 65 74 48 65 61 64 65 72 20 28 | e.toString())...}....getHeader.( |
109e0 | 6e 61 6d 65 29 20 7b 0a 20 20 20 20 69 66 20 28 6e 61 6d 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a | name).{.....if.(name.==.null).{. |
10a00 | 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 60 6e 61 6d 65 60 20 69 73 | ......throw.new.Error('`name`.is |
10a20 | 20 72 65 71 75 69 72 65 64 20 66 6f 72 20 67 65 74 48 65 61 64 65 72 28 6e 61 6d 65 29 2e 27 29 | .required.for.getHeader(name).') |
10a40 | 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 65 78 74 72 61 48 65 61 64 65 | .....}......if.(!this.extraHeade |
10a60 | 72 73 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 6f | rs).{.......return.....}......co |
10a80 | 6e 73 74 20 6b 65 79 20 3d 20 6e 61 6d 65 2e 74 6f 4c 6f 77 65 72 43 61 73 65 28 29 0a 20 20 20 | nst.key.=.name.toLowerCase().... |
10aa0 | 20 72 65 74 75 72 6e 20 74 68 69 73 2e 65 78 74 72 61 48 65 61 64 65 72 73 5b 6b 65 79 5d 0a 20 | .return.this.extraHeaders[key].. |
10ac0 | 20 7d 0a 0a 20 20 72 65 6d 6f 76 65 48 65 61 64 65 72 20 28 6e 61 6d 65 29 20 7b 0a 20 20 20 20 | .}....removeHeader.(name).{..... |
10ae0 | 69 66 20 28 6e 61 6d 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 | if.(name.==.null).{.......throw. |
10b00 | 6e 65 77 20 45 72 72 6f 72 28 27 60 6e 61 6d 65 60 20 69 73 20 72 65 71 75 69 72 65 64 20 66 6f | new.Error('`name`.is.required.fo |
10b20 | 72 20 72 65 6d 6f 76 65 48 65 61 64 65 72 28 6e 61 6d 65 29 2e 27 29 0a 20 20 20 20 7d 0a 0a 20 | r.removeHeader(name).').....}... |
10b40 | 20 20 20 69 66 20 28 21 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 6e 6f 74 53 74 61 72 74 | ...if.(!this.urlRequest.notStart |
10b60 | 65 64 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 43 61 6e | ed).{.......throw.new.Error('Can |
10b80 | 5c 27 74 20 72 65 6d 6f 76 65 20 68 65 61 64 65 72 73 20 61 66 74 65 72 20 74 68 65 79 20 61 72 | \'t.remove.headers.after.they.ar |
10ba0 | 65 20 73 65 6e 74 2e 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 6b 65 79 20 3d | e.sent.').....}......const.key.= |
10bc0 | 20 6e 61 6d 65 2e 74 6f 4c 6f 77 65 72 43 61 73 65 28 29 0a 20 20 20 20 64 65 6c 65 74 65 20 74 | .name.toLowerCase().....delete.t |
10be0 | 68 69 73 2e 65 78 74 72 61 48 65 61 64 65 72 73 5b 6b 65 79 5d 0a 20 20 20 20 74 68 69 73 2e 75 | his.extraHeaders[key].....this.u |
10c00 | 72 6c 52 65 71 75 65 73 74 2e 72 65 6d 6f 76 65 45 78 74 72 61 48 65 61 64 65 72 28 6e 61 6d 65 | rlRequest.removeExtraHeader(name |
10c20 | 29 0a 20 20 7d 0a 0a 20 20 5f 77 72 69 74 65 20 28 63 68 75 6e 6b 2c 20 65 6e 63 6f 64 69 6e 67 | )...}...._write.(chunk,.encoding |
10c40 | 2c 20 63 61 6c 6c 62 61 63 6b 2c 20 69 73 4c 61 73 74 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 | ,.callback,.isLast).{.....const. |
10c60 | 63 68 75 6e 6b 49 73 53 74 72 69 6e 67 20 3d 20 74 79 70 65 6f 66 20 63 68 75 6e 6b 20 3d 3d 3d | chunkIsString.=.typeof.chunk.=== |
10c80 | 20 27 73 74 72 69 6e 67 27 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 75 6e 6b 49 73 42 75 66 66 65 | .'string'.....const.chunkIsBuffe |
10ca0 | 72 20 3d 20 63 68 75 6e 6b 20 69 6e 73 74 61 6e 63 65 6f 66 20 42 75 66 66 65 72 0a 20 20 20 20 | r.=.chunk.instanceof.Buffer..... |
10cc0 | 69 66 20 28 21 63 68 75 6e 6b 49 73 53 74 72 69 6e 67 20 26 26 20 21 63 68 75 6e 6b 49 73 42 75 | if.(!chunkIsString.&&.!chunkIsBu |
10ce0 | 66 66 65 72 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 70 65 45 72 72 6f | ffer).{.......throw.new.TypeErro |
10d00 | 72 28 27 46 69 72 73 74 20 61 72 67 75 6d 65 6e 74 20 6d 75 73 74 20 62 65 20 61 20 73 74 72 69 | r('First.argument.must.be.a.stri |
10d20 | 6e 67 20 6f 72 20 42 75 66 66 65 72 2e 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 63 | ng.or.Buffer.').....}......if.(c |
10d40 | 68 75 6e 6b 49 73 53 74 72 69 6e 67 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 57 65 20 63 6f 6e 76 | hunkIsString).{.......//.We.conv |
10d60 | 65 72 74 20 61 6c 6c 20 73 74 72 69 6e 67 73 20 69 6e 74 6f 20 62 69 6e 61 72 79 20 62 75 66 66 | ert.all.strings.into.binary.buff |
10d80 | 65 72 73 2e 0a 20 20 20 20 20 20 63 68 75 6e 6b 20 3d 20 42 75 66 66 65 72 2e 66 72 6f 6d 28 63 | ers........chunk.=.Buffer.from(c |
10da0 | 68 75 6e 6b 2c 20 65 6e 63 6f 64 69 6e 67 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 53 69 | hunk,.encoding).....}......//.Si |
10dc0 | 6e 63 65 20 77 72 69 74 69 6e 67 20 74 6f 20 74 68 65 20 6e 65 74 77 6f 72 6b 20 69 73 20 61 73 | nce.writing.to.the.network.is.as |
10de0 | 79 6e 63 68 72 6f 6e 6f 75 73 2c 20 77 65 20 63 6f 6e 73 65 72 76 61 74 69 76 65 6c 79 0a 20 20 | ynchronous,.we.conservatively... |
10e00 | 20 20 2f 2f 20 61 73 73 75 6d 65 20 74 68 61 74 20 72 65 71 75 65 73 74 20 68 65 61 64 65 72 73 | ..//.assume.that.request.headers |
10e20 | 20 61 72 65 20 77 72 69 74 74 65 6e 20 61 66 74 65 72 20 64 65 6c 69 76 65 72 69 6e 67 20 74 68 | .are.written.after.delivering.th |
10e40 | 65 20 66 69 72 73 74 0a 20 20 20 20 2f 2f 20 62 75 66 66 65 72 20 74 6f 20 74 68 65 20 6e 65 74 | e.first.....//.buffer.to.the.net |
10e60 | 77 6f 72 6b 20 49 4f 20 74 68 72 65 61 64 2e 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 75 72 6c | work.IO.thread......if.(this.url |
10e80 | 52 65 71 75 65 73 74 2e 6e 6f 74 53 74 61 72 74 65 64 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 | Request.notStarted).{.......this |
10ea0 | 2e 75 72 6c 52 65 71 75 65 73 74 2e 73 65 74 43 68 75 6e 6b 65 64 55 70 6c 6f 61 64 28 74 68 69 | .urlRequest.setChunkedUpload(thi |
10ec0 | 73 2e 63 68 75 6e 6b 65 64 45 6e 63 6f 64 69 6e 67 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f | s.chunkedEncoding).....}......// |
10ee0 | 20 48 65 61 64 65 72 73 20 61 72 65 20 61 73 73 75 6d 65 64 20 74 6f 20 62 65 20 73 65 6e 74 20 | .Headers.are.assumed.to.be.sent. |
10f00 | 6f 6e 20 66 69 72 73 74 20 63 61 6c 6c 20 74 6f 20 5f 77 72 69 74 65 42 75 66 66 65 72 2c 0a 20 | on.first.call.to._writeBuffer,.. |
10f20 | 20 20 20 2f 2f 20 69 2e 65 2e 20 61 66 74 65 72 20 74 68 65 20 66 69 72 73 74 20 63 61 6c 6c 20 | ...//.i.e..after.the.first.call. |
10f40 | 74 6f 20 77 72 69 74 65 20 6f 72 20 65 6e 64 2e 0a 20 20 20 20 63 6f 6e 73 74 20 72 65 73 75 6c | to.write.or.end......const.resul |
10f60 | 74 20 3d 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 77 72 69 74 65 28 63 68 75 6e 6b 2c | t.=.this.urlRequest.write(chunk, |
10f80 | 20 69 73 4c 61 73 74 29 0a 0a 20 20 20 20 2f 2f 20 54 68 65 20 77 72 69 74 65 20 63 61 6c 6c 62 | .isLast)......//.The.write.callb |
10fa0 | 61 63 6b 20 69 73 20 66 69 72 65 64 20 61 73 79 6e 63 68 72 6f 6e 6f 75 73 6c 79 20 74 6f 20 6d | ack.is.fired.asynchronously.to.m |
10fc0 | 69 6d 69 63 20 4e 6f 64 65 2e 6a 73 2e 0a 20 20 20 20 69 66 20 28 63 61 6c 6c 62 61 63 6b 29 20 | imic.Node.js......if.(callback). |
10fe0 | 7b 0a 20 20 20 20 20 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 63 61 6c 6c 62 61 63 | {.......process.nextTick(callbac |
11000 | 6b 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 72 65 74 75 72 6e 20 72 65 73 75 6c 74 0a 20 20 7d 0a | k).....}......return.result...}. |
11020 | 0a 20 20 77 72 69 74 65 20 28 64 61 74 61 2c 20 65 6e 63 6f 64 69 6e 67 2c 20 63 61 6c 6c 62 61 | ...write.(data,.encoding,.callba |
11040 | 63 6b 29 20 7b 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 66 69 | ck).{.....if.(this.urlRequest.fi |
11060 | 6e 69 73 68 65 64 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 65 72 72 6f 72 20 3d 20 6e 65 | nished).{.......const.error.=.ne |
11080 | 77 20 45 72 72 6f 72 28 27 57 72 69 74 65 20 61 66 74 65 72 20 65 6e 64 2e 27 29 0a 20 20 20 20 | w.Error('Write.after.end.')..... |
110a0 | 20 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 77 72 69 74 65 41 66 74 65 72 45 6e 64 | ..process.nextTick(writeAfterEnd |
110c0 | 4e 54 2c 20 74 68 69 73 2c 20 65 72 72 6f 72 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 20 20 20 | NT,.this,.error,.callback)...... |
110e0 | 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 20 20 7d 0a 0a 20 20 20 20 72 65 74 75 72 6e 20 74 | .return.true.....}......return.t |
11100 | 68 69 73 2e 5f 77 72 69 74 65 28 64 61 74 61 2c 20 65 6e 63 6f 64 69 6e 67 2c 20 63 61 6c 6c 62 | his._write(data,.encoding,.callb |
11120 | 61 63 6b 2c 20 66 61 6c 73 65 29 0a 20 20 7d 0a 0a 20 20 65 6e 64 20 28 64 61 74 61 2c 20 65 6e | ack,.false)...}....end.(data,.en |
11140 | 63 6f 64 69 6e 67 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 69 66 20 28 74 68 69 73 | coding,.callback).{.....if.(this |
11160 | 2e 75 72 6c 52 65 71 75 65 73 74 2e 66 69 6e 69 73 68 65 64 29 20 7b 0a 20 20 20 20 20 20 72 65 | .urlRequest.finished).{.......re |
11180 | 74 75 72 6e 20 66 61 6c 73 65 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 | turn.false.....}......if.(typeof |
111a0 | 20 64 61 74 61 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 63 61 | .data.===.'function').{.......ca |
111c0 | 6c 6c 62 61 63 6b 20 3d 20 64 61 74 61 0a 20 20 20 20 20 20 65 6e 63 6f 64 69 6e 67 20 3d 20 6e | llback.=.data.......encoding.=.n |
111e0 | 75 6c 6c 0a 20 20 20 20 20 20 64 61 74 61 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 7d 20 65 6c 73 65 | ull.......data.=.null.....}.else |
11200 | 20 69 66 20 28 74 79 70 65 6f 66 20 65 6e 63 6f 64 69 6e 67 20 3d 3d 3d 20 27 66 75 6e 63 74 69 | .if.(typeof.encoding.===.'functi |
11220 | 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 63 61 6c 6c 62 61 63 6b 20 3d 20 65 6e 63 6f 64 69 6e 67 | on').{.......callback.=.encoding |
11240 | 0a 20 20 20 20 20 20 65 6e 63 6f 64 69 6e 67 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 7d 0a 0a 20 20 | .......encoding.=.null.....}.... |
11260 | 20 20 64 61 74 61 20 3d 20 64 61 74 61 20 7c 7c 20 27 27 0a 0a 20 20 20 20 72 65 74 75 72 6e 20 | ..data.=.data.||.''......return. |
11280 | 74 68 69 73 2e 5f 77 72 69 74 65 28 64 61 74 61 2c 20 65 6e 63 6f 64 69 6e 67 2c 20 63 61 6c 6c | this._write(data,.encoding,.call |
112a0 | 62 61 63 6b 2c 20 74 72 75 65 29 0a 20 20 7d 0a 0a 20 20 66 6f 6c 6c 6f 77 52 65 64 69 72 65 63 | back,.true)...}....followRedirec |
112c0 | 74 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 66 6f 6c 6c 6f | t.().{.....this.urlRequest.follo |
112e0 | 77 52 65 64 69 72 65 63 74 28 29 0a 20 20 7d 0a 0a 20 20 61 62 6f 72 74 20 28 29 20 7b 0a 20 20 | wRedirect()...}....abort.().{... |
11300 | 20 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 63 61 6e 63 65 6c 28 29 0a 20 20 7d 0a 0a | ..this.urlRequest.cancel()...}.. |
11320 | 20 20 67 65 74 55 70 6c 6f 61 64 50 72 6f 67 72 65 73 73 20 28 29 20 7b 0a 20 20 20 20 72 65 74 | ..getUploadProgress.().{.....ret |
11340 | 75 72 6e 20 74 68 69 73 2e 75 72 6c 52 65 71 75 65 73 74 2e 67 65 74 55 70 6c 6f 61 64 50 72 6f | urn.this.urlRequest.getUploadPro |
11360 | 67 72 65 73 73 28 29 0a 20 20 7d 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 77 72 69 74 65 41 66 74 | gress()...}.}..function.writeAft |
11380 | 65 72 45 6e 64 4e 54 20 28 73 65 6c 66 2c 20 65 72 72 6f 72 2c 20 63 61 6c 6c 62 61 63 6b 29 20 | erEndNT.(self,.error,.callback). |
113a0 | 7b 0a 20 20 73 65 6c 66 2e 65 6d 69 74 28 27 65 72 72 6f 72 27 2c 20 65 72 72 6f 72 29 0a 20 20 | {...self.emit('error',.error)... |
113c0 | 69 66 20 28 63 61 6c 6c 62 61 63 6b 29 20 63 61 6c 6c 62 61 63 6b 28 65 72 72 6f 72 29 0a 7d 0a | if.(callback).callback(error).}. |
113e0 | 0a 4e 65 74 2e 70 72 6f 74 6f 74 79 70 65 2e 72 65 71 75 65 73 74 20 3d 20 66 75 6e 63 74 69 6f | .Net.prototype.request.=.functio |
11400 | 6e 20 28 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 72 65 74 75 72 6e | n.(options,.callback).{...return |
11420 | 20 6e 65 77 20 43 6c 69 65 6e 74 52 65 71 75 65 73 74 28 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c | .new.ClientRequest(options,.call |
11440 | 62 61 63 6b 29 0a 7d 0a 0a 6e 65 74 2e 43 6c 69 65 6e 74 52 65 71 75 65 73 74 20 3d 20 43 6c 69 | back).}..net.ClientRequest.=.Cli |
11460 | 65 6e 74 52 65 71 75 65 73 74 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 6e 65 74 | entRequest..module.exports.=.net |
11480 | 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d 69 74 | .'use.strict'..const.{.EventEmit |
114a0 | 74 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 | ter.}.=.require('events').const. |
114c0 | 7b 20 4e 6f 74 69 66 69 63 61 74 69 6f 6e 2c 20 69 73 53 75 70 70 6f 72 74 65 64 20 7d 20 3d 20 | {.Notification,.isSupported.}.=. |
114e0 | 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 6e 6f 74 69 66 69 63 61 74 69 6f | process.atomBinding('notificatio |
11500 | 6e 27 29 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 4e 6f 74 69 66 | n')..Object.setPrototypeOf(Notif |
11520 | 69 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e | ication.prototype,.EventEmitter. |
11540 | 70 72 6f 74 6f 74 79 70 65 29 0a 0a 4e 6f 74 69 66 69 63 61 74 69 6f 6e 2e 69 73 53 75 70 70 6f | prototype)..Notification.isSuppo |
11560 | 72 74 65 64 20 3d 20 69 73 53 75 70 70 6f 72 74 65 64 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 | rted.=.isSupported..module.expor |
11580 | 74 73 20 3d 20 4e 6f 74 69 66 69 63 61 74 69 6f 6e 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a | ts.=.Notification.'use.strict'.. |
115a0 | 63 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 | const.{.EventEmitter.}.=.require |
115c0 | 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 7b 20 70 6f 77 65 72 4d 6f 6e 69 74 6f 72 2c | ('events').const.{.powerMonitor, |
115e0 | 20 50 6f 77 65 72 4d 6f 6e 69 74 6f 72 20 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 | .PowerMonitor.}.=.process.atomBi |
11600 | 6e 64 69 6e 67 28 27 70 6f 77 65 72 5f 6d 6f 6e 69 74 6f 72 27 29 0a 0a 2f 2f 20 50 6f 77 65 72 | nding('power_monitor')..//.Power |
11620 | 4d 6f 6e 69 74 6f 72 20 69 73 20 61 6e 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 0a 4f 62 6a 65 | Monitor.is.an.EventEmitter..Obje |
11640 | 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 50 6f 77 65 72 4d 6f 6e 69 74 6f 72 2e 70 | ct.setPrototypeOf(PowerMonitor.p |
11660 | 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 | rototype,.EventEmitter.prototype |
11680 | 29 0a 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 63 61 6c 6c 28 70 6f 77 65 72 4d 6f 6e 69 74 6f 72 | ).EventEmitter.call(powerMonitor |
116a0 | 29 0a 0a 2f 2f 20 4f 6e 20 4c 69 6e 75 78 20 77 65 20 6e 65 65 64 20 74 6f 20 63 61 6c 6c 20 62 | )..//.On.Linux.we.need.to.call.b |
116c0 | 6c 6f 63 6b 53 68 75 74 64 6f 77 6e 28 29 20 74 6f 20 73 75 62 73 63 72 69 62 65 20 74 6f 20 73 | lockShutdown().to.subscribe.to.s |
116e0 | 68 75 74 64 6f 77 6e 20 65 76 65 6e 74 2e 0a 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 | hutdown.event..if.(process.platf |
11700 | 6f 72 6d 20 3d 3d 3d 20 27 6c 69 6e 75 78 27 29 20 7b 0a 20 20 70 6f 77 65 72 4d 6f 6e 69 74 6f | orm.===.'linux').{...powerMonito |
11720 | 72 2e 6f 6e 28 27 6e 65 77 4c 69 73 74 65 6e 65 72 27 2c 20 28 65 76 65 6e 74 29 20 3d 3e 20 7b | r.on('newListener',.(event).=>.{ |
11740 | 0a 20 20 20 20 69 66 20 28 65 76 65 6e 74 20 3d 3d 3d 20 27 73 68 75 74 64 6f 77 6e 27 20 26 26 | .....if.(event.===.'shutdown'.&& |
11760 | 20 70 6f 77 65 72 4d 6f 6e 69 74 6f 72 2e 6c 69 73 74 65 6e 65 72 43 6f 75 6e 74 28 27 73 68 75 | .powerMonitor.listenerCount('shu |
11780 | 74 64 6f 77 6e 27 29 20 3d 3d 3d 20 30 29 20 7b 0a 20 20 20 20 20 20 70 6f 77 65 72 4d 6f 6e 69 | tdown').===.0).{.......powerMoni |
117a0 | 74 6f 72 2e 62 6c 6f 63 6b 53 68 75 74 64 6f 77 6e 28 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 0a | tor.blockShutdown().....}...}).. |
117c0 | 20 20 70 6f 77 65 72 4d 6f 6e 69 74 6f 72 2e 6f 6e 28 27 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 | ..powerMonitor.on('removeListene |
117e0 | 72 27 2c 20 28 65 76 65 6e 74 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 65 76 65 6e 74 20 3d | r',.(event).=>.{.....if.(event.= |
11800 | 3d 3d 20 27 73 68 75 74 64 6f 77 6e 27 20 26 26 20 70 6f 77 65 72 4d 6f 6e 69 74 6f 72 2e 6c 69 | ==.'shutdown'.&&.powerMonitor.li |
11820 | 73 74 65 6e 65 72 43 6f 75 6e 74 28 27 73 68 75 74 64 6f 77 6e 27 29 20 3d 3d 3d 20 30 29 20 7b | stenerCount('shutdown').===.0).{ |
11840 | 0a 20 20 20 20 20 20 70 6f 77 65 72 4d 6f 6e 69 74 6f 72 2e 75 6e 62 6c 6f 63 6b 53 68 75 74 64 | .......powerMonitor.unblockShutd |
11860 | 6f 77 6e 28 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 | own().....}...}).}..module.expor |
11880 | 74 73 20 3d 20 70 6f 77 65 72 4d 6f 6e 69 74 6f 72 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a | ts.=.powerMonitor.'use.strict'.. |
118a0 | 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e | module.exports.=.process.atomBin |
118c0 | 64 69 6e 67 28 27 70 6f 77 65 72 5f 73 61 76 65 5f 62 6c 6f 63 6b 65 72 27 29 2e 70 6f 77 65 72 | ding('power_save_blocker').power |
118e0 | 53 61 76 65 42 6c 6f 63 6b 65 72 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 | SaveBlocker.'use.strict'..const. |
11900 | 7b 20 61 70 70 2c 20 73 65 73 73 69 6f 6e 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 | {.app,.session.}.=.require('elec |
11920 | 74 72 6f 6e 27 29 0a 0a 2f 2f 20 47 6c 6f 62 61 6c 20 70 72 6f 74 6f 63 6f 6c 20 41 50 49 73 2e | tron')..//.Global.protocol.APIs. |
11940 | 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 | .module.exports.=.process.atomBi |
11960 | 6e 64 69 6e 67 28 27 70 72 6f 74 6f 63 6f 6c 27 29 0a 0a 2f 2f 20 46 61 6c 6c 62 61 63 6b 20 70 | nding('protocol')..//.Fallback.p |
11980 | 72 6f 74 6f 63 6f 6c 20 41 50 49 73 20 6f 66 20 64 65 66 61 75 6c 74 20 73 65 73 73 69 6f 6e 2e | rotocol.APIs.of.default.session. |
119a0 | 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 6d 6f 64 75 6c 65 2e 65 78 | .Object.setPrototypeOf(module.ex |
119c0 | 70 6f 72 74 73 2c 20 6e 65 77 20 50 72 6f 78 79 28 7b 7d 2c 20 7b 0a 20 20 67 65 74 20 28 74 61 | ports,.new.Proxy({},.{...get.(ta |
119e0 | 72 67 65 74 2c 20 70 72 6f 70 65 72 74 79 29 20 7b 0a 20 20 20 20 69 66 20 28 21 61 70 70 2e 69 | rget,.property).{.....if.(!app.i |
11a00 | 73 52 65 61 64 79 28 29 29 20 72 65 74 75 72 6e 0a 0a 20 20 20 20 63 6f 6e 73 74 20 70 72 6f 74 | sReady()).return......const.prot |
11a20 | 6f 63 6f 6c 20 3d 20 73 65 73 73 69 6f 6e 2e 64 65 66 61 75 6c 74 53 65 73 73 69 6f 6e 2e 70 72 | ocol.=.session.defaultSession.pr |
11a40 | 6f 74 6f 63 6f 6c 0a 20 20 20 20 69 66 20 28 21 4f 62 6a 65 63 74 2e 67 65 74 50 72 6f 74 6f 74 | otocol.....if.(!Object.getProtot |
11a60 | 79 70 65 4f 66 28 70 72 6f 74 6f 63 6f 6c 29 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 70 | ypeOf(protocol).hasOwnProperty(p |
11a80 | 72 6f 70 65 72 74 79 29 29 20 72 65 74 75 72 6e 0a 0a 20 20 20 20 2f 2f 20 52 65 74 75 72 6e 69 | roperty)).return......//.Returni |
11aa0 | 6e 67 20 61 20 6e 61 74 69 76 65 20 66 75 6e 63 74 69 6f 6e 20 64 69 72 65 63 74 6c 79 20 77 6f | ng.a.native.function.directly.wo |
11ac0 | 75 6c 64 20 74 68 72 6f 77 20 65 72 72 6f 72 2e 0a 20 20 20 20 72 65 74 75 72 6e 20 28 2e 2e 2e | uld.throw.error......return.(... |
11ae0 | 61 72 67 73 29 20 3d 3e 20 70 72 6f 74 6f 63 6f 6c 5b 70 72 6f 70 65 72 74 79 5d 28 2e 2e 2e 61 | args).=>.protocol[property](...a |
11b00 | 72 67 73 29 0a 20 20 7d 2c 0a 0a 20 20 6f 77 6e 4b 65 79 73 20 28 29 20 7b 0a 20 20 20 20 69 66 | rgs)...},....ownKeys.().{.....if |
11b20 | 20 28 21 61 70 70 2e 69 73 52 65 61 64 79 28 29 29 20 72 65 74 75 72 6e 20 5b 5d 0a 0a 20 20 20 | .(!app.isReady()).return.[]..... |
11b40 | 20 72 65 74 75 72 6e 20 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 4e 61 6d | .return.Object.getOwnPropertyNam |
11b60 | 65 73 28 4f 62 6a 65 63 74 2e 67 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 73 65 73 73 69 6f 6e | es(Object.getPrototypeOf(session |
11b80 | 2e 64 65 66 61 75 6c 74 53 65 73 73 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 29 29 0a 20 20 7d 2c 0a | .defaultSession.protocol))...},. |
11ba0 | 0a 20 20 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 44 65 73 63 72 69 70 74 6f 72 20 28 74 61 72 | ...getOwnPropertyDescriptor.(tar |
11bc0 | 67 65 74 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 7b 20 63 6f 6e 66 69 67 75 72 61 62 6c 65 | get).{.....return.{.configurable |
11be0 | 3a 20 74 72 75 65 2c 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 20 7d 0a 20 20 7d 0a 7d | :.true,.enumerable:.true.}...}.} |
11c00 | 29 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d | )).'use.strict'..const.{.EventEm |
11c20 | 69 74 74 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 | itter.}.=.require('events').cons |
11c40 | 74 20 7b 20 73 63 72 65 65 6e 2c 20 53 63 72 65 65 6e 20 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 | t.{.screen,.Screen.}.=.process.a |
11c60 | 74 6f 6d 42 69 6e 64 69 6e 67 28 27 73 63 72 65 65 6e 27 29 0a 0a 2f 2f 20 53 63 72 65 65 6e 20 | tomBinding('screen')..//.Screen. |
11c80 | 69 73 20 61 6e 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 | is.an.EventEmitter..Object.setPr |
11ca0 | 6f 74 6f 74 79 70 65 4f 66 28 53 63 72 65 65 6e 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e | ototypeOf(Screen.prototype,.Even |
11cc0 | 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 45 76 65 6e 74 45 6d 69 74 74 65 72 | tEmitter.prototype).EventEmitter |
11ce0 | 2e 63 61 6c 6c 28 73 63 72 65 65 6e 29 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 | .call(screen)..module.exports.=. |
11d00 | 73 63 72 65 65 6e 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 45 76 65 | screen.'use.strict'..const.{.Eve |
11d20 | 6e 74 45 6d 69 74 74 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a | ntEmitter.}.=.require('events'). |
11d40 | 63 6f 6e 73 74 20 7b 20 61 70 70 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f | const.{.app.}.=.require('electro |
11d60 | 6e 27 29 0a 63 6f 6e 73 74 20 7b 20 66 72 6f 6d 50 61 72 74 69 74 69 6f 6e 2c 20 53 65 73 73 69 | n').const.{.fromPartition,.Sessi |
11d80 | 6f 6e 2c 20 43 6f 6f 6b 69 65 73 20 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 | on,.Cookies.}.=.process.atomBind |
11da0 | 69 6e 67 28 27 73 65 73 73 69 6f 6e 27 29 0a 0a 2f 2f 20 50 75 62 6c 69 63 20 41 50 49 2e 0a 4f | ing('session')..//.Public.API..O |
11dc0 | 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 69 65 73 28 65 78 70 6f 72 74 73 2c 20 | bject.defineProperties(exports,. |
11de0 | 7b 0a 20 20 64 65 66 61 75 6c 74 53 65 73 73 69 6f 6e 3a 20 7b 0a 20 20 20 20 65 6e 75 6d 65 72 | {...defaultSession:.{.....enumer |
11e00 | 61 62 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 67 65 74 20 28 29 20 7b 20 72 65 74 75 72 6e 20 | able:.true,.....get.().{.return. |
11e20 | 66 72 6f 6d 50 61 72 74 69 74 69 6f 6e 28 27 27 29 20 7d 0a 20 20 7d 2c 0a 20 20 66 72 6f 6d 50 | fromPartition('').}...},...fromP |
11e40 | 61 72 74 69 74 69 6f 6e 3a 20 7b 0a 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 | artition:.{.....enumerable:.true |
11e60 | 2c 0a 20 20 20 20 76 61 6c 75 65 3a 20 66 72 6f 6d 50 61 72 74 69 74 69 6f 6e 0a 20 20 7d 0a 7d | ,.....value:.fromPartition...}.} |
11e80 | 29 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 53 65 73 73 69 6f 6e | )..Object.setPrototypeOf(Session |
11ea0 | 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 | .prototype,.EventEmitter.prototy |
11ec0 | 70 65 29 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 43 6f 6f 6b 69 65 | pe).Object.setPrototypeOf(Cookie |
11ee0 | 73 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 | s.prototype,.EventEmitter.protot |
11f00 | 79 70 65 29 0a 0a 53 65 73 73 69 6f 6e 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 69 6e 69 74 20 3d 20 | ype)..Session.prototype._init.=. |
11f20 | 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 61 70 70 2e 65 6d 69 74 28 27 73 65 73 73 69 6f | function.().{...app.emit('sessio |
11f40 | 6e 2d 63 72 65 61 74 65 64 27 2c 20 74 68 69 73 29 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 | n-created',.this).}.'use.strict' |
11f60 | 0a 0a 63 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7d 20 3d 20 72 65 71 75 69 | ..const.{.EventEmitter.}.=.requi |
11f80 | 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 7b 20 73 79 73 74 65 6d 50 72 65 66 65 | re('events').const.{.systemPrefe |
11fa0 | 72 65 6e 63 65 73 2c 20 53 79 73 74 65 6d 50 72 65 66 65 72 65 6e 63 65 73 20 7d 20 3d 20 70 72 | rences,.SystemPreferences.}.=.pr |
11fc0 | 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 73 79 73 74 65 6d 5f 70 72 65 66 65 72 | ocess.atomBinding('system_prefer |
11fe0 | 65 6e 63 65 73 27 29 0a 0a 2f 2f 20 53 79 73 74 65 6d 50 72 65 66 65 72 65 6e 63 65 73 20 69 73 | ences')..//.SystemPreferences.is |
12000 | 20 61 6e 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 | .an.EventEmitter..Object.setProt |
12020 | 6f 74 79 70 65 4f 66 28 53 79 73 74 65 6d 50 72 65 66 65 72 65 6e 63 65 73 2e 70 72 6f 74 6f 74 | otypeOf(SystemPreferences.protot |
12040 | 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 45 76 65 | ype,.EventEmitter.prototype).Eve |
12060 | 6e 74 45 6d 69 74 74 65 72 2e 63 61 6c 6c 28 73 79 73 74 65 6d 50 72 65 66 65 72 65 6e 63 65 73 | ntEmitter.call(systemPreferences |
12080 | 29 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 73 79 73 74 65 6d 50 72 65 66 65 72 | )..module.exports.=.systemPrefer |
120a0 | 65 6e 63 65 73 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 65 6c 65 63 74 72 | ences.'use.strict'..const.electr |
120c0 | 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 7b | on.=.require('electron').const.{ |
120e0 | 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 | .EventEmitter.}.=.require('event |
12100 | 73 27 29 0a 63 6f 6e 73 74 20 7b 20 54 6f 70 4c 65 76 65 6c 57 69 6e 64 6f 77 20 7d 20 3d 20 70 | s').const.{.TopLevelWindow.}.=.p |
12120 | 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 74 6f 70 5f 6c 65 76 65 6c 5f 77 69 | rocess.atomBinding('top_level_wi |
12140 | 6e 64 6f 77 27 29 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 54 6f | ndow')..Object.setPrototypeOf(To |
12160 | 70 4c 65 76 65 6c 57 69 6e 64 6f 77 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 | pLevelWindow.prototype,.EventEmi |
12180 | 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 0a 54 6f 70 4c 65 76 65 6c 57 69 6e 64 6f 77 2e | tter.prototype)..TopLevelWindow. |
121a0 | 70 72 6f 74 6f 74 79 70 65 2e 5f 69 6e 69 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a | prototype._init.=.function.().{. |
121c0 | 20 20 2f 2f 20 41 76 6f 69 64 20 72 65 63 75 72 73 69 76 65 20 72 65 71 75 69 72 65 2e 0a 20 20 | ..//.Avoid.recursive.require.... |
121e0 | 63 6f 6e 73 74 20 7b 20 61 70 70 20 7d 20 3d 20 65 6c 65 63 74 72 6f 6e 0a 0a 20 20 2f 2f 20 53 | const.{.app.}.=.electron....//.S |
12200 | 69 6d 75 6c 61 74 65 20 74 68 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 20 6d 65 6e 75 20 6f 6e 20 | imulate.the.application.menu.on. |
12220 | 70 6c 61 74 66 6f 72 6d 73 20 6f 74 68 65 72 20 74 68 61 6e 20 6d 61 63 4f 53 2e 0a 20 20 69 66 | platforms.other.than.macOS....if |
12240 | 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 21 3d 3d 20 27 64 61 72 77 69 6e 27 29 | .(process.platform.!==.'darwin') |
12260 | 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6d 65 6e 75 20 3d 20 61 70 70 2e 67 65 74 41 70 70 6c 69 | .{.....const.menu.=.app.getAppli |
12280 | 63 61 74 69 6f 6e 4d 65 6e 75 28 29 0a 20 20 20 20 69 66 20 28 6d 65 6e 75 29 20 74 68 69 73 2e | cationMenu().....if.(menu).this. |
122a0 | 73 65 74 4d 65 6e 75 28 6d 65 6e 75 29 0a 20 20 7d 0a 7d 0a 0a 54 6f 70 4c 65 76 65 6c 57 69 6e | setMenu(menu)...}.}..TopLevelWin |
122c0 | 64 6f 77 2e 67 65 74 46 6f 63 75 73 65 64 57 69 6e 64 6f 77 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 | dow.getFocusedWindow.=.().=>.{.. |
122e0 | 20 72 65 74 75 72 6e 20 54 6f 70 4c 65 76 65 6c 57 69 6e 64 6f 77 2e 67 65 74 41 6c 6c 57 69 6e | .return.TopLevelWindow.getAllWin |
12300 | 64 6f 77 73 28 29 2e 66 69 6e 64 28 28 77 69 6e 29 20 3d 3e 20 77 69 6e 2e 69 73 46 6f 63 75 73 | dows().find((win).=>.win.isFocus |
12320 | 65 64 28 29 29 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 54 6f 70 4c 65 76 | ed()).}..module.exports.=.TopLev |
12340 | 65 6c 57 69 6e 64 6f 77 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 45 | elWindow.'use.strict'..const.{.E |
12360 | 76 65 6e 74 45 6d 69 74 74 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 | ventEmitter.}.=.require('events' |
12380 | 29 0a 0a 6c 65 74 20 6e 65 78 74 49 74 65 6d 49 44 20 3d 20 31 0a 0a 63 6c 61 73 73 20 54 6f 75 | )..let.nextItemID.=.1..class.Tou |
123a0 | 63 68 42 61 72 20 65 78 74 65 6e 64 73 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7b 0a 20 20 2f | chBar.extends.EventEmitter.{.../ |
123c0 | 2f 20 42 69 6e 64 20 61 20 74 6f 75 63 68 20 62 61 72 20 74 6f 20 61 20 77 69 6e 64 6f 77 0a 20 | /.Bind.a.touch.bar.to.a.window.. |
123e0 | 20 73 74 61 74 69 63 20 5f 73 65 74 4f 6e 57 69 6e 64 6f 77 20 28 74 6f 75 63 68 42 61 72 2c 20 | .static._setOnWindow.(touchBar,. |
12400 | 77 69 6e 64 6f 77 29 20 7b 0a 20 20 20 20 69 66 20 28 77 69 6e 64 6f 77 2e 5f 74 6f 75 63 68 42 | window).{.....if.(window._touchB |
12420 | 61 72 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 5f 74 6f 75 63 | ar.!=.null).{.......window._touc |
12440 | 68 42 61 72 2e 5f 72 65 6d 6f 76 65 46 72 6f 6d 57 69 6e 64 6f 77 28 77 69 6e 64 6f 77 29 0a 20 | hBar._removeFromWindow(window).. |
12460 | 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 74 6f 75 63 68 42 61 72 20 3d 3d 20 6e 75 6c 6c 29 20 | ...}......if.(touchBar.==.null). |
12480 | 7b 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 5f 73 65 74 54 6f 75 63 68 42 61 72 49 74 65 6d 73 | {.......window._setTouchBarItems |
124a0 | 28 5b 5d 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 | ([]).......return.....}......if. |
124c0 | 28 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 74 6f 75 63 68 42 61 72 29 29 20 7b 0a 20 20 20 20 | (Array.isArray(touchBar)).{..... |
124e0 | 20 20 74 6f 75 63 68 42 61 72 20 3d 20 6e 65 77 20 54 6f 75 63 68 42 61 72 28 74 6f 75 63 68 42 | ..touchBar.=.new.TouchBar(touchB |
12500 | 61 72 29 0a 20 20 20 20 7d 0a 20 20 20 20 74 6f 75 63 68 42 61 72 2e 5f 61 64 64 54 6f 57 69 6e | ar).....}.....touchBar._addToWin |
12520 | 64 6f 77 28 77 69 6e 64 6f 77 29 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 | dow(window)...}....constructor.( |
12540 | 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 0a 20 20 20 20 69 66 20 28 | options).{.....super()......if.( |
12560 | 6f 70 74 69 6f 6e 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e | options.==.null).{.......throw.n |
12580 | 65 77 20 45 72 72 6f 72 28 27 4d 75 73 74 20 73 70 65 63 69 66 79 20 6f 70 74 69 6f 6e 73 20 6f | ew.Error('Must.specify.options.o |
125a0 | 62 6a 65 63 74 20 61 73 20 66 69 72 73 74 20 61 72 67 75 6d 65 6e 74 27 29 0a 20 20 20 20 7d 0a | bject.as.first.argument').....}. |
125c0 | 0a 20 20 20 20 6c 65 74 20 7b 20 69 74 65 6d 73 2c 20 65 73 63 61 70 65 49 74 65 6d 20 7d 20 3d | .....let.{.items,.escapeItem.}.= |
125e0 | 20 6f 70 74 69 6f 6e 73 0a 0a 20 20 20 20 2f 2f 20 46 49 58 4d 45 20 53 75 70 70 6f 72 74 20 61 | .options......//.FIXME.Support.a |
12600 | 72 72 61 79 20 61 73 20 66 69 72 73 74 20 61 72 67 75 6d 65 6e 74 2c 20 72 65 6d 6f 76 65 20 69 | rray.as.first.argument,.remove.i |
12620 | 6e 20 32 2e 30 0a 20 20 20 20 69 66 20 28 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 6f 70 74 69 | n.2.0.....if.(Array.isArray(opti |
12640 | 6f 6e 73 29 29 20 7b 0a 20 20 20 20 20 20 69 74 65 6d 73 20 3d 20 6f 70 74 69 6f 6e 73 0a 20 20 | ons)).{.......items.=.options... |
12660 | 20 20 20 20 65 73 63 61 70 65 49 74 65 6d 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 7d 0a 0a 20 20 20 | ....escapeItem.=.null.....}..... |
12680 | 20 69 66 20 28 21 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 69 74 65 6d 73 29 29 20 7b 0a 20 20 | .if.(!Array.isArray(items)).{... |
126a0 | 20 20 20 20 69 74 65 6d 73 20 3d 20 5b 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 68 69 73 2e 63 | ....items.=.[].....}......this.c |
126c0 | 68 61 6e 67 65 4c 69 73 74 65 6e 65 72 20 3d 20 28 69 74 65 6d 29 20 3d 3e 20 7b 0a 20 20 20 20 | hangeListener.=.(item).=>.{..... |
126e0 | 20 20 74 68 69 73 2e 65 6d 69 74 28 27 63 68 61 6e 67 65 27 2c 20 69 74 65 6d 2e 69 64 2c 20 69 | ..this.emit('change',.item.id,.i |
12700 | 74 65 6d 2e 74 79 70 65 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 68 69 73 2e 77 69 6e 64 6f 77 | tem.type).....}......this.window |
12720 | 4c 69 73 74 65 6e 65 72 73 20 3d 20 7b 7d 0a 20 20 20 20 74 68 69 73 2e 69 74 65 6d 73 20 3d 20 | Listeners.=.{}.....this.items.=. |
12740 | 7b 7d 0a 20 20 20 20 74 68 69 73 2e 6f 72 64 65 72 65 72 65 64 49 74 65 6d 73 20 3d 20 5b 5d 0a | {}.....this.ordereredItems.=.[]. |
12760 | 20 20 20 20 74 68 69 73 2e 65 73 63 61 70 65 49 74 65 6d 20 3d 20 65 73 63 61 70 65 49 74 65 6d | ....this.escapeItem.=.escapeItem |
12780 | 0a 0a 20 20 20 20 63 6f 6e 73 74 20 72 65 67 69 73 74 65 72 49 74 65 6d 20 3d 20 28 69 74 65 6d | ......const.registerItem.=.(item |
127a0 | 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 69 74 65 6d 73 5b 69 74 65 6d 2e 69 64 5d | ).=>.{.......this.items[item.id] |
127c0 | 20 3d 20 69 74 65 6d 0a 20 20 20 20 20 20 69 74 65 6d 2e 6f 6e 28 27 63 68 61 6e 67 65 27 2c 20 | .=.item.......item.on('change',. |
127e0 | 74 68 69 73 2e 63 68 61 6e 67 65 4c 69 73 74 65 6e 65 72 29 0a 20 20 20 20 20 20 69 66 20 28 69 | this.changeListener).......if.(i |
12800 | 74 65 6d 2e 63 68 69 6c 64 20 69 6e 73 74 61 6e 63 65 6f 66 20 54 6f 75 63 68 42 61 72 29 20 7b | tem.child.instanceof.TouchBar).{ |
12820 | 0a 20 20 20 20 20 20 20 20 69 74 65 6d 2e 63 68 69 6c 64 2e 6f 72 64 65 72 65 72 65 64 49 74 65 | .........item.child.ordereredIte |
12840 | 6d 73 2e 66 6f 72 45 61 63 68 28 72 65 67 69 73 74 65 72 49 74 65 6d 29 0a 20 20 20 20 20 20 7d | ms.forEach(registerItem).......} |
12860 | 0a 20 20 20 20 7d 0a 20 20 20 20 69 74 65 6d 73 2e 66 6f 72 45 61 63 68 28 28 69 74 65 6d 29 20 | .....}.....items.forEach((item). |
12880 | 3d 3e 20 7b 0a 20 20 20 20 20 20 69 66 20 28 21 28 69 74 65 6d 20 69 6e 73 74 61 6e 63 65 6f 66 | =>.{.......if.(!(item.instanceof |
128a0 | 20 54 6f 75 63 68 42 61 72 49 74 65 6d 29 29 20 7b 0a 20 20 20 20 20 20 20 20 74 68 72 6f 77 20 | .TouchBarItem)).{.........throw. |
128c0 | 6e 65 77 20 45 72 72 6f 72 28 27 45 61 63 68 20 69 74 65 6d 20 6d 75 73 74 20 62 65 20 61 6e 20 | new.Error('Each.item.must.be.an. |
128e0 | 69 6e 73 74 61 6e 63 65 20 6f 66 20 54 6f 75 63 68 42 61 72 49 74 65 6d 27 29 0a 20 20 20 20 20 | instance.of.TouchBarItem')...... |
12900 | 20 7d 0a 20 20 20 20 20 20 74 68 69 73 2e 6f 72 64 65 72 65 72 65 64 49 74 65 6d 73 2e 70 75 73 | .}.......this.ordereredItems.pus |
12920 | 68 28 69 74 65 6d 29 0a 20 20 20 20 20 20 72 65 67 69 73 74 65 72 49 74 65 6d 28 69 74 65 6d 29 | h(item).......registerItem(item) |
12940 | 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 73 65 74 20 65 73 63 61 70 65 49 74 65 6d 20 28 69 | .....})...}....set.escapeItem.(i |
12960 | 74 65 6d 29 20 7b 0a 20 20 20 20 69 66 20 28 69 74 65 6d 20 21 3d 20 6e 75 6c 6c 20 26 26 20 21 | tem).{.....if.(item.!=.null.&&.! |
12980 | 28 69 74 65 6d 20 69 6e 73 74 61 6e 63 65 6f 66 20 54 6f 75 63 68 42 61 72 49 74 65 6d 29 29 20 | (item.instanceof.TouchBarItem)). |
129a0 | 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 45 73 63 61 70 65 20 | {.......throw.new.Error('Escape. |
129c0 | 69 74 65 6d 20 6d 75 73 74 20 62 65 20 61 6e 20 69 6e 73 74 61 6e 63 65 20 6f 66 20 54 6f 75 63 | item.must.be.an.instance.of.Touc |
129e0 | 68 42 61 72 49 74 65 6d 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 65 73 | hBarItem').....}.....if.(this.es |
12a00 | 63 61 70 65 49 74 65 6d 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 65 | capeItem.!=.null).{.......this.e |
12a20 | 73 63 61 70 65 49 74 65 6d 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 27 63 68 61 6e 67 65 | scapeItem.removeListener('change |
12a40 | 27 2c 20 74 68 69 73 2e 63 68 61 6e 67 65 4c 69 73 74 65 6e 65 72 29 0a 20 20 20 20 7d 0a 20 20 | ',.this.changeListener).....}... |
12a60 | 20 20 74 68 69 73 2e 5f 65 73 63 61 70 65 49 74 65 6d 20 3d 20 69 74 65 6d 0a 20 20 20 20 69 66 | ..this._escapeItem.=.item.....if |
12a80 | 20 28 74 68 69 73 2e 65 73 63 61 70 65 49 74 65 6d 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 | .(this.escapeItem.!=.null).{.... |
12aa0 | 20 20 20 74 68 69 73 2e 65 73 63 61 70 65 49 74 65 6d 2e 6f 6e 28 27 63 68 61 6e 67 65 27 2c 20 | ...this.escapeItem.on('change',. |
12ac0 | 74 68 69 73 2e 63 68 61 6e 67 65 4c 69 73 74 65 6e 65 72 29 0a 20 20 20 20 7d 0a 20 20 20 20 74 | this.changeListener).....}.....t |
12ae0 | 68 69 73 2e 65 6d 69 74 28 27 65 73 63 61 70 65 2d 69 74 65 6d 2d 63 68 61 6e 67 65 27 2c 20 69 | his.emit('escape-item-change',.i |
12b00 | 74 65 6d 29 0a 20 20 7d 0a 0a 20 20 67 65 74 20 65 73 63 61 70 65 49 74 65 6d 20 28 29 20 7b 0a | tem)...}....get.escapeItem.().{. |
12b20 | 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 65 73 63 61 70 65 49 74 65 6d 0a 20 20 7d 0a | ....return.this._escapeItem...}. |
12b40 | 0a 20 20 5f 61 64 64 54 6f 57 69 6e 64 6f 77 20 28 77 69 6e 64 6f 77 29 20 7b 0a 20 20 20 20 63 | ..._addToWindow.(window).{.....c |
12b60 | 6f 6e 73 74 20 7b 20 69 64 20 7d 20 3d 20 77 69 6e 64 6f 77 0a 0a 20 20 20 20 2f 2f 20 41 6c 72 | onst.{.id.}.=.window......//.Alr |
12b80 | 65 61 64 79 20 61 64 64 65 64 20 74 6f 20 77 69 6e 64 6f 77 0a 20 20 20 20 69 66 20 28 74 68 69 | eady.added.to.window.....if.(thi |
12ba0 | 73 2e 77 69 6e 64 6f 77 4c 69 73 74 65 6e 65 72 73 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 | s.windowListeners.hasOwnProperty |
12bc0 | 28 69 64 29 29 20 72 65 74 75 72 6e 0a 0a 20 20 20 20 77 69 6e 64 6f 77 2e 5f 74 6f 75 63 68 42 | (id)).return......window._touchB |
12be0 | 61 72 20 3d 20 74 68 69 73 0a 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 6e 67 65 4c 69 73 74 65 | ar.=.this......const.changeListe |
12c00 | 6e 65 72 20 3d 20 28 69 74 65 6d 49 44 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 | ner.=.(itemID).=>.{.......window |
12c20 | 2e 5f 72 65 66 72 65 73 68 54 6f 75 63 68 42 61 72 49 74 65 6d 28 69 74 65 6d 49 44 29 0a 20 20 | ._refreshTouchBarItem(itemID)... |
12c40 | 20 20 7d 0a 20 20 20 20 74 68 69 73 2e 6f 6e 28 27 63 68 61 6e 67 65 27 2c 20 63 68 61 6e 67 65 | ..}.....this.on('change',.change |
12c60 | 4c 69 73 74 65 6e 65 72 29 0a 0a 20 20 20 20 63 6f 6e 73 74 20 65 73 63 61 70 65 49 74 65 6d 4c | Listener)......const.escapeItemL |
12c80 | 69 73 74 65 6e 65 72 20 3d 20 28 69 74 65 6d 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 77 69 6e 64 | istener.=.(item).=>.{.......wind |
12ca0 | 6f 77 2e 5f 73 65 74 45 73 63 61 70 65 54 6f 75 63 68 42 61 72 49 74 65 6d 28 69 74 65 6d 20 21 | ow._setEscapeTouchBarItem(item.! |
12cc0 | 3d 20 6e 75 6c 6c 20 3f 20 69 74 65 6d 20 3a 20 7b 7d 29 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 | =.null.?.item.:.{}).....}.....th |
12ce0 | 69 73 2e 6f 6e 28 27 65 73 63 61 70 65 2d 69 74 65 6d 2d 63 68 61 6e 67 65 27 2c 20 65 73 63 61 | is.on('escape-item-change',.esca |
12d00 | 70 65 49 74 65 6d 4c 69 73 74 65 6e 65 72 29 0a 0a 20 20 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 | peItemListener)......const.inter |
12d20 | 61 63 74 69 6f 6e 4c 69 73 74 65 6e 65 72 20 3d 20 28 65 76 65 6e 74 2c 20 69 74 65 6d 49 44 2c | actionListener.=.(event,.itemID, |
12d40 | 20 64 65 74 61 69 6c 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 6c 65 74 20 69 74 65 6d 20 3d 20 | .details).=>.{.......let.item.=. |
12d60 | 74 68 69 73 2e 69 74 65 6d 73 5b 69 74 65 6d 49 44 5d 0a 20 20 20 20 20 20 69 66 20 28 69 74 65 | this.items[itemID].......if.(ite |
12d80 | 6d 20 3d 3d 20 6e 75 6c 6c 20 26 26 20 74 68 69 73 2e 65 73 63 61 70 65 49 74 65 6d 20 21 3d 20 | m.==.null.&&.this.escapeItem.!=. |
12da0 | 6e 75 6c 6c 20 26 26 20 74 68 69 73 2e 65 73 63 61 70 65 49 74 65 6d 2e 69 64 20 3d 3d 3d 20 69 | null.&&.this.escapeItem.id.===.i |
12dc0 | 74 65 6d 49 44 29 20 7b 0a 20 20 20 20 20 20 20 20 69 74 65 6d 20 3d 20 74 68 69 73 2e 65 73 63 | temID).{.........item.=.this.esc |
12de0 | 61 70 65 49 74 65 6d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 69 66 20 28 69 74 65 6d 20 21 | apeItem.......}.......if.(item.! |
12e00 | 3d 20 6e 75 6c 6c 20 26 26 20 69 74 65 6d 2e 6f 6e 49 6e 74 65 72 61 63 74 69 6f 6e 20 21 3d 20 | =.null.&&.item.onInteraction.!=. |
12e20 | 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 69 74 65 6d 2e 6f 6e 49 6e 74 65 72 61 63 74 69 | null).{.........item.onInteracti |
12e40 | 6f 6e 28 64 65 74 61 69 6c 73 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 20 20 77 69 | on(details).......}.....}.....wi |
12e60 | 6e 64 6f 77 2e 6f 6e 28 27 2d 74 6f 75 63 68 2d 62 61 72 2d 69 6e 74 65 72 61 63 74 69 6f 6e 27 | ndow.on('-touch-bar-interaction' |
12e80 | 2c 20 69 6e 74 65 72 61 63 74 69 6f 6e 4c 69 73 74 65 6e 65 72 29 0a 0a 20 20 20 20 63 6f 6e 73 | ,.interactionListener)......cons |
12ea0 | 74 20 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 73 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 | t.removeListeners.=.().=>.{..... |
12ec0 | 20 20 74 68 69 73 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 27 63 68 61 6e 67 65 27 2c 20 | ..this.removeListener('change',. |
12ee0 | 63 68 61 6e 67 65 4c 69 73 74 65 6e 65 72 29 0a 20 20 20 20 20 20 74 68 69 73 2e 72 65 6d 6f 76 | changeListener).......this.remov |
12f00 | 65 4c 69 73 74 65 6e 65 72 28 27 65 73 63 61 70 65 2d 69 74 65 6d 2d 63 68 61 6e 67 65 27 2c 20 | eListener('escape-item-change',. |
12f20 | 65 73 63 61 70 65 49 74 65 6d 4c 69 73 74 65 6e 65 72 29 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 | escapeItemListener).......window |
12f40 | 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 27 2d 74 6f 75 63 68 2d 62 61 72 2d 69 6e 74 65 | .removeListener('-touch-bar-inte |
12f60 | 72 61 63 74 69 6f 6e 27 2c 20 69 6e 74 65 72 61 63 74 69 6f 6e 4c 69 73 74 65 6e 65 72 29 0a 20 | raction',.interactionListener).. |
12f80 | 20 20 20 20 20 77 69 6e 64 6f 77 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 27 63 6c 6f 73 | .....window.removeListener('clos |
12fa0 | 65 64 27 2c 20 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 73 29 0a 20 20 20 20 20 20 77 69 6e 64 | ed',.removeListeners).......wind |
12fc0 | 6f 77 2e 5f 74 6f 75 63 68 42 61 72 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 20 20 64 65 6c 65 74 65 | ow._touchBar.=.null.......delete |
12fe0 | 20 74 68 69 73 2e 77 69 6e 64 6f 77 4c 69 73 74 65 6e 65 72 73 5b 69 64 5d 0a 20 20 20 20 20 20 | .this.windowListeners[id]....... |
13000 | 63 6f 6e 73 74 20 75 6e 72 65 67 69 73 74 65 72 49 74 65 6d 73 20 3d 20 28 69 74 65 6d 73 29 20 | const.unregisterItems.=.(items). |
13020 | 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 69 74 65 6d 20 6f 66 20 | =>.{.........for.(const.item.of. |
13040 | 69 74 65 6d 73 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 69 74 65 6d 2e 72 65 6d 6f 76 65 4c 69 | items).{...........item.removeLi |
13060 | 73 74 65 6e 65 72 28 27 63 68 61 6e 67 65 27 2c 20 74 68 69 73 2e 63 68 61 6e 67 65 4c 69 73 74 | stener('change',.this.changeList |
13080 | 65 6e 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 28 69 74 65 6d 2e 63 68 69 6c 64 20 69 | ener)...........if.(item.child.i |
130a0 | 6e 73 74 61 6e 63 65 6f 66 20 54 6f 75 63 68 42 61 72 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 | nstanceof.TouchBar).{........... |
130c0 | 20 20 75 6e 72 65 67 69 73 74 65 72 49 74 65 6d 73 28 69 74 65 6d 2e 63 68 69 6c 64 2e 6f 72 64 | ..unregisterItems(item.child.ord |
130e0 | 65 72 65 72 65 64 49 74 65 6d 73 29 0a 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 | ereredItems)...........}........ |
13100 | 20 7d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 75 6e 72 65 67 69 73 74 65 72 49 74 65 6d 73 | .}.......}.......unregisterItems |
13120 | 28 74 68 69 73 2e 6f 72 64 65 72 65 72 65 64 49 74 65 6d 73 29 0a 20 20 20 20 20 20 69 66 20 28 | (this.ordereredItems).......if.( |
13140 | 74 68 69 73 2e 65 73 63 61 70 65 49 74 65 6d 29 20 7b 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e | this.escapeItem).{.........this. |
13160 | 65 73 63 61 70 65 49 74 65 6d 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 27 63 68 61 6e 67 | escapeItem.removeListener('chang |
13180 | 65 27 2c 20 74 68 69 73 2e 63 68 61 6e 67 65 4c 69 73 74 65 6e 65 72 29 0a 20 20 20 20 20 20 7d | e',.this.changeListener).......} |
131a0 | 0a 20 20 20 20 7d 0a 20 20 20 20 77 69 6e 64 6f 77 2e 6f 6e 63 65 28 27 63 6c 6f 73 65 64 27 2c | .....}.....window.once('closed', |
131c0 | 20 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 73 29 0a 20 20 20 20 74 68 69 73 2e 77 69 6e 64 6f | .removeListeners).....this.windo |
131e0 | 77 4c 69 73 74 65 6e 65 72 73 5b 69 64 5d 20 3d 20 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 73 | wListeners[id].=.removeListeners |
13200 | 0a 0a 20 20 20 20 77 69 6e 64 6f 77 2e 5f 73 65 74 54 6f 75 63 68 42 61 72 49 74 65 6d 73 28 74 | ......window._setTouchBarItems(t |
13220 | 68 69 73 2e 6f 72 64 65 72 65 72 65 64 49 74 65 6d 73 29 0a 20 20 20 20 65 73 63 61 70 65 49 74 | his.ordereredItems).....escapeIt |
13240 | 65 6d 4c 69 73 74 65 6e 65 72 28 74 68 69 73 2e 65 73 63 61 70 65 49 74 65 6d 29 0a 20 20 7d 0a | emListener(this.escapeItem)...}. |
13260 | 0a 20 20 5f 72 65 6d 6f 76 65 46 72 6f 6d 57 69 6e 64 6f 77 20 28 77 69 6e 64 6f 77 29 20 7b 0a | ..._removeFromWindow.(window).{. |
13280 | 20 20 20 20 63 6f 6e 73 74 20 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 73 20 3d 20 74 68 69 73 | ....const.removeListeners.=.this |
132a0 | 2e 77 69 6e 64 6f 77 4c 69 73 74 65 6e 65 72 73 5b 77 69 6e 64 6f 77 2e 69 64 5d 0a 20 20 20 20 | .windowListeners[window.id]..... |
132c0 | 69 66 20 28 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 73 20 21 3d 20 6e 75 6c 6c 29 20 72 65 6d | if.(removeListeners.!=.null).rem |
132e0 | 6f 76 65 4c 69 73 74 65 6e 65 72 73 28 29 0a 20 20 7d 0a 7d 0a 0a 63 6c 61 73 73 20 54 6f 75 63 | oveListeners()...}.}..class.Touc |
13300 | 68 42 61 72 49 74 65 6d 20 65 78 74 65 6e 64 73 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7b 0a | hBarItem.extends.EventEmitter.{. |
13320 | 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 20 | ..constructor.().{.....super().. |
13340 | 20 20 20 74 68 69 73 2e 5f 61 64 64 49 6d 6d 75 74 61 62 6c 65 50 72 6f 70 65 72 74 79 28 27 69 | ...this._addImmutableProperty('i |
13360 | 64 27 2c 20 60 24 7b 6e 65 78 74 49 74 65 6d 49 44 2b 2b 7d 60 29 0a 20 20 20 20 74 68 69 73 2e | d',.`${nextItemID++}`).....this. |
13380 | 5f 70 61 72 65 6e 74 73 20 3d 20 5b 5d 0a 20 20 7d 0a 0a 20 20 5f 61 64 64 49 6d 6d 75 74 61 62 | _parents.=.[]...}...._addImmutab |
133a0 | 6c 65 50 72 6f 70 65 72 74 79 20 28 6e 61 6d 65 2c 20 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 4f | leProperty.(name,.value).{.....O |
133c0 | 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 74 68 69 73 2c 20 6e 61 6d 65 2c | bject.defineProperty(this,.name, |
133e0 | 20 7b 0a 20 20 20 20 20 20 67 65 74 3a 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 | .{.......get:.function.().{..... |
13400 | 20 20 20 20 72 65 74 75 72 6e 20 76 61 6c 75 65 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 | ....return.value.......},....... |
13420 | 73 65 74 3a 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 20 20 74 68 72 6f 77 | set:.function.().{.........throw |
13440 | 20 6e 65 77 20 45 72 72 6f 72 28 60 43 61 6e 6e 6f 74 20 6f 76 65 72 72 69 64 65 20 70 72 6f 70 | .new.Error(`Cannot.override.prop |
13460 | 65 72 74 79 20 24 7b 6e 61 6d 65 7d 60 29 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 65 6e | erty.${name}`).......},.......en |
13480 | 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 20 20 63 6f 6e 66 69 67 75 72 61 62 | umerable:.true,.......configurab |
134a0 | 6c 65 3a 20 66 61 6c 73 65 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 5f 61 64 64 4c 69 76 65 | le:.false.....})...}...._addLive |
134c0 | 50 72 6f 70 65 72 74 79 20 28 6e 61 6d 65 2c 20 69 6e 69 74 69 61 6c 56 61 6c 75 65 29 20 7b 0a | Property.(name,.initialValue).{. |
134e0 | 20 20 20 20 63 6f 6e 73 74 20 70 72 69 76 61 74 65 4e 61 6d 65 20 3d 20 60 5f 24 7b 6e 61 6d 65 | ....const.privateName.=.`_${name |
13500 | 7d 60 0a 20 20 20 20 74 68 69 73 5b 70 72 69 76 61 74 65 4e 61 6d 65 5d 20 3d 20 69 6e 69 74 69 | }`.....this[privateName].=.initi |
13520 | 61 6c 56 61 6c 75 65 0a 20 20 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 | alValue.....Object.definePropert |
13540 | 79 28 74 68 69 73 2c 20 6e 61 6d 65 2c 20 7b 0a 20 20 20 20 20 20 67 65 74 3a 20 66 75 6e 63 74 | y(this,.name,.{.......get:.funct |
13560 | 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 5b 70 72 69 | ion.().{.........return.this[pri |
13580 | 76 61 74 65 4e 61 6d 65 5d 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 73 65 74 3a 20 66 75 | vateName].......},.......set:.fu |
135a0 | 6e 63 74 69 6f 6e 20 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 20 20 74 68 69 73 5b 70 72 | nction.(value).{.........this[pr |
135c0 | 69 76 61 74 65 4e 61 6d 65 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e | ivateName].=.value.........this. |
135e0 | 65 6d 69 74 28 27 63 68 61 6e 67 65 27 2c 20 74 68 69 73 29 0a 20 20 20 20 20 20 7d 2c 0a 20 20 | emit('change',.this).......},... |
13600 | 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 0a 20 20 20 20 7d 29 0a 20 20 7d 0a | ....enumerable:.true.....})...}. |
13620 | 0a 20 20 5f 61 64 64 50 61 72 65 6e 74 20 28 69 74 65 6d 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 | ..._addParent.(item).{.....const |
13640 | 20 65 78 69 73 74 69 6e 67 20 3d 20 74 68 69 73 2e 5f 70 61 72 65 6e 74 73 2e 73 6f 6d 65 28 74 | .existing.=.this._parents.some(t |
13660 | 65 73 74 20 3d 3e 20 74 65 73 74 2e 69 64 20 3d 3d 3d 20 69 74 65 6d 2e 69 64 29 0a 20 20 20 20 | est.=>.test.id.===.item.id)..... |
13680 | 69 66 20 28 21 65 78 69 73 74 69 6e 67 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 70 61 72 | if.(!existing).{.......this._par |
136a0 | 65 6e 74 73 2e 70 75 73 68 28 7b 0a 20 20 20 20 20 20 20 20 69 64 3a 20 69 74 65 6d 2e 69 64 2c | ents.push({.........id:.item.id, |
136c0 | 0a 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 69 74 65 6d 2e 74 79 70 65 0a 20 20 20 20 20 20 7d | .........type:.item.type.......} |
136e0 | 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 63 68 42 61 72 2e 54 6f 75 63 68 42 61 72 | ).....}...}.}..TouchBar.TouchBar |
13700 | 42 75 74 74 6f 6e 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 42 61 72 42 75 74 74 6f 6e 20 65 78 | Button.=.class.TouchBarButton.ex |
13720 | 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 65 6d 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 | tends.TouchBarItem.{...construct |
13740 | 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 20 20 20 20 69 66 | or.(config).{.....super().....if |
13760 | 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 20 63 6f 6e 66 69 67 20 3d 20 7b 7d 0a 20 20 | .(config.==.null).config.=.{}... |
13780 | 20 20 74 68 69 73 2e 5f 61 64 64 49 6d 6d 75 74 61 62 6c 65 50 72 6f 70 65 72 74 79 28 27 74 79 | ..this._addImmutableProperty('ty |
137a0 | 70 65 27 2c 20 27 62 75 74 74 6f 6e 27 29 0a 20 20 20 20 63 6f 6e 73 74 20 7b 20 63 6c 69 63 6b | pe',.'button').....const.{.click |
137c0 | 2c 20 69 63 6f 6e 2c 20 69 63 6f 6e 50 6f 73 69 74 69 6f 6e 2c 20 6c 61 62 65 6c 2c 20 62 61 63 | ,.icon,.iconPosition,.label,.bac |
137e0 | 6b 67 72 6f 75 6e 64 43 6f 6c 6f 72 20 7d 20 3d 20 63 6f 6e 66 69 67 0a 20 20 20 20 74 68 69 73 | kgroundColor.}.=.config.....this |
13800 | 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6c 61 62 65 6c 27 2c 20 6c 61 62 65 6c | ._addLiveProperty('label',.label |
13820 | 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 62 61 63 | ).....this._addLiveProperty('bac |
13840 | 6b 67 72 6f 75 6e 64 43 6f 6c 6f 72 27 2c 20 62 61 63 6b 67 72 6f 75 6e 64 43 6f 6c 6f 72 29 0a | kgroundColor',.backgroundColor). |
13860 | 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 69 63 6f 6e 27 | ....this._addLiveProperty('icon' |
13880 | 2c 20 69 63 6f 6e 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 | ,.icon).....this._addLivePropert |
138a0 | 79 28 27 69 63 6f 6e 50 6f 73 69 74 69 6f 6e 27 2c 20 69 63 6f 6e 50 6f 73 69 74 69 6f 6e 29 0a | y('iconPosition',.iconPosition). |
138c0 | 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 63 6c 69 63 6b 20 3d 3d 3d 20 27 66 75 6e 63 74 69 | ....if.(typeof.click.===.'functi |
138e0 | 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 61 64 64 49 6d 6d 75 74 61 62 6c 65 50 | on').{.......this._addImmutableP |
13900 | 72 6f 70 65 72 74 79 28 27 6f 6e 49 6e 74 65 72 61 63 74 69 6f 6e 27 2c 20 28 29 20 3d 3e 20 7b | roperty('onInteraction',.().=>.{ |
13920 | 0a 20 20 20 20 20 20 20 20 63 6f 6e 66 69 67 2e 63 6c 69 63 6b 28 29 0a 20 20 20 20 20 20 7d 29 | .........config.click().......}) |
13940 | 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 63 68 42 61 72 2e 54 6f 75 63 68 42 61 72 43 | .....}...}.}..TouchBar.TouchBarC |
13960 | 6f 6c 6f 72 50 69 63 6b 65 72 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 42 61 72 43 6f 6c 6f 72 | olorPicker.=.class.TouchBarColor |
13980 | 50 69 63 6b 65 72 20 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 65 6d 20 7b 0a 20 20 | Picker.extends.TouchBarItem.{... |
139a0 | 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 20 20 73 75 70 65 72 | constructor.(config).{.....super |
139c0 | 28 29 0a 20 20 20 20 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 20 63 6f 6e 66 69 | ().....if.(config.==.null).confi |
139e0 | 67 20 3d 20 7b 7d 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 49 6d 6d 75 74 61 62 6c 65 50 72 6f | g.=.{}.....this._addImmutablePro |
13a00 | 70 65 72 74 79 28 27 74 79 70 65 27 2c 20 27 63 6f 6c 6f 72 70 69 63 6b 65 72 27 29 0a 20 20 20 | perty('type',.'colorpicker').... |
13a20 | 20 63 6f 6e 73 74 20 7b 20 61 76 61 69 6c 61 62 6c 65 43 6f 6c 6f 72 73 2c 20 63 68 61 6e 67 65 | .const.{.availableColors,.change |
13a40 | 2c 20 73 65 6c 65 63 74 65 64 43 6f 6c 6f 72 20 7d 20 3d 20 63 6f 6e 66 69 67 0a 20 20 20 20 74 | ,.selectedColor.}.=.config.....t |
13a60 | 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 61 76 61 69 6c 61 62 6c 65 43 | his._addLiveProperty('availableC |
13a80 | 6f 6c 6f 72 73 27 2c 20 61 76 61 69 6c 61 62 6c 65 43 6f 6c 6f 72 73 29 0a 20 20 20 20 74 68 69 | olors',.availableColors).....thi |
13aa0 | 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 73 65 6c 65 63 74 65 64 43 6f 6c 6f | s._addLiveProperty('selectedColo |
13ac0 | 72 27 2c 20 73 65 6c 65 63 74 65 64 43 6f 6c 6f 72 29 0a 0a 20 20 20 20 69 66 20 28 74 79 70 65 | r',.selectedColor)......if.(type |
13ae0 | 6f 66 20 63 68 61 6e 67 65 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 | of.change.===.'function').{..... |
13b00 | 20 20 74 68 69 73 2e 5f 61 64 64 49 6d 6d 75 74 61 62 6c 65 50 72 6f 70 65 72 74 79 28 27 6f 6e | ..this._addImmutableProperty('on |
13b20 | 49 6e 74 65 72 61 63 74 69 6f 6e 27 2c 20 28 64 65 74 61 69 6c 73 29 20 3d 3e 20 7b 0a 20 20 20 | Interaction',.(details).=>.{.... |
13b40 | 20 20 20 20 20 74 68 69 73 2e 5f 73 65 6c 65 63 74 65 64 43 6f 6c 6f 72 20 3d 20 64 65 74 61 69 | .....this._selectedColor.=.detai |
13b60 | 6c 73 2e 63 6f 6c 6f 72 0a 20 20 20 20 20 20 20 20 63 68 61 6e 67 65 28 64 65 74 61 69 6c 73 2e | ls.color.........change(details. |
13b80 | 63 6f 6c 6f 72 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 | color).......}).....}...}.}..Tou |
13ba0 | 63 68 42 61 72 2e 54 6f 75 63 68 42 61 72 47 72 6f 75 70 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 | chBar.TouchBarGroup.=.class.Touc |
13bc0 | 68 42 61 72 47 72 6f 75 70 20 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 65 6d 20 7b | hBarGroup.extends.TouchBarItem.{ |
13be0 | 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 20 20 73 75 | ...constructor.(config).{.....su |
13c00 | 70 65 72 28 29 0a 20 20 20 20 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 20 63 6f | per().....if.(config.==.null).co |
13c20 | 6e 66 69 67 20 3d 20 7b 7d 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 49 6d 6d 75 74 61 62 6c 65 | nfig.=.{}.....this._addImmutable |
13c40 | 50 72 6f 70 65 72 74 79 28 27 74 79 70 65 27 2c 20 27 67 72 6f 75 70 27 29 0a 20 20 20 20 63 6f | Property('type',.'group').....co |
13c60 | 6e 73 74 20 64 65 66 61 75 6c 74 43 68 69 6c 64 20 3d 20 28 63 6f 6e 66 69 67 2e 69 74 65 6d 73 | nst.defaultChild.=.(config.items |
13c80 | 20 69 6e 73 74 61 6e 63 65 6f 66 20 54 6f 75 63 68 42 61 72 29 20 3f 20 63 6f 6e 66 69 67 2e 69 | .instanceof.TouchBar).?.config.i |
13ca0 | 74 65 6d 73 20 3a 20 6e 65 77 20 54 6f 75 63 68 42 61 72 28 63 6f 6e 66 69 67 2e 69 74 65 6d 73 | tems.:.new.TouchBar(config.items |
13cc0 | 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 63 68 69 | ).....this._addLiveProperty('chi |
13ce0 | 6c 64 27 2c 20 64 65 66 61 75 6c 74 43 68 69 6c 64 29 0a 20 20 20 20 74 68 69 73 2e 63 68 69 6c | ld',.defaultChild).....this.chil |
13d00 | 64 2e 6f 72 64 65 72 65 72 65 64 49 74 65 6d 73 2e 66 6f 72 45 61 63 68 28 28 69 74 65 6d 29 20 | d.ordereredItems.forEach((item). |
13d20 | 3d 3e 20 69 74 65 6d 2e 5f 61 64 64 50 61 72 65 6e 74 28 74 68 69 73 29 29 0a 20 20 7d 0a 7d 0a | =>.item._addParent(this))...}.}. |
13d40 | 0a 54 6f 75 63 68 42 61 72 2e 54 6f 75 63 68 42 61 72 4c 61 62 65 6c 20 3d 20 63 6c 61 73 73 20 | .TouchBar.TouchBarLabel.=.class. |
13d60 | 54 6f 75 63 68 42 61 72 4c 61 62 65 6c 20 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 | TouchBarLabel.extends.TouchBarIt |
13d80 | 65 6d 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 | em.{...constructor.(config).{... |
13da0 | 20 20 73 75 70 65 72 28 29 0a 20 20 20 20 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c | ..super().....if.(config.==.null |
13dc0 | 29 20 63 6f 6e 66 69 67 20 3d 20 7b 7d 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 49 6d 6d 75 74 | ).config.=.{}.....this._addImmut |
13de0 | 61 62 6c 65 50 72 6f 70 65 72 74 79 28 27 74 79 70 65 27 2c 20 27 6c 61 62 65 6c 27 29 0a 20 20 | ableProperty('type',.'label')... |
13e00 | 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6c 61 62 65 6c 27 2c | ..this._addLiveProperty('label', |
13e20 | 20 63 6f 6e 66 69 67 2e 6c 61 62 65 6c 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 | .config.label).....this._addLive |
13e40 | 50 72 6f 70 65 72 74 79 28 27 74 65 78 74 43 6f 6c 6f 72 27 2c 20 63 6f 6e 66 69 67 2e 74 65 78 | Property('textColor',.config.tex |
13e60 | 74 43 6f 6c 6f 72 29 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 63 68 42 61 72 2e 54 6f 75 63 68 42 61 72 | tColor)...}.}..TouchBar.TouchBar |
13e80 | 50 6f 70 6f 76 65 72 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 42 61 72 50 6f 70 6f 76 65 72 20 | Popover.=.class.TouchBarPopover. |
13ea0 | 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 65 6d 20 7b 0a 20 20 63 6f 6e 73 74 72 75 | extends.TouchBarItem.{...constru |
13ec0 | 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 20 20 20 20 | ctor.(config).{.....super()..... |
13ee0 | 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 20 63 6f 6e 66 69 67 20 3d 20 7b 7d 0a | if.(config.==.null).config.=.{}. |
13f00 | 20 20 20 20 74 68 69 73 2e 5f 61 64 64 49 6d 6d 75 74 61 62 6c 65 50 72 6f 70 65 72 74 79 28 27 | ....this._addImmutableProperty(' |
13f20 | 74 79 70 65 27 2c 20 27 70 6f 70 6f 76 65 72 27 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c | type',.'popover').....this._addL |
13f40 | 69 76 65 50 72 6f 70 65 72 74 79 28 27 6c 61 62 65 6c 27 2c 20 63 6f 6e 66 69 67 2e 6c 61 62 65 | iveProperty('label',.config.labe |
13f60 | 6c 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 69 63 | l).....this._addLiveProperty('ic |
13f80 | 6f 6e 27 2c 20 63 6f 6e 66 69 67 2e 69 63 6f 6e 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c | on',.config.icon).....this._addL |
13fa0 | 69 76 65 50 72 6f 70 65 72 74 79 28 27 73 68 6f 77 43 6c 6f 73 65 42 75 74 74 6f 6e 27 2c 20 63 | iveProperty('showCloseButton',.c |
13fc0 | 6f 6e 66 69 67 2e 73 68 6f 77 43 6c 6f 73 65 42 75 74 74 6f 6e 29 0a 20 20 20 20 63 6f 6e 73 74 | onfig.showCloseButton).....const |
13fe0 | 20 64 65 66 61 75 6c 74 43 68 69 6c 64 20 3d 20 28 63 6f 6e 66 69 67 2e 69 74 65 6d 73 20 69 6e | .defaultChild.=.(config.items.in |
14000 | 73 74 61 6e 63 65 6f 66 20 54 6f 75 63 68 42 61 72 29 20 3f 20 63 6f 6e 66 69 67 2e 69 74 65 6d | stanceof.TouchBar).?.config.item |
14020 | 73 20 3a 20 6e 65 77 20 54 6f 75 63 68 42 61 72 28 63 6f 6e 66 69 67 2e 69 74 65 6d 73 29 0a 20 | s.:.new.TouchBar(config.items).. |
14040 | 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 63 68 69 6c 64 27 | ...this._addLiveProperty('child' |
14060 | 2c 20 64 65 66 61 75 6c 74 43 68 69 6c 64 29 0a 20 20 20 20 74 68 69 73 2e 63 68 69 6c 64 2e 6f | ,.defaultChild).....this.child.o |
14080 | 72 64 65 72 65 72 65 64 49 74 65 6d 73 2e 66 6f 72 45 61 63 68 28 28 69 74 65 6d 29 20 3d 3e 20 | rdereredItems.forEach((item).=>. |
140a0 | 69 74 65 6d 2e 5f 61 64 64 50 61 72 65 6e 74 28 74 68 69 73 29 29 0a 20 20 7d 0a 7d 0a 0a 54 6f | item._addParent(this))...}.}..To |
140c0 | 75 63 68 42 61 72 2e 54 6f 75 63 68 42 61 72 53 6c 69 64 65 72 20 3d 20 63 6c 61 73 73 20 54 6f | uchBar.TouchBarSlider.=.class.To |
140e0 | 75 63 68 42 61 72 53 6c 69 64 65 72 20 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 65 | uchBarSlider.extends.TouchBarIte |
14100 | 6d 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 20 | m.{...constructor.(config).{.... |
14120 | 20 73 75 70 65 72 28 29 0a 20 20 20 20 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 | .super().....if.(config.==.null) |
14140 | 20 63 6f 6e 66 69 67 20 3d 20 7b 7d 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 49 6d 6d 75 74 61 | .config.=.{}.....this._addImmuta |
14160 | 62 6c 65 50 72 6f 70 65 72 74 79 28 27 74 79 70 65 27 2c 20 27 73 6c 69 64 65 72 27 29 0a 20 20 | bleProperty('type',.'slider')... |
14180 | 20 20 63 6f 6e 73 74 20 7b 20 63 68 61 6e 67 65 2c 20 6c 61 62 65 6c 2c 20 6d 69 6e 56 61 6c 75 | ..const.{.change,.label,.minValu |
141a0 | 65 2c 20 6d 61 78 56 61 6c 75 65 2c 20 76 61 6c 75 65 20 7d 20 3d 20 63 6f 6e 66 69 67 0a 20 20 | e,.maxValue,.value.}.=.config... |
141c0 | 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6c 61 62 65 6c 27 2c | ..this._addLiveProperty('label', |
141e0 | 20 6c 61 62 65 6c 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 | .label).....this._addLivePropert |
14200 | 79 28 27 6d 69 6e 56 61 6c 75 65 27 2c 20 6d 69 6e 56 61 6c 75 65 29 0a 20 20 20 20 74 68 69 73 | y('minValue',.minValue).....this |
14220 | 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6d 61 78 56 61 6c 75 65 27 2c 20 6d 61 | ._addLiveProperty('maxValue',.ma |
14240 | 78 56 61 6c 75 65 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 | xValue).....this._addLivePropert |
14260 | 79 28 27 76 61 6c 75 65 27 2c 20 76 61 6c 75 65 29 0a 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f | y('value',.value)......if.(typeo |
14280 | 66 20 63 68 61 6e 67 65 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 | f.change.===.'function').{...... |
142a0 | 20 74 68 69 73 2e 5f 61 64 64 49 6d 6d 75 74 61 62 6c 65 50 72 6f 70 65 72 74 79 28 27 6f 6e 49 | .this._addImmutableProperty('onI |
142c0 | 6e 74 65 72 61 63 74 69 6f 6e 27 2c 20 28 64 65 74 61 69 6c 73 29 20 3d 3e 20 7b 0a 20 20 20 20 | nteraction',.(details).=>.{..... |
142e0 | 20 20 20 20 74 68 69 73 2e 5f 76 61 6c 75 65 20 3d 20 64 65 74 61 69 6c 73 2e 76 61 6c 75 65 0a | ....this._value.=.details.value. |
14300 | 20 20 20 20 20 20 20 20 63 68 61 6e 67 65 28 64 65 74 61 69 6c 73 2e 76 61 6c 75 65 29 0a 20 20 | ........change(details.value)... |
14320 | 20 20 20 20 7d 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 63 68 42 61 72 2e 54 6f 75 | ....}).....}...}.}..TouchBar.Tou |
14340 | 63 68 42 61 72 53 70 61 63 65 72 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 42 61 72 53 70 61 63 | chBarSpacer.=.class.TouchBarSpac |
14360 | 65 72 20 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 65 6d 20 7b 0a 20 20 63 6f 6e 73 | er.extends.TouchBarItem.{...cons |
14380 | 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 20 | tructor.(config).{.....super().. |
143a0 | 20 20 20 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 20 63 6f 6e 66 69 67 20 3d 20 | ...if.(config.==.null).config.=. |
143c0 | 7b 7d 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 49 6d 6d 75 74 61 62 6c 65 50 72 6f 70 65 72 74 | {}.....this._addImmutablePropert |
143e0 | 79 28 27 74 79 70 65 27 2c 20 27 73 70 61 63 65 72 27 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 | y('type',.'spacer').....this._ad |
14400 | 64 49 6d 6d 75 74 61 62 6c 65 50 72 6f 70 65 72 74 79 28 27 73 69 7a 65 27 2c 20 63 6f 6e 66 69 | dImmutableProperty('size',.confi |
14420 | 67 2e 73 69 7a 65 29 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 63 68 42 61 72 2e 54 6f 75 63 68 42 61 72 | g.size)...}.}..TouchBar.TouchBar |
14440 | 53 65 67 6d 65 6e 74 65 64 43 6f 6e 74 72 6f 6c 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 42 61 | SegmentedControl.=.class.TouchBa |
14460 | 72 53 65 67 6d 65 6e 74 65 64 43 6f 6e 74 72 6f 6c 20 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 | rSegmentedControl.extends.TouchB |
14480 | 61 72 49 74 65 6d 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 | arItem.{...constructor.(config). |
144a0 | 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 20 20 20 20 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 | {.....super().....if.(config.==. |
144c0 | 6e 75 6c 6c 29 20 63 6f 6e 66 69 67 20 3d 20 7b 7d 0a 20 20 20 20 63 6f 6e 73 74 20 7b 20 73 65 | null).config.=.{}.....const.{.se |
144e0 | 67 6d 65 6e 74 53 74 79 6c 65 2c 20 73 65 67 6d 65 6e 74 73 2c 20 73 65 6c 65 63 74 65 64 49 6e | gmentStyle,.segments,.selectedIn |
14500 | 64 65 78 2c 20 63 68 61 6e 67 65 2c 20 6d 6f 64 65 20 7d 20 3d 20 63 6f 6e 66 69 67 0a 20 20 20 | dex,.change,.mode.}.=.config.... |
14520 | 20 74 68 69 73 2e 5f 61 64 64 49 6d 6d 75 74 61 62 6c 65 50 72 6f 70 65 72 74 79 28 27 74 79 70 | .this._addImmutableProperty('typ |
14540 | 65 27 2c 20 27 73 65 67 6d 65 6e 74 65 64 5f 63 6f 6e 74 72 6f 6c 27 29 0a 20 20 20 20 74 68 69 | e',.'segmented_control').....thi |
14560 | 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 73 65 67 6d 65 6e 74 53 74 79 6c 65 | s._addLiveProperty('segmentStyle |
14580 | 27 2c 20 73 65 67 6d 65 6e 74 53 74 79 6c 65 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 | ',.segmentStyle).....this._addLi |
145a0 | 76 65 50 72 6f 70 65 72 74 79 28 27 73 65 67 6d 65 6e 74 73 27 2c 20 73 65 67 6d 65 6e 74 73 20 | veProperty('segments',.segments. |
145c0 | 7c 7c 20 5b 5d 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 | ||.[]).....this._addLiveProperty |
145e0 | 28 27 73 65 6c 65 63 74 65 64 49 6e 64 65 78 27 2c 20 73 65 6c 65 63 74 65 64 49 6e 64 65 78 29 | ('selectedIndex',.selectedIndex) |
14600 | 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6d 6f 64 65 | .....this._addLiveProperty('mode |
14620 | 27 2c 20 6d 6f 64 65 29 0a 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 63 68 61 6e 67 65 20 | ',.mode)......if.(typeof.change. |
14640 | 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 61 64 | ===.'function').{.......this._ad |
14660 | 64 49 6d 6d 75 74 61 62 6c 65 50 72 6f 70 65 72 74 79 28 27 6f 6e 49 6e 74 65 72 61 63 74 69 6f | dImmutableProperty('onInteractio |
14680 | 6e 27 2c 20 28 64 65 74 61 69 6c 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e | n',.(details).=>.{.........this. |
146a0 | 5f 73 65 6c 65 63 74 65 64 49 6e 64 65 78 20 3d 20 64 65 74 61 69 6c 73 2e 73 65 6c 65 63 74 65 | _selectedIndex.=.details.selecte |
146c0 | 64 49 6e 64 65 78 0a 20 20 20 20 20 20 20 20 63 68 61 6e 67 65 28 64 65 74 61 69 6c 73 2e 73 65 | dIndex.........change(details.se |
146e0 | 6c 65 63 74 65 64 49 6e 64 65 78 2c 20 64 65 74 61 69 6c 73 2e 69 73 53 65 6c 65 63 74 65 64 29 | lectedIndex,.details.isSelected) |
14700 | 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 54 6f 75 63 68 42 61 72 2e | .......}).....}...}.}..TouchBar. |
14720 | 54 6f 75 63 68 42 61 72 53 63 72 75 62 62 65 72 20 3d 20 63 6c 61 73 73 20 54 6f 75 63 68 42 61 | TouchBarScrubber.=.class.TouchBa |
14740 | 72 53 63 72 75 62 62 65 72 20 65 78 74 65 6e 64 73 20 54 6f 75 63 68 42 61 72 49 74 65 6d 20 7b | rScrubber.extends.TouchBarItem.{ |
14760 | 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 63 6f 6e 66 69 67 29 20 7b 0a 20 20 20 20 73 75 | ...constructor.(config).{.....su |
14780 | 70 65 72 28 29 0a 20 20 20 20 69 66 20 28 63 6f 6e 66 69 67 20 3d 3d 20 6e 75 6c 6c 29 20 63 6f | per().....if.(config.==.null).co |
147a0 | 6e 66 69 67 20 3d 20 7b 7d 0a 20 20 20 20 63 6f 6e 73 74 20 7b 20 69 74 65 6d 73 2c 20 73 65 6c | nfig.=.{}.....const.{.items,.sel |
147c0 | 65 63 74 65 64 53 74 79 6c 65 2c 20 6f 76 65 72 6c 61 79 53 74 79 6c 65 2c 20 73 68 6f 77 41 72 | ectedStyle,.overlayStyle,.showAr |
147e0 | 72 6f 77 42 75 74 74 6f 6e 73 2c 20 63 6f 6e 74 69 6e 75 6f 75 73 2c 20 6d 6f 64 65 20 7d 20 3d | rowButtons,.continuous,.mode.}.= |
14800 | 20 63 6f 6e 66 69 67 0a 20 20 20 20 6c 65 74 20 7b 20 73 65 6c 65 63 74 2c 20 68 69 67 68 6c 69 | .config.....let.{.select,.highli |
14820 | 67 68 74 20 7d 20 3d 20 63 6f 6e 66 69 67 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 49 6d 6d 75 | ght.}.=.config.....this._addImmu |
14840 | 74 61 62 6c 65 50 72 6f 70 65 72 74 79 28 27 74 79 70 65 27 2c 20 27 73 63 72 75 62 62 65 72 27 | tableProperty('type',.'scrubber' |
14860 | 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 69 74 65 | ).....this._addLiveProperty('ite |
14880 | 6d 73 27 2c 20 69 74 65 6d 73 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f | ms',.items).....this._addLivePro |
148a0 | 70 65 72 74 79 28 27 73 65 6c 65 63 74 65 64 53 74 79 6c 65 27 2c 20 73 65 6c 65 63 74 65 64 53 | perty('selectedStyle',.selectedS |
148c0 | 74 79 6c 65 20 7c 7c 20 6e 75 6c 6c 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 | tyle.||.null).....this._addLiveP |
148e0 | 72 6f 70 65 72 74 79 28 27 6f 76 65 72 6c 61 79 53 74 79 6c 65 27 2c 20 6f 76 65 72 6c 61 79 53 | roperty('overlayStyle',.overlayS |
14900 | 74 79 6c 65 20 7c 7c 20 6e 75 6c 6c 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 | tyle.||.null).....this._addLiveP |
14920 | 72 6f 70 65 72 74 79 28 27 73 68 6f 77 41 72 72 6f 77 42 75 74 74 6f 6e 73 27 2c 20 73 68 6f 77 | roperty('showArrowButtons',.show |
14940 | 41 72 72 6f 77 42 75 74 74 6f 6e 73 20 7c 7c 20 66 61 6c 73 65 29 0a 20 20 20 20 74 68 69 73 2e | ArrowButtons.||.false).....this. |
14960 | 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 74 79 28 27 6d 6f 64 65 27 2c 20 6d 6f 64 65 20 7c 7c | _addLiveProperty('mode',.mode.|| |
14980 | 20 27 66 72 65 65 27 29 0a 20 20 20 20 74 68 69 73 2e 5f 61 64 64 4c 69 76 65 50 72 6f 70 65 72 | .'free').....this._addLiveProper |
149a0 | 74 79 28 27 63 6f 6e 74 69 6e 75 6f 75 73 27 2c 20 74 79 70 65 6f 66 20 63 6f 6e 74 69 6e 75 6f | ty('continuous',.typeof.continuo |
149c0 | 75 73 20 3d 3d 3d 20 27 75 6e 64 65 66 69 6e 65 64 27 20 3f 20 74 72 75 65 20 3a 20 63 6f 6e 74 | us.===.'undefined'.?.true.:.cont |
149e0 | 69 6e 75 6f 75 73 29 0a 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 73 65 6c 65 63 74 20 3d | inuous)......if.(typeof.select.= |
14a00 | 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 20 7c 7c 20 74 79 70 65 6f 66 20 68 69 67 68 6c 69 67 68 | ==.'function'.||.typeof.highligh |
14a20 | 74 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 73 65 | t.===.'function').{.......if.(se |
14a40 | 6c 65 63 74 20 3d 3d 20 6e 75 6c 6c 29 20 73 65 6c 65 63 74 20 3d 20 28 29 20 3d 3e 20 7b 7d 0a | lect.==.null).select.=.().=>.{}. |
14a60 | 20 20 20 20 20 20 69 66 20 28 68 69 67 68 6c 69 67 68 74 20 3d 3d 20 6e 75 6c 6c 29 20 68 69 67 | ......if.(highlight.==.null).hig |
14a80 | 68 6c 69 67 68 74 20 3d 20 28 29 20 3d 3e 20 7b 7d 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 61 64 | hlight.=.().=>.{}.......this._ad |
14aa0 | 64 49 6d 6d 75 74 61 62 6c 65 50 72 6f 70 65 72 74 79 28 27 6f 6e 49 6e 74 65 72 61 63 74 69 6f | dImmutableProperty('onInteractio |
14ac0 | 6e 27 2c 20 28 64 65 74 61 69 6c 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 64 | n',.(details).=>.{.........if.(d |
14ae0 | 65 74 61 69 6c 73 2e 74 79 70 65 20 3d 3d 3d 20 27 73 65 6c 65 63 74 27 20 26 26 20 74 79 70 65 | etails.type.===.'select'.&&.type |
14b00 | 6f 66 20 73 65 6c 65 63 74 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 | of.select.===.'function').{..... |
14b20 | 20 20 20 20 20 20 73 65 6c 65 63 74 28 64 65 74 61 69 6c 73 2e 73 65 6c 65 63 74 65 64 49 6e 64 | ......select(details.selectedInd |
14b40 | 65 78 29 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 64 65 74 61 69 6c 73 2e 74 | ex).........}.else.if.(details.t |
14b60 | 79 70 65 20 3d 3d 3d 20 27 68 69 67 68 6c 69 67 68 74 27 20 26 26 20 74 79 70 65 6f 66 20 68 69 | ype.===.'highlight'.&&.typeof.hi |
14b80 | 67 68 6c 69 67 68 74 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 | ghlight.===.'function').{....... |
14ba0 | 20 20 20 20 68 69 67 68 6c 69 67 68 74 28 64 65 74 61 69 6c 73 2e 68 69 67 68 6c 69 67 68 74 65 | ....highlight(details.highlighte |
14bc0 | 64 49 6e 64 65 78 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d | dIndex).........}.......}).....} |
14be0 | 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 54 6f 75 63 68 42 61 | ...}.}..module.exports.=.TouchBa |
14c00 | 72 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d 69 | r.'use.strict'..const.{.EventEmi |
14c20 | 74 74 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 | tter.}.=.require('events').const |
14c40 | 20 7b 20 54 72 61 79 20 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 | .{.Tray.}.=.process.atomBinding( |
14c60 | 27 74 72 61 79 27 29 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 54 | 'tray')..Object.setPrototypeOf(T |
14c80 | 72 61 79 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 | ray.prototype,.EventEmitter.prot |
14ca0 | 6f 74 79 70 65 29 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 54 72 61 79 0a 27 75 | otype)..module.exports.=.Tray.'u |
14cc0 | 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d 69 74 74 65 72 | se.strict'..const.{.EventEmitter |
14ce0 | 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 7b 20 56 | .}.=.require('events').const.{.V |
14d00 | 69 65 77 20 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 69 65 | iew.}.=.process.atomBinding('vie |
14d20 | 77 27 29 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 56 69 65 77 2e | w')..Object.setPrototypeOf(View. |
14d40 | 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 79 70 | prototype,.EventEmitter.prototyp |
14d60 | 65 29 0a 0a 56 69 65 77 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 69 6e 69 74 20 3d 20 66 75 6e 63 74 | e)..View.prototype._init.=.funct |
14d80 | 69 6f 6e 20 28 29 20 7b 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 56 69 65 | ion.().{.}..module.exports.=.Vie |
14da0 | 77 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 65 6c 65 63 74 72 6f 6e 20 3d | w.'use.strict'..const.electron.= |
14dc0 | 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 63 6f 6e 73 74 20 7b 20 56 69 | .require('electron')..const.{.Vi |
14de0 | 65 77 20 7d 20 3d 20 65 6c 65 63 74 72 6f 6e 0a 63 6f 6e 73 74 20 7b 20 57 65 62 43 6f 6e 74 65 | ew.}.=.electron.const.{.WebConte |
14e00 | 6e 74 73 56 69 65 77 20 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 | ntsView.}.=.process.atomBinding( |
14e20 | 27 77 65 62 5f 63 6f 6e 74 65 6e 74 73 5f 76 69 65 77 27 29 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 | 'web_contents_view')..Object.set |
14e40 | 50 72 6f 74 6f 74 79 70 65 4f 66 28 57 65 62 43 6f 6e 74 65 6e 74 73 56 69 65 77 2e 70 72 6f 74 | PrototypeOf(WebContentsView.prot |
14e60 | 6f 74 79 70 65 2c 20 56 69 65 77 2e 70 72 6f 74 6f 74 79 70 65 29 0a 0a 57 65 62 43 6f 6e 74 65 | otype,.View.prototype)..WebConte |
14e80 | 6e 74 73 56 69 65 77 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 69 6e 69 74 20 3d 20 66 75 6e 63 74 69 | ntsView.prototype._init.=.functi |
14ea0 | 6f 6e 20 28 29 20 7b 0a 20 20 2f 2f 20 43 61 6c 6c 20 70 61 72 65 6e 74 20 63 6c 61 73 73 27 73 | on.().{...//.Call.parent.class's |
14ec0 | 20 5f 69 6e 69 74 2e 0a 20 20 56 69 65 77 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 69 6e 69 74 2e 63 | ._init....View.prototype._init.c |
14ee0 | 61 6c 6c 28 74 68 69 73 29 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 57 65 | all(this).}..module.exports.=.We |
14f00 | 62 43 6f 6e 74 65 6e 74 73 56 69 65 77 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 | bContentsView.'use.strict'..cons |
14f20 | 74 20 66 65 61 74 75 72 65 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 | t.features.=.process.atomBinding |
14f40 | 28 27 66 65 61 74 75 72 65 73 27 29 0a 63 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d 69 74 74 65 | ('features').const.{.EventEmitte |
14f60 | 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 65 6c | r.}.=.require('events').const.el |
14f80 | 65 63 74 72 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e | ectron.=.require('electron').con |
14fa0 | 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 74 68 27 29 0a 63 6f 6e 73 74 20 | st.path.=.require('path').const. |
14fc0 | 75 72 6c 20 3d 20 72 65 71 75 69 72 65 28 27 75 72 6c 27 29 0a 63 6f 6e 73 74 20 76 38 55 74 69 | url.=.require('url').const.v8Uti |
14fe0 | 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 69 6c | l.=.process.atomBinding('v8_util |
15000 | 27 29 0a 63 6f 6e 73 74 20 7b 20 61 70 70 2c 20 69 70 63 4d 61 69 6e 2c 20 73 65 73 73 69 6f 6e | ').const.{.app,.ipcMain,.session |
15020 | 2c 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2c 20 64 65 70 72 65 63 61 74 | ,.NavigationController,.deprecat |
15040 | 65 20 7d 20 3d 20 65 6c 65 63 74 72 6f 6e 0a 0a 63 6f 6e 73 74 20 69 70 63 4d 61 69 6e 49 6e 74 | e.}.=.electron..const.ipcMainInt |
15060 | 65 72 6e 61 6c 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 | ernal.=.require('@electron/inter |
15080 | 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 69 70 63 2d 6d 61 69 6e 2d 69 6e 74 65 72 6e 61 6c 27 29 0a | nal/browser/ipc-main-internal'). |
150a0 | 63 6f 6e 73 74 20 65 72 72 6f 72 55 74 69 6c 73 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 | const.errorUtils.=.require('@ele |
150c0 | 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 65 72 72 6f 72 2d 75 74 69 6c | ctron/internal/common/error-util |
150e0 | 73 27 29 0a 0a 2f 2f 20 73 65 73 73 69 6f 6e 20 69 73 20 6e 6f 74 20 75 73 65 64 20 68 65 72 65 | s')..//.session.is.not.used.here |
15100 | 2c 20 74 68 65 20 70 75 72 70 6f 73 65 20 69 73 20 74 6f 20 6d 61 6b 65 20 73 75 72 65 20 73 65 | ,.the.purpose.is.to.make.sure.se |
15120 | 73 73 69 6f 6e 20 69 73 20 69 6e 69 74 61 6c 69 7a 65 64 0a 2f 2f 20 62 65 66 6f 72 65 20 74 68 | ssion.is.initalized.//.before.th |
15140 | 65 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 6d 6f 64 75 6c 65 2e 0a 2f 2f 20 65 73 6c 69 6e 74 2d | e.webContents.module..//.eslint- |
15160 | 64 69 73 61 62 6c 65 2d 6e 65 78 74 2d 6c 69 6e 65 0a 73 65 73 73 69 6f 6e 0a 0a 6c 65 74 20 6e | disable-next-line.session..let.n |
15180 | 65 78 74 49 64 20 3d 20 30 0a 63 6f 6e 73 74 20 67 65 74 4e 65 78 74 49 64 20 3d 20 66 75 6e 63 | extId.=.0.const.getNextId.=.func |
151a0 | 74 69 6f 6e 20 28 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 2b 2b 6e 65 78 74 49 64 0a 7d 0a 0a 2f | tion.().{...return.++nextId.}../ |
151c0 | 2f 20 53 74 6f 63 6b 20 70 61 67 65 20 73 69 7a 65 73 0a 63 6f 6e 73 74 20 50 44 46 50 61 67 65 | /.Stock.page.sizes.const.PDFPage |
151e0 | 53 69 7a 65 73 20 3d 20 7b 0a 20 20 41 35 3a 20 7b 0a 20 20 20 20 63 75 73 74 6f 6d 5f 64 69 73 | Sizes.=.{...A5:.{.....custom_dis |
15200 | 70 6c 61 79 5f 6e 61 6d 65 3a 20 27 41 35 27 2c 0a 20 20 20 20 68 65 69 67 68 74 5f 6d 69 63 72 | play_name:.'A5',.....height_micr |
15220 | 6f 6e 73 3a 20 32 31 30 30 30 30 2c 0a 20 20 20 20 6e 61 6d 65 3a 20 27 49 53 4f 5f 41 35 27 2c | ons:.210000,.....name:.'ISO_A5', |
15240 | 0a 20 20 20 20 77 69 64 74 68 5f 6d 69 63 72 6f 6e 73 3a 20 31 34 38 30 30 30 0a 20 20 7d 2c 0a | .....width_microns:.148000...},. |
15260 | 20 20 41 34 3a 20 7b 0a 20 20 20 20 63 75 73 74 6f 6d 5f 64 69 73 70 6c 61 79 5f 6e 61 6d 65 3a | ..A4:.{.....custom_display_name: |
15280 | 20 27 41 34 27 2c 0a 20 20 20 20 68 65 69 67 68 74 5f 6d 69 63 72 6f 6e 73 3a 20 32 39 37 30 30 | .'A4',.....height_microns:.29700 |
152a0 | 30 2c 0a 20 20 20 20 6e 61 6d 65 3a 20 27 49 53 4f 5f 41 34 27 2c 0a 20 20 20 20 69 73 5f 64 65 | 0,.....name:.'ISO_A4',.....is_de |
152c0 | 66 61 75 6c 74 3a 20 27 74 72 75 65 27 2c 0a 20 20 20 20 77 69 64 74 68 5f 6d 69 63 72 6f 6e 73 | fault:.'true',.....width_microns |
152e0 | 3a 20 32 31 30 30 30 30 0a 20 20 7d 2c 0a 20 20 41 33 3a 20 7b 0a 20 20 20 20 63 75 73 74 6f 6d | :.210000...},...A3:.{.....custom |
15300 | 5f 64 69 73 70 6c 61 79 5f 6e 61 6d 65 3a 20 27 41 33 27 2c 0a 20 20 20 20 68 65 69 67 68 74 5f | _display_name:.'A3',.....height_ |
15320 | 6d 69 63 72 6f 6e 73 3a 20 34 32 30 30 30 30 2c 0a 20 20 20 20 6e 61 6d 65 3a 20 27 49 53 4f 5f | microns:.420000,.....name:.'ISO_ |
15340 | 41 33 27 2c 0a 20 20 20 20 77 69 64 74 68 5f 6d 69 63 72 6f 6e 73 3a 20 32 39 37 30 30 30 0a 20 | A3',.....width_microns:.297000.. |
15360 | 20 7d 2c 0a 20 20 4c 65 67 61 6c 3a 20 7b 0a 20 20 20 20 63 75 73 74 6f 6d 5f 64 69 73 70 6c 61 | .},...Legal:.{.....custom_displa |
15380 | 79 5f 6e 61 6d 65 3a 20 27 4c 65 67 61 6c 27 2c 0a 20 20 20 20 68 65 69 67 68 74 5f 6d 69 63 72 | y_name:.'Legal',.....height_micr |
153a0 | 6f 6e 73 3a 20 33 35 35 36 30 30 2c 0a 20 20 20 20 6e 61 6d 65 3a 20 27 4e 41 5f 4c 45 47 41 4c | ons:.355600,.....name:.'NA_LEGAL |
153c0 | 27 2c 0a 20 20 20 20 77 69 64 74 68 5f 6d 69 63 72 6f 6e 73 3a 20 32 31 35 39 30 30 0a 20 20 7d | ',.....width_microns:.215900...} |
153e0 | 2c 0a 20 20 4c 65 74 74 65 72 3a 20 7b 0a 20 20 20 20 63 75 73 74 6f 6d 5f 64 69 73 70 6c 61 79 | ,...Letter:.{.....custom_display |
15400 | 5f 6e 61 6d 65 3a 20 27 4c 65 74 74 65 72 27 2c 0a 20 20 20 20 68 65 69 67 68 74 5f 6d 69 63 72 | _name:.'Letter',.....height_micr |
15420 | 6f 6e 73 3a 20 32 37 39 34 30 30 2c 0a 20 20 20 20 6e 61 6d 65 3a 20 27 4e 41 5f 4c 45 54 54 45 | ons:.279400,.....name:.'NA_LETTE |
15440 | 52 27 2c 0a 20 20 20 20 77 69 64 74 68 5f 6d 69 63 72 6f 6e 73 3a 20 32 31 35 39 30 30 0a 20 20 | R',.....width_microns:.215900... |
15460 | 7d 2c 0a 20 20 54 61 62 6c 6f 69 64 3a 20 7b 0a 20 20 20 20 68 65 69 67 68 74 5f 6d 69 63 72 6f | },...Tabloid:.{.....height_micro |
15480 | 6e 73 3a 20 34 33 31 38 30 30 2c 0a 20 20 20 20 6e 61 6d 65 3a 20 27 4e 41 5f 4c 45 44 47 45 52 | ns:.431800,.....name:.'NA_LEDGER |
154a0 | 27 2c 0a 20 20 20 20 77 69 64 74 68 5f 6d 69 63 72 6f 6e 73 3a 20 32 37 39 34 30 30 2c 0a 20 20 | ',.....width_microns:.279400,... |
154c0 | 20 20 63 75 73 74 6f 6d 5f 64 69 73 70 6c 61 79 5f 6e 61 6d 65 3a 20 27 54 61 62 6c 6f 69 64 27 | ..custom_display_name:.'Tabloid' |
154e0 | 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 44 65 66 61 75 6c 74 20 70 72 69 6e 74 69 6e 67 20 73 65 74 74 | ...}.}..//.Default.printing.sett |
15500 | 69 6e 67 0a 63 6f 6e 73 74 20 64 65 66 61 75 6c 74 50 72 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 | ing.const.defaultPrintingSetting |
15520 | 20 3d 20 7b 0a 20 20 70 61 67 65 52 61 67 65 3a 20 5b 5d 2c 0a 20 20 6d 65 64 69 61 53 69 7a 65 | .=.{...pageRage:.[],...mediaSize |
15540 | 3a 20 7b 7d 2c 0a 20 20 6c 61 6e 64 73 63 61 70 65 3a 20 66 61 6c 73 65 2c 0a 20 20 63 6f 6c 6f | :.{},...landscape:.false,...colo |
15560 | 72 3a 20 32 2c 0a 20 20 68 65 61 64 65 72 46 6f 6f 74 65 72 45 6e 61 62 6c 65 64 3a 20 66 61 6c | r:.2,...headerFooterEnabled:.fal |
15580 | 73 65 2c 0a 20 20 6d 61 72 67 69 6e 73 54 79 70 65 3a 20 30 2c 0a 20 20 69 73 46 69 72 73 74 52 | se,...marginsType:.0,...isFirstR |
155a0 | 65 71 75 65 73 74 3a 20 66 61 6c 73 65 2c 0a 20 20 72 65 71 75 65 73 74 49 44 3a 20 67 65 74 4e | equest:.false,...requestID:.getN |
155c0 | 65 78 74 49 64 28 29 2c 0a 20 20 70 72 65 76 69 65 77 55 49 49 44 3a 20 30 2c 0a 20 20 70 72 65 | extId(),...previewUIID:.0,...pre |
155e0 | 76 69 65 77 4d 6f 64 69 66 69 61 62 6c 65 3a 20 74 72 75 65 2c 0a 20 20 70 72 69 6e 74 54 6f 50 | viewModifiable:.true,...printToP |
15600 | 44 46 3a 20 74 72 75 65 2c 0a 20 20 70 72 69 6e 74 57 69 74 68 43 6c 6f 75 64 50 72 69 6e 74 3a | DF:.true,...printWithCloudPrint: |
15620 | 20 66 61 6c 73 65 2c 0a 20 20 70 72 69 6e 74 57 69 74 68 50 72 69 76 65 74 3a 20 66 61 6c 73 65 | .false,...printWithPrivet:.false |
15640 | 2c 0a 20 20 70 72 69 6e 74 57 69 74 68 45 78 74 65 6e 73 69 6f 6e 3a 20 66 61 6c 73 65 2c 0a 20 | ,...printWithExtension:.false,.. |
15660 | 20 64 65 76 69 63 65 4e 61 6d 65 3a 20 27 53 61 76 65 20 61 73 20 50 44 46 27 2c 0a 20 20 67 65 | .deviceName:.'Save.as.PDF',...ge |
15680 | 6e 65 72 61 74 65 44 72 61 66 74 44 61 74 61 3a 20 74 72 75 65 2c 0a 20 20 66 69 74 54 6f 50 61 | nerateDraftData:.true,...fitToPa |
156a0 | 67 65 45 6e 61 62 6c 65 64 3a 20 66 61 6c 73 65 2c 0a 20 20 73 63 61 6c 65 46 61 63 74 6f 72 3a | geEnabled:.false,...scaleFactor: |
156c0 | 20 31 2c 0a 20 20 64 70 69 48 6f 72 69 7a 6f 6e 74 61 6c 3a 20 37 32 2c 0a 20 20 64 70 69 56 65 | .1,...dpiHorizontal:.72,...dpiVe |
156e0 | 72 74 69 63 61 6c 3a 20 37 32 2c 0a 20 20 72 61 73 74 65 72 69 7a 65 50 44 46 3a 20 66 61 6c 73 | rtical:.72,...rasterizePDF:.fals |
15700 | 65 2c 0a 20 20 64 75 70 6c 65 78 3a 20 30 2c 0a 20 20 63 6f 70 69 65 73 3a 20 31 2c 0a 20 20 63 | e,...duplex:.0,...copies:.1,...c |
15720 | 6f 6c 6c 61 74 65 3a 20 74 72 75 65 2c 0a 20 20 73 68 6f 75 6c 64 50 72 69 6e 74 42 61 63 6b 67 | ollate:.true,...shouldPrintBackg |
15740 | 72 6f 75 6e 64 73 3a 20 66 61 6c 73 65 2c 0a 20 20 73 68 6f 75 6c 64 50 72 69 6e 74 53 65 6c 65 | rounds:.false,...shouldPrintSele |
15760 | 63 74 69 6f 6e 4f 6e 6c 79 3a 20 66 61 6c 73 65 0a 7d 0a 0a 2f 2f 20 4a 61 76 61 53 63 72 69 70 | ctionOnly:.false.}..//.JavaScrip |
15780 | 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20 57 65 62 43 6f 6e 74 65 6e 74 73 | t.implementations.of.WebContents |
157a0 | 2e 0a 63 6f 6e 73 74 20 62 69 6e 64 69 6e 67 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 | ..const.binding.=.process.atomBi |
157c0 | 6e 64 69 6e 67 28 27 77 65 62 5f 63 6f 6e 74 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 7b 20 57 65 | nding('web_contents').const.{.We |
157e0 | 62 43 6f 6e 74 65 6e 74 73 20 7d 20 3d 20 62 69 6e 64 69 6e 67 0a 0a 4f 62 6a 65 63 74 2e 73 65 | bContents.}.=.binding..Object.se |
15800 | 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 | tPrototypeOf(NavigationControlle |
15820 | 72 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 65 72 2e 70 72 6f 74 6f 74 | r.prototype,.EventEmitter.protot |
15840 | 79 70 65 29 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 57 65 62 43 6f | ype).Object.setPrototypeOf(WebCo |
15860 | 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2c 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 | ntents.prototype,.NavigationCont |
15880 | 72 6f 6c 6c 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 0a 2f 2f 20 57 65 62 43 6f 6e 74 65 6e 74 | roller.prototype)..//.WebContent |
158a0 | 73 3a 3a 73 65 6e 64 28 63 68 61 6e 6e 65 6c 2c 20 61 72 67 73 2e 2e 29 0a 2f 2f 20 57 65 62 43 | s::send(channel,.args..).//.WebC |
158c0 | 6f 6e 74 65 6e 74 73 3a 3a 73 65 6e 64 54 6f 41 6c 6c 28 63 68 61 6e 6e 65 6c 2c 20 61 72 67 73 | ontents::sendToAll(channel,.args |
158e0 | 2e 2e 29 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 73 65 6e 64 20 3d | ..).WebContents.prototype.send.= |
15900 | 20 66 75 6e 63 74 69 6f 6e 20 28 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 | .function.(channel,....args).{.. |
15920 | 20 69 66 20 28 74 79 70 65 6f 66 20 63 68 61 6e 6e 65 6c 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 | .if.(typeof.channel.!==.'string' |
15940 | 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 4d 69 73 73 69 6e 67 | ).{.....throw.new.Error('Missing |
15960 | 20 72 65 71 75 69 72 65 64 20 63 68 61 6e 6e 65 6c 20 61 72 67 75 6d 65 6e 74 27 29 0a 20 20 7d | .required.channel.argument')...} |
15980 | 0a 0a 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 6e 61 6c 20 3d 20 66 61 6c 73 65 0a 20 20 63 6f 6e | ....const.internal.=.false...con |
159a0 | 73 74 20 73 65 6e 64 54 6f 41 6c 6c 20 3d 20 66 61 6c 73 65 0a 0a 20 20 72 65 74 75 72 6e 20 74 | st.sendToAll.=.false....return.t |
159c0 | 68 69 73 2e 5f 73 65 6e 64 28 69 6e 74 65 72 6e 61 6c 2c 20 73 65 6e 64 54 6f 41 6c 6c 2c 20 63 | his._send(internal,.sendToAll,.c |
159e0 | 68 61 6e 6e 65 6c 2c 20 61 72 67 73 29 0a 7d 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 | hannel,.args).}.WebContents.prot |
15a00 | 6f 74 79 70 65 2e 73 65 6e 64 54 6f 41 6c 6c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 68 61 6e | otype.sendToAll.=.function.(chan |
15a20 | 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 63 68 61 | nel,....args).{...if.(typeof.cha |
15a40 | 6e 6e 65 6c 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e | nnel.!==.'string').{.....throw.n |
15a60 | 65 77 20 45 72 72 6f 72 28 27 4d 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 63 68 61 6e 6e | ew.Error('Missing.required.chann |
15a80 | 65 6c 20 61 72 67 75 6d 65 6e 74 27 29 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 | el.argument')...}....const.inter |
15aa0 | 6e 61 6c 20 3d 20 66 61 6c 73 65 0a 20 20 63 6f 6e 73 74 20 73 65 6e 64 54 6f 41 6c 6c 20 3d 20 | nal.=.false...const.sendToAll.=. |
15ac0 | 74 72 75 65 0a 0a 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 5f 73 65 6e 64 28 69 6e 74 65 72 6e | true....return.this._send(intern |
15ae0 | 61 6c 2c 20 73 65 6e 64 54 6f 41 6c 6c 2c 20 63 68 61 6e 6e 65 6c 2c 20 61 72 67 73 29 0a 7d 0a | al,.sendToAll,.channel,.args).}. |
15b00 | 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 73 65 6e 64 49 6e 74 65 | .WebContents.prototype._sendInte |
15b20 | 72 6e 61 6c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 | rnal.=.function.(channel,....arg |
15b40 | 73 29 20 7b 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 63 68 61 6e 6e 65 6c 20 21 3d 3d 20 27 73 | s).{...if.(typeof.channel.!==.'s |
15b60 | 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 4d | tring').{.....throw.new.Error('M |
15b80 | 69 73 73 69 6e 67 20 72 65 71 75 69 72 65 64 20 63 68 61 6e 6e 65 6c 20 61 72 67 75 6d 65 6e 74 | issing.required.channel.argument |
15ba0 | 27 29 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 6e 61 6c 20 3d 20 74 72 75 65 0a | ')...}....const.internal.=.true. |
15bc0 | 20 20 63 6f 6e 73 74 20 73 65 6e 64 54 6f 41 6c 6c 20 3d 20 66 61 6c 73 65 0a 0a 20 20 72 65 74 | ..const.sendToAll.=.false....ret |
15be0 | 75 72 6e 20 74 68 69 73 2e 5f 73 65 6e 64 28 69 6e 74 65 72 6e 61 6c 2c 20 73 65 6e 64 54 6f 41 | urn.this._send(internal,.sendToA |
15c00 | 6c 6c 2c 20 63 68 61 6e 6e 65 6c 2c 20 61 72 67 73 29 0a 7d 0a 57 65 62 43 6f 6e 74 65 6e 74 73 | ll,.channel,.args).}.WebContents |
15c20 | 2e 70 72 6f 74 6f 74 79 70 65 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 54 6f 41 6c 6c 20 3d 20 | .prototype._sendInternalToAll.=. |
15c40 | 66 75 6e 63 74 69 6f 6e 20 28 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 | function.(channel,....args).{... |
15c60 | 69 66 20 28 74 79 70 65 6f 66 20 63 68 61 6e 6e 65 6c 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 | if.(typeof.channel.!==.'string') |
15c80 | 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 4d 69 73 73 69 6e 67 20 | .{.....throw.new.Error('Missing. |
15ca0 | 72 65 71 75 69 72 65 64 20 63 68 61 6e 6e 65 6c 20 61 72 67 75 6d 65 6e 74 27 29 0a 20 20 7d 0a | required.channel.argument')...}. |
15cc0 | 0a 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 6e 61 6c 20 3d 20 74 72 75 65 0a 20 20 63 6f 6e 73 74 | ...const.internal.=.true...const |
15ce0 | 20 73 65 6e 64 54 6f 41 6c 6c 20 3d 20 74 72 75 65 0a 0a 20 20 72 65 74 75 72 6e 20 74 68 69 73 | .sendToAll.=.true....return.this |
15d00 | 2e 5f 73 65 6e 64 28 69 6e 74 65 72 6e 61 6c 2c 20 73 65 6e 64 54 6f 41 6c 6c 2c 20 63 68 61 6e | ._send(internal,.sendToAll,.chan |
15d20 | 6e 65 6c 2c 20 61 72 67 73 29 0a 7d 0a 0a 2f 2f 20 46 6f 6c 6c 6f 77 69 6e 67 20 6d 65 74 68 6f | nel,.args).}..//.Following.metho |
15d40 | 64 73 20 61 72 65 20 6d 61 70 70 65 64 20 74 6f 20 77 65 62 46 72 61 6d 65 2e 0a 63 6f 6e 73 74 | ds.are.mapped.to.webFrame..const |
15d60 | 20 77 65 62 46 72 61 6d 65 4d 65 74 68 6f 64 73 20 3d 20 5b 0a 20 20 27 69 6e 73 65 72 74 43 53 | .webFrameMethods.=.[...'insertCS |
15d80 | 53 27 2c 0a 20 20 27 69 6e 73 65 72 74 54 65 78 74 27 2c 0a 20 20 27 73 65 74 4c 61 79 6f 75 74 | S',...'insertText',...'setLayout |
15da0 | 5a 6f 6f 6d 4c 65 76 65 6c 4c 69 6d 69 74 73 27 2c 0a 20 20 27 73 65 74 56 69 73 75 61 6c 5a 6f | ZoomLevelLimits',...'setVisualZo |
15dc0 | 6f 6d 4c 65 76 65 6c 4c 69 6d 69 74 73 27 0a 5d 0a 0a 63 6f 6e 73 74 20 61 73 79 6e 63 57 65 62 | omLevelLimits'.]..const.asyncWeb |
15de0 | 46 72 61 6d 65 4d 65 74 68 6f 64 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 72 65 71 75 65 73 74 | FrameMethods.=.function.(request |
15e00 | 49 64 2c 20 6d 65 74 68 6f 64 2c 20 63 61 6c 6c 62 61 63 6b 2c 20 2e 2e 2e 61 72 67 73 29 20 7b | Id,.method,.callback,....args).{ |
15e20 | 0a 20 20 72 65 74 75 72 6e 20 6e 65 77 20 50 72 6f 6d 69 73 65 28 28 72 65 73 6f 6c 76 65 2c 20 | ...return.new.Promise((resolve,. |
15e40 | 72 65 6a 65 63 74 29 20 3d 3e 20 7b 0a 20 20 20 20 69 70 63 4d 61 69 6e 49 6e 74 65 72 6e 61 6c | reject).=>.{.....ipcMainInternal |
15e60 | 2e 6f 6e 63 65 28 60 45 4c 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 42 52 4f 57 53 45 52 | .once(`ELECTRON_INTERNAL_BROWSER |
15e80 | 5f 41 53 59 4e 43 5f 57 45 42 5f 46 52 41 4d 45 5f 52 45 53 50 4f 4e 53 45 5f 24 7b 72 65 71 75 | _ASYNC_WEB_FRAME_RESPONSE_${requ |
15ea0 | 65 73 74 49 64 7d 60 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 65 72 72 6f 72 2c | estId}`,.function.(event,.error, |
15ec0 | 20 72 65 73 75 6c 74 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 65 72 72 6f 72 20 3d 3d 20 6e 75 | .result).{.......if.(error.==.nu |
15ee0 | 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 63 61 6c 6c 62 61 63 | ll).{.........if.(typeof.callbac |
15f00 | 6b 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 63 61 6c 6c 62 61 63 6b 28 72 65 73 75 6c | k.===.'function').callback(resul |
15f20 | 74 29 0a 20 20 20 20 20 20 20 20 72 65 73 6f 6c 76 65 28 72 65 73 75 6c 74 29 0a 20 20 20 20 20 | t).........resolve(result)...... |
15f40 | 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 72 65 6a 65 63 74 28 65 72 72 6f 72 55 74 | .}.else.{.........reject(errorUt |
15f60 | 69 6c 73 2e 64 65 73 65 72 69 61 6c 69 7a 65 28 65 72 72 6f 72 29 29 0a 20 20 20 20 20 20 7d 0a | ils.deserialize(error)).......}. |
15f80 | 20 20 20 20 7d 29 0a 20 20 20 20 74 68 69 73 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 28 27 45 | ....}).....this._sendInternal('E |
15fa0 | 4c 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 52 45 4e 44 45 52 45 52 5f 41 53 59 4e 43 5f | LECTRON_INTERNAL_RENDERER_ASYNC_ |
15fc0 | 57 45 42 5f 46 52 41 4d 45 5f 4d 45 54 48 4f 44 27 2c 20 72 65 71 75 65 73 74 49 64 2c 20 6d 65 | WEB_FRAME_METHOD',.requestId,.me |
15fe0 | 74 68 6f 64 2c 20 61 72 67 73 29 0a 20 20 7d 29 0a 7d 0a 0a 66 6f 72 20 28 63 6f 6e 73 74 20 6d | thod,.args)...}).}..for.(const.m |
16000 | 65 74 68 6f 64 20 6f 66 20 77 65 62 46 72 61 6d 65 4d 65 74 68 6f 64 73 29 20 7b 0a 20 20 57 65 | ethod.of.webFrameMethods).{...We |
16020 | 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 5b 6d 65 74 68 6f 64 5d 20 3d 20 66 75 | bContents.prototype[method].=.fu |
16040 | 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 5f 73 65 6e | nction.(...args).{.....this._sen |
16060 | 64 49 6e 74 65 72 6e 61 6c 28 27 45 4c 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 52 45 4e | dInternal('ELECTRON_INTERNAL_REN |
16080 | 44 45 52 45 52 5f 57 45 42 5f 46 52 41 4d 45 5f 4d 45 54 48 4f 44 27 2c 20 6d 65 74 68 6f 64 2c | DERER_WEB_FRAME_METHOD',.method, |
160a0 | 20 61 72 67 73 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 4d 61 6b 65 20 73 75 72 65 20 57 65 62 43 6f | .args)...}.}..//.Make.sure.WebCo |
160c0 | 6e 74 65 6e 74 73 3a 3a 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 20 77 6f 75 6c 64 20 | ntents::executeJavaScript.would. |
160e0 | 72 75 6e 20 74 68 65 20 63 6f 64 65 20 6f 6e 6c 79 20 77 68 65 6e 20 74 68 65 0a 2f 2f 20 57 65 | run.the.code.only.when.the.//.We |
16100 | 62 43 6f 6e 74 65 6e 74 73 20 68 61 73 20 62 65 65 6e 20 6c 6f 61 64 65 64 2e 0a 57 65 62 43 6f | bContents.has.been.loaded..WebCo |
16120 | 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 | ntents.prototype.executeJavaScri |
16140 | 70 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 6f 64 65 2c 20 68 61 73 55 73 65 72 47 65 73 74 | pt.=.function.(code,.hasUserGest |
16160 | 75 72 65 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 63 6f 6e 73 74 20 72 65 71 75 65 73 74 | ure,.callback).{...const.request |
16180 | 49 64 20 3d 20 67 65 74 4e 65 78 74 49 64 28 29 0a 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 68 | Id.=.getNextId()....if.(typeof.h |
161a0 | 61 73 55 73 65 72 47 65 73 74 75 72 65 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a | asUserGesture.===.'function').{. |
161c0 | 20 20 20 20 2f 2f 20 53 68 69 66 74 2e 0a 20 20 20 20 63 61 6c 6c 62 61 63 6b 20 3d 20 68 61 73 | ....//.Shift......callback.=.has |
161e0 | 55 73 65 72 47 65 73 74 75 72 65 0a 20 20 20 20 68 61 73 55 73 65 72 47 65 73 74 75 72 65 20 3d | UserGesture.....hasUserGesture.= |
16200 | 20 6e 75 6c 6c 0a 20 20 7d 0a 0a 20 20 69 66 20 28 68 61 73 55 73 65 72 47 65 73 74 75 72 65 20 | .null...}....if.(hasUserGesture. |
16220 | 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 68 61 73 55 73 65 72 47 65 73 74 75 72 65 20 3d 20 | ==.null).{.....hasUserGesture.=. |
16240 | 66 61 6c 73 65 0a 20 20 7d 0a 0a 20 20 69 66 20 28 74 68 69 73 2e 67 65 74 55 52 4c 28 29 20 26 | false...}....if.(this.getURL().& |
16260 | 26 20 21 74 68 69 73 2e 69 73 4c 6f 61 64 69 6e 67 4d 61 69 6e 46 72 61 6d 65 28 29 29 20 7b 0a | &.!this.isLoadingMainFrame()).{. |
16280 | 20 20 20 20 72 65 74 75 72 6e 20 61 73 79 6e 63 57 65 62 46 72 61 6d 65 4d 65 74 68 6f 64 73 2e | ....return.asyncWebFrameMethods. |
162a0 | 63 61 6c 6c 28 74 68 69 73 2c 20 72 65 71 75 65 73 74 49 64 2c 20 27 65 78 65 63 75 74 65 4a 61 | call(this,.requestId,.'executeJa |
162c0 | 76 61 53 63 72 69 70 74 27 2c 20 63 61 6c 6c 62 61 63 6b 2c 20 63 6f 64 65 2c 20 68 61 73 55 73 | vaScript',.callback,.code,.hasUs |
162e0 | 65 72 47 65 73 74 75 72 65 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 72 65 74 75 72 6e | erGesture)...}.else.{.....return |
16300 | 20 6e 65 77 20 50 72 6f 6d 69 73 65 28 28 72 65 73 6f 6c 76 65 2c 20 72 65 6a 65 63 74 29 20 3d | .new.Promise((resolve,.reject).= |
16320 | 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 6f 6e 63 65 28 27 64 69 64 2d 73 74 6f 70 2d 6c 6f | >.{.......this.once('did-stop-lo |
16340 | 61 64 69 6e 67 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 61 73 79 6e 63 57 65 62 | ading',.().=>.{.........asyncWeb |
16360 | 46 72 61 6d 65 4d 65 74 68 6f 64 73 2e 63 61 6c 6c 28 74 68 69 73 2c 20 72 65 71 75 65 73 74 49 | FrameMethods.call(this,.requestI |
16380 | 64 2c 20 27 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 27 2c 20 63 61 6c 6c 62 61 63 6b | d,.'executeJavaScript',.callback |
163a0 | 2c 20 63 6f 64 65 2c 20 68 61 73 55 73 65 72 47 65 73 74 75 72 65 29 2e 74 68 65 6e 28 72 65 73 | ,.code,.hasUserGesture).then(res |
163c0 | 6f 6c 76 65 29 2e 63 61 74 63 68 28 72 65 6a 65 63 74 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 | olve).catch(reject).......}).... |
163e0 | 20 7d 29 0a 20 20 7d 0a 7d 0a 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 | .})...}.}..WebContents.prototype |
16400 | 2e 74 61 6b 65 48 65 61 70 53 6e 61 70 73 68 6f 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 66 69 | .takeHeapSnapshot.=.function.(fi |
16420 | 6c 65 50 61 74 68 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 6e 65 77 20 50 72 6f 6d 69 73 65 28 28 | lePath).{...return.new.Promise(( |
16440 | 72 65 73 6f 6c 76 65 2c 20 72 65 6a 65 63 74 29 20 3d 3e 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 | resolve,.reject).=>.{.....const. |
16460 | 63 68 61 6e 6e 65 6c 20 3d 20 60 45 4c 45 43 54 52 4f 4e 5f 54 41 4b 45 5f 48 45 41 50 5f 53 4e | channel.=.`ELECTRON_TAKE_HEAP_SN |
16480 | 41 50 53 48 4f 54 5f 52 45 53 55 4c 54 5f 24 7b 67 65 74 4e 65 78 74 49 64 28 29 7d 60 0a 20 20 | APSHOT_RESULT_${getNextId()}`... |
164a0 | 20 20 69 70 63 4d 61 69 6e 49 6e 74 65 72 6e 61 6c 2e 6f 6e 63 65 28 63 68 61 6e 6e 65 6c 2c 20 | ..ipcMainInternal.once(channel,. |
164c0 | 28 65 76 65 6e 74 2c 20 73 75 63 63 65 73 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 69 66 20 28 | (event,.success).=>.{.......if.( |
164e0 | 73 75 63 63 65 73 73 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 73 6f 6c 76 65 28 29 0a 20 20 20 | success).{.........resolve().... |
16500 | 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 72 65 6a 65 63 74 28 6e 65 77 20 45 | ...}.else.{.........reject(new.E |
16520 | 72 72 6f 72 28 27 74 61 6b 65 48 65 61 70 53 6e 61 70 73 68 6f 74 20 66 61 69 6c 65 64 27 29 29 | rror('takeHeapSnapshot.failed')) |
16540 | 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 29 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 5f 74 | .......}.....}).....if.(!this._t |
16560 | 61 6b 65 48 65 61 70 53 6e 61 70 73 68 6f 74 28 66 69 6c 65 50 61 74 68 2c 20 63 68 61 6e 6e 65 | akeHeapSnapshot(filePath,.channe |
16580 | 6c 29 29 20 7b 0a 20 20 20 20 20 20 69 70 63 4d 61 69 6e 49 6e 74 65 72 6e 61 6c 2e 65 6d 69 74 | l)).{.......ipcMainInternal.emit |
165a0 | 28 63 68 61 6e 6e 65 6c 2c 20 66 61 6c 73 65 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 2f | (channel,.false).....}...}).}../ |
165c0 | 2f 20 54 72 61 6e 73 6c 61 74 65 20 74 68 65 20 6f 70 74 69 6f 6e 73 20 6f 66 20 70 72 69 6e 74 | /.Translate.the.options.of.print |
165e0 | 54 6f 50 44 46 2e 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 70 72 69 | ToPDF..WebContents.prototype.pri |
16600 | 6e 74 54 6f 50 44 46 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6f 70 74 69 6f 6e 73 2c 20 63 61 6c | ntToPDF.=.function.(options,.cal |
16620 | 6c 62 61 63 6b 29 20 7b 0a 20 20 63 6f 6e 73 74 20 70 72 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 | lback).{...const.printingSetting |
16640 | 20 3d 20 4f 62 6a 65 63 74 2e 61 73 73 69 67 6e 28 7b 7d 2c 20 64 65 66 61 75 6c 74 50 72 69 6e | .=.Object.assign({},.defaultPrin |
16660 | 74 69 6e 67 53 65 74 74 69 6e 67 29 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 6c 61 6e 64 73 | tingSetting)...if.(options.lands |
16680 | 63 61 70 65 29 20 7b 0a 20 20 20 20 70 72 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 2e 6c 61 6e 64 | cape).{.....printingSetting.land |
166a0 | 73 63 61 70 65 20 3d 20 6f 70 74 69 6f 6e 73 2e 6c 61 6e 64 73 63 61 70 65 0a 20 20 7d 0a 20 20 | scape.=.options.landscape...}... |
166c0 | 69 66 20 28 6f 70 74 69 6f 6e 73 2e 6d 61 72 67 69 6e 73 54 79 70 65 29 20 7b 0a 20 20 20 20 70 | if.(options.marginsType).{.....p |
166e0 | 72 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 2e 6d 61 72 67 69 6e 73 54 79 70 65 20 3d 20 6f 70 74 | rintingSetting.marginsType.=.opt |
16700 | 69 6f 6e 73 2e 6d 61 72 67 69 6e 73 54 79 70 65 0a 20 20 7d 0a 20 20 69 66 20 28 6f 70 74 69 6f | ions.marginsType...}...if.(optio |
16720 | 6e 73 2e 70 72 69 6e 74 53 65 6c 65 63 74 69 6f 6e 4f 6e 6c 79 29 20 7b 0a 20 20 20 20 70 72 69 | ns.printSelectionOnly).{.....pri |
16740 | 6e 74 69 6e 67 53 65 74 74 69 6e 67 2e 73 68 6f 75 6c 64 50 72 69 6e 74 53 65 6c 65 63 74 69 6f | ntingSetting.shouldPrintSelectio |
16760 | 6e 4f 6e 6c 79 20 3d 20 6f 70 74 69 6f 6e 73 2e 70 72 69 6e 74 53 65 6c 65 63 74 69 6f 6e 4f 6e | nOnly.=.options.printSelectionOn |
16780 | 6c 79 0a 20 20 7d 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 70 72 69 6e 74 42 61 63 6b 67 72 | ly...}...if.(options.printBackgr |
167a0 | 6f 75 6e 64 29 20 7b 0a 20 20 20 20 70 72 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 2e 73 68 6f 75 | ound).{.....printingSetting.shou |
167c0 | 6c 64 50 72 69 6e 74 42 61 63 6b 67 72 6f 75 6e 64 73 20 3d 20 6f 70 74 69 6f 6e 73 2e 70 72 69 | ldPrintBackgrounds.=.options.pri |
167e0 | 6e 74 42 61 63 6b 67 72 6f 75 6e 64 0a 20 20 7d 0a 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e | ntBackground...}....if.(options. |
16800 | 70 61 67 65 53 69 7a 65 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 70 61 67 65 53 69 7a 65 20 3d | pageSize).{.....const.pageSize.= |
16820 | 20 6f 70 74 69 6f 6e 73 2e 70 61 67 65 53 69 7a 65 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 | .options.pageSize.....if.(typeof |
16840 | 20 70 61 67 65 53 69 7a 65 20 3d 3d 3d 20 27 6f 62 6a 65 63 74 27 29 20 7b 0a 20 20 20 20 20 20 | .pageSize.===.'object').{....... |
16860 | 69 66 20 28 21 70 61 67 65 53 69 7a 65 2e 68 65 69 67 68 74 20 7c 7c 20 21 70 61 67 65 53 69 7a | if.(!pageSize.height.||.!pageSiz |
16880 | 65 2e 77 69 64 74 68 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 | e.width).{.........return.callba |
168a0 | 63 6b 28 6e 65 77 20 45 72 72 6f 72 28 27 4d 75 73 74 20 64 65 66 69 6e 65 20 68 65 69 67 68 74 | ck(new.Error('Must.define.height |
168c0 | 20 61 6e 64 20 77 69 64 74 68 20 66 6f 72 20 70 61 67 65 53 69 7a 65 27 29 29 0a 20 20 20 20 20 | .and.width.for.pageSize'))...... |
168e0 | 20 7d 0a 20 20 20 20 20 20 2f 2f 20 44 69 6d 65 6e 73 69 6f 6e 73 20 69 6e 20 4d 69 63 72 6f 6e | .}.......//.Dimensions.in.Micron |
16900 | 73 0a 20 20 20 20 20 20 2f 2f 20 31 20 6d 65 74 65 72 20 3d 20 31 30 5e 36 20 6d 69 63 72 6f 6e | s.......//.1.meter.=.10^6.micron |
16920 | 73 0a 20 20 20 20 20 20 70 72 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 2e 6d 65 64 69 61 53 69 7a | s.......printingSetting.mediaSiz |
16940 | 65 20 3d 20 7b 0a 20 20 20 20 20 20 20 20 6e 61 6d 65 3a 20 27 43 55 53 54 4f 4d 27 2c 0a 20 20 | e.=.{.........name:.'CUSTOM',... |
16960 | 20 20 20 20 20 20 63 75 73 74 6f 6d 5f 64 69 73 70 6c 61 79 5f 6e 61 6d 65 3a 20 27 43 75 73 74 | ......custom_display_name:.'Cust |
16980 | 6f 6d 27 2c 0a 20 20 20 20 20 20 20 20 68 65 69 67 68 74 5f 6d 69 63 72 6f 6e 73 3a 20 4d 61 74 | om',.........height_microns:.Mat |
169a0 | 68 2e 63 65 69 6c 28 70 61 67 65 53 69 7a 65 2e 68 65 69 67 68 74 29 2c 0a 20 20 20 20 20 20 20 | h.ceil(pageSize.height),........ |
169c0 | 20 77 69 64 74 68 5f 6d 69 63 72 6f 6e 73 3a 20 4d 61 74 68 2e 63 65 69 6c 28 70 61 67 65 53 69 | .width_microns:.Math.ceil(pageSi |
169e0 | 7a 65 2e 77 69 64 74 68 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 | ze.width).......}.....}.else.if. |
16a00 | 28 50 44 46 50 61 67 65 53 69 7a 65 73 5b 70 61 67 65 53 69 7a 65 5d 29 20 7b 0a 20 20 20 20 20 | (PDFPageSizes[pageSize]).{...... |
16a20 | 20 70 72 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 2e 6d 65 64 69 61 53 69 7a 65 20 3d 20 50 44 46 | .printingSetting.mediaSize.=.PDF |
16a40 | 50 61 67 65 53 69 7a 65 73 5b 70 61 67 65 53 69 7a 65 5d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b | PageSizes[pageSize].....}.else.{ |
16a60 | 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 6e 65 77 20 45 72 72 6f 72 | .......return.callback(new.Error |
16a80 | 28 60 44 6f 65 73 20 6e 6f 74 20 73 75 70 70 6f 72 74 20 70 61 67 65 53 69 7a 65 20 77 69 74 68 | (`Does.not.support.pageSize.with |
16aa0 | 20 24 7b 70 61 67 65 53 69 7a 65 7d 60 29 29 0a 20 20 20 20 7d 0a 20 20 7d 20 65 6c 73 65 20 7b | .${pageSize}`)).....}...}.else.{ |
16ac0 | 0a 20 20 20 20 70 72 69 6e 74 69 6e 67 53 65 74 74 69 6e 67 2e 6d 65 64 69 61 53 69 7a 65 20 3d | .....printingSetting.mediaSize.= |
16ae0 | 20 50 44 46 50 61 67 65 53 69 7a 65 73 5b 27 41 34 27 5d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 43 68 | .PDFPageSizes['A4']...}....//.Ch |
16b00 | 72 6f 6d 69 75 6d 20 65 78 70 65 63 74 73 20 74 68 69 73 20 69 6e 20 61 20 30 2d 31 30 30 20 72 | romium.expects.this.in.a.0-100.r |
16b20 | 61 6e 67 65 20 6e 75 6d 62 65 72 2c 20 6e 6f 74 20 61 73 20 66 6c 6f 61 74 0a 20 20 70 72 69 6e | ange.number,.not.as.float...prin |
16b40 | 74 69 6e 67 53 65 74 74 69 6e 67 2e 73 63 61 6c 65 46 61 63 74 6f 72 20 2a 3d 20 31 30 30 0a 20 | tingSetting.scaleFactor.*=.100.. |
16b60 | 20 69 66 20 28 66 65 61 74 75 72 65 73 2e 69 73 50 72 69 6e 74 69 6e 67 45 6e 61 62 6c 65 64 28 | .if.(features.isPrintingEnabled( |
16b80 | 29 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 5f 70 72 69 6e 74 54 6f 50 44 46 28 70 72 69 6e 74 69 | )).{.....this._printToPDF(printi |
16ba0 | 6e 67 53 65 74 74 69 6e 67 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a | ngSetting,.callback)...}.else.{. |
16bc0 | 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 27 45 72 72 6f 72 3a 20 50 72 69 6e 74 69 | ....console.error('Error:.Printi |
16be0 | 6e 67 20 66 65 61 74 75 72 65 20 69 73 20 64 69 73 61 62 6c 65 64 2e 27 29 0a 20 20 7d 0a 7d 0a | ng.feature.is.disabled.')...}.}. |
16c00 | 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 70 72 69 6e 74 20 3d 20 66 | .WebContents.prototype.print.=.f |
16c20 | 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 69 66 20 28 66 65 61 74 75 72 | unction.(...args).{...if.(featur |
16c40 | 65 73 2e 69 73 50 72 69 6e 74 69 6e 67 45 6e 61 62 6c 65 64 28 29 29 20 7b 0a 20 20 20 20 74 68 | es.isPrintingEnabled()).{.....th |
16c60 | 69 73 2e 5f 70 72 69 6e 74 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 | is._print(...args)...}.else.{... |
16c80 | 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 27 45 72 72 6f 72 3a 20 50 72 69 6e 74 69 6e 67 | ..console.error('Error:.Printing |
16ca0 | 20 66 65 61 74 75 72 65 20 69 73 20 64 69 73 61 62 6c 65 64 2e 27 29 0a 20 20 7d 0a 7d 0a 0a 57 | .feature.is.disabled.')...}.}..W |
16cc0 | 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 67 65 74 50 72 69 6e 74 65 72 73 | ebContents.prototype.getPrinters |
16ce0 | 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 69 66 20 28 66 65 61 74 75 72 65 73 2e | .=.function.().{...if.(features. |
16d00 | 69 73 50 72 69 6e 74 69 6e 67 45 6e 61 62 6c 65 64 28 29 29 20 7b 0a 20 20 20 20 72 65 74 75 72 | isPrintingEnabled()).{.....retur |
16d20 | 6e 20 74 68 69 73 2e 5f 67 65 74 50 72 69 6e 74 65 72 73 28 29 0a 20 20 7d 20 65 6c 73 65 20 7b | n.this._getPrinters()...}.else.{ |
16d40 | 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 27 45 72 72 6f 72 3a 20 50 72 69 6e 74 | .....console.error('Error:.Print |
16d60 | 69 6e 67 20 66 65 61 74 75 72 65 20 69 73 20 64 69 73 61 62 6c 65 64 2e 27 29 0a 20 20 7d 0a 7d | ing.feature.is.disabled.')...}.} |
16d80 | 0a 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 67 65 74 5a 6f 6f 6d 4c | ..WebContents.prototype.getZoomL |
16da0 | 65 76 65 6c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 69 | evel.=.function.(callback).{...i |
16dc0 | 66 20 28 74 79 70 65 6f 66 20 63 61 6c 6c 62 61 63 6b 20 21 3d 3d 20 27 66 75 6e 63 74 69 6f 6e | f.(typeof.callback.!==.'function |
16de0 | 27 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 4d 75 73 74 20 70 | ').{.....throw.new.Error('Must.p |
16e00 | 61 73 73 20 66 75 6e 63 74 69 6f 6e 20 61 73 20 61 6e 20 61 72 67 75 6d 65 6e 74 27 29 0a 20 20 | ass.function.as.an.argument')... |
16e20 | 7d 0a 20 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 28 29 20 3d 3e 20 7b 0a 20 20 20 | }...process.nextTick(().=>.{.... |
16e40 | 20 63 6f 6e 73 74 20 7a 6f 6f 6d 4c 65 76 65 6c 20 3d 20 74 68 69 73 2e 5f 67 65 74 5a 6f 6f 6d | .const.zoomLevel.=.this._getZoom |
16e60 | 4c 65 76 65 6c 28 29 0a 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 7a 6f 6f 6d 4c 65 76 65 6c 29 0a | Level().....callback(zoomLevel). |
16e80 | 20 20 7d 29 0a 7d 0a 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 6c 6f | ..}).}..WebContents.prototype.lo |
16ea0 | 61 64 46 69 6c 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 66 69 6c 65 50 61 74 68 2c 20 6f 70 74 | adFile.=.function.(filePath,.opt |
16ec0 | 69 6f 6e 73 20 3d 20 7b 7d 29 20 7b 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 66 69 6c 65 50 61 | ions.=.{}).{...if.(typeof.filePa |
16ee0 | 74 68 20 21 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 | th.!==.'string').{.....throw.new |
16f00 | 20 45 72 72 6f 72 28 27 4d 75 73 74 20 70 61 73 73 20 66 69 6c 65 50 61 74 68 20 61 73 20 61 20 | .Error('Must.pass.filePath.as.a. |
16f20 | 73 74 72 69 6e 67 27 29 0a 20 20 7d 0a 20 20 63 6f 6e 73 74 20 7b 20 71 75 65 72 79 2c 20 73 65 | string')...}...const.{.query,.se |
16f40 | 61 72 63 68 2c 20 68 61 73 68 20 7d 20 3d 20 6f 70 74 69 6f 6e 73 0a 0a 20 20 72 65 74 75 72 6e | arch,.hash.}.=.options....return |
16f60 | 20 74 68 69 73 2e 6c 6f 61 64 55 52 4c 28 75 72 6c 2e 66 6f 72 6d 61 74 28 7b 0a 20 20 20 20 70 | .this.loadURL(url.format({.....p |
16f80 | 72 6f 74 6f 63 6f 6c 3a 20 27 66 69 6c 65 27 2c 0a 20 20 20 20 73 6c 61 73 68 65 73 3a 20 74 72 | rotocol:.'file',.....slashes:.tr |
16fa0 | 75 65 2c 0a 20 20 20 20 70 61 74 68 6e 61 6d 65 3a 20 70 61 74 68 2e 72 65 73 6f 6c 76 65 28 61 | ue,.....pathname:.path.resolve(a |
16fc0 | 70 70 2e 67 65 74 41 70 70 50 61 74 68 28 29 2c 20 66 69 6c 65 50 61 74 68 29 2c 0a 20 20 20 20 | pp.getAppPath(),.filePath),..... |
16fe0 | 71 75 65 72 79 2c 0a 20 20 20 20 73 65 61 72 63 68 2c 0a 20 20 20 20 68 61 73 68 0a 20 20 7d 29 | query,.....search,.....hash...}) |
17000 | 29 0a 7d 0a 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f 74 79 70 65 2e 67 65 74 5a 6f | ).}..WebContents.prototype.getZo |
17020 | 6f 6d 46 61 63 74 6f 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b | omFactor.=.function.(callback).{ |
17040 | 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 63 61 6c 6c 62 61 63 6b 20 21 3d 3d 20 27 66 75 6e 63 | ...if.(typeof.callback.!==.'func |
17060 | 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 4d 75 | tion').{.....throw.new.Error('Mu |
17080 | 73 74 20 70 61 73 73 20 66 75 6e 63 74 69 6f 6e 20 61 73 20 61 6e 20 61 72 67 75 6d 65 6e 74 27 | st.pass.function.as.an.argument' |
170a0 | 29 0a 20 20 7d 0a 20 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 28 29 20 3d 3e 20 7b | )...}...process.nextTick(().=>.{ |
170c0 | 0a 20 20 20 20 63 6f 6e 73 74 20 7a 6f 6f 6d 46 61 63 74 6f 72 20 3d 20 74 68 69 73 2e 5f 67 65 | .....const.zoomFactor.=.this._ge |
170e0 | 74 5a 6f 6f 6d 46 61 63 74 6f 72 28 29 0a 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 7a 6f 6f 6d 46 | tZoomFactor().....callback(zoomF |
17100 | 61 63 74 6f 72 29 0a 20 20 7d 29 0a 7d 0a 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 72 6f 74 6f | actor)...}).}..WebContents.proto |
17120 | 74 79 70 65 2e 66 69 6e 64 49 6e 50 61 67 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 74 65 78 74 | type.findInPage.=.function.(text |
17140 | 2c 20 6f 70 74 69 6f 6e 73 20 3d 20 7b 7d 29 20 7b 0a 20 20 2f 2f 20 54 4f 44 4f 20 28 6e 69 74 | ,.options.=.{}).{...//.TODO.(nit |
17160 | 73 61 6b 68 29 3a 20 52 65 6d 6f 76 65 20 69 6e 20 35 2e 30 0a 20 20 69 66 20 28 6f 70 74 69 6f | sakh):.Remove.in.5.0...if.(optio |
17180 | 6e 73 2e 77 6f 72 64 53 74 61 72 74 20 21 3d 20 6e 75 6c 6c 20 7c 7c 20 6f 70 74 69 6f 6e 73 2e | ns.wordStart.!=.null.||.options. |
171a0 | 6d 65 64 69 61 6c 43 61 70 69 74 61 6c 41 74 57 6f 72 64 53 74 61 72 74 20 21 3d 20 6e 75 6c 6c | medialCapitalAtWordStart.!=.null |
171c0 | 29 20 7b 0a 20 20 20 20 64 65 70 72 65 63 61 74 65 2e 6c 6f 67 28 27 77 6f 72 64 53 74 61 72 74 | ).{.....deprecate.log('wordStart |
171e0 | 20 61 6e 64 20 6d 65 64 69 61 6c 43 61 70 69 74 61 6c 41 74 57 6f 72 64 53 74 61 72 74 20 6f 70 | .and.medialCapitalAtWordStart.op |
17200 | 74 69 6f 6e 73 20 61 72 65 20 64 65 70 72 65 63 61 74 65 64 27 29 0a 20 20 7d 0a 20 20 72 65 74 | tions.are.deprecated')...}...ret |
17220 | 75 72 6e 20 74 68 69 73 2e 5f 66 69 6e 64 49 6e 50 61 67 65 28 74 65 78 74 2c 20 6f 70 74 69 6f | urn.this._findInPage(text,.optio |
17240 | 6e 73 29 0a 7d 0a 0a 63 6f 6e 73 74 20 73 61 66 65 50 72 6f 74 6f 63 6f 6c 73 20 3d 20 6e 65 77 | ns).}..const.safeProtocols.=.new |
17260 | 20 53 65 74 28 5b 0a 20 20 27 63 68 72 6f 6d 65 2d 64 65 76 74 6f 6f 6c 73 3a 27 2c 0a 20 20 27 | .Set([...'chrome-devtools:',...' |
17280 | 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 3a 27 0a 5d 29 0a 0a 63 6f 6e 73 74 20 69 73 57 | chrome-extension:'.])..const.isW |
172a0 | 65 62 43 6f 6e 74 65 6e 74 73 54 72 75 73 74 65 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 6f | ebContentsTrusted.=.function.(co |
172c0 | 6e 74 65 6e 74 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 70 61 67 65 55 52 4c 20 3d 20 63 6f 6e 74 | ntents).{...const.pageURL.=.cont |
172e0 | 65 6e 74 73 2e 5f 67 65 74 55 52 4c 28 29 0a 20 20 63 6f 6e 73 74 20 7b 20 70 72 6f 74 6f 63 6f | ents._getURL()...const.{.protoco |
17300 | 6c 20 7d 20 3d 20 75 72 6c 2e 70 61 72 73 65 28 70 61 67 65 55 52 4c 29 0a 20 20 72 65 74 75 72 | l.}.=.url.parse(pageURL)...retur |
17320 | 6e 20 73 61 66 65 50 72 6f 74 6f 63 6f 6c 73 2e 68 61 73 28 70 72 6f 74 6f 63 6f 6c 29 0a 7d 0a | n.safeProtocols.has(protocol).}. |
17340 | 0a 2f 2f 20 41 64 64 20 4a 61 76 61 53 63 72 69 70 74 20 77 72 61 70 70 65 72 73 20 66 6f 72 20 | .//.Add.JavaScript.wrappers.for. |
17360 | 57 65 62 43 6f 6e 74 65 6e 74 73 20 63 6c 61 73 73 2e 0a 57 65 62 43 6f 6e 74 65 6e 74 73 2e 70 | WebContents.class..WebContents.p |
17380 | 72 6f 74 6f 74 79 70 65 2e 5f 69 6e 69 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 | rototype._init.=.function.().{.. |
173a0 | 20 2f 2f 20 54 68 65 20 6e 61 76 69 67 61 74 69 6f 6e 20 63 6f 6e 74 72 6f 6c 6c 65 72 2e 0a 20 | .//.The.navigation.controller... |
173c0 | 20 4e 61 76 69 67 61 74 69 6f 6e 43 6f 6e 74 72 6f 6c 6c 65 72 2e 63 61 6c 6c 28 74 68 69 73 2c | .NavigationController.call(this, |
173e0 | 20 74 68 69 73 29 0a 0a 20 20 2f 2f 20 45 76 65 72 79 20 72 65 6d 6f 74 65 20 63 61 6c 6c 62 61 | .this)....//.Every.remote.callba |
17400 | 63 6b 20 66 72 6f 6d 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 73 20 77 6f 75 6c 64 20 61 | ck.from.renderer.process.would.a |
17420 | 64 64 20 61 20 6c 69 73 74 65 6e 74 65 72 20 74 6f 20 74 68 65 0a 20 20 2f 2f 20 72 65 6e 64 65 | dd.a.listenter.to.the...//.rende |
17440 | 72 2d 76 69 65 77 2d 64 65 6c 65 74 65 64 20 65 76 65 6e 74 2c 20 73 6f 20 69 67 6e 6f 72 65 20 | r-view-deleted.event,.so.ignore. |
17460 | 74 68 65 20 6c 69 73 74 65 6e 74 65 72 73 20 77 61 72 6e 69 6e 67 2e 0a 20 20 74 68 69 73 2e 73 | the.listenters.warning....this.s |
17480 | 65 74 4d 61 78 4c 69 73 74 65 6e 65 72 73 28 30 29 0a 0a 20 20 2f 2f 20 44 69 73 70 61 74 63 68 | etMaxListeners(0)....//.Dispatch |
174a0 | 20 49 50 43 20 6d 65 73 73 61 67 65 73 20 74 6f 20 74 68 65 20 69 70 63 20 6d 6f 64 75 6c 65 2e | .IPC.messages.to.the.ipc.module. |
174c0 | 0a 20 20 74 68 69 73 2e 6f 6e 28 27 69 70 63 2d 6d 65 73 73 61 67 65 27 2c 20 66 75 6e 63 74 69 | ...this.on('ipc-message',.functi |
174e0 | 6f 6e 20 28 65 76 65 6e 74 2c 20 5b 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 5d 29 20 7b | on.(event,.[channel,....args]).{ |
17500 | 0a 20 20 20 20 69 70 63 4d 61 69 6e 2e 65 6d 69 74 28 63 68 61 6e 6e 65 6c 2c 20 65 76 65 6e 74 | .....ipcMain.emit(channel,.event |
17520 | 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 29 0a 20 20 74 68 69 73 2e 6f 6e 28 27 69 70 63 2d 6d | ,....args)...})...this.on('ipc-m |
17540 | 65 73 73 61 67 65 2d 73 79 6e 63 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 5b | essage-sync',.function.(event,.[ |
17560 | 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 5d 29 20 7b 0a 20 20 20 20 4f 62 6a 65 63 74 2e | channel,....args]).{.....Object. |
17580 | 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 65 76 65 6e 74 2c 20 27 72 65 74 75 72 6e 56 61 6c | defineProperty(event,.'returnVal |
175a0 | 75 65 27 2c 20 7b 0a 20 20 20 20 20 20 73 65 74 3a 20 66 75 6e 63 74 69 6f 6e 20 28 76 61 6c 75 | ue',.{.......set:.function.(valu |
175c0 | 65 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 65 76 65 6e 74 2e 73 65 6e 64 52 65 | e).{.........return.event.sendRe |
175e0 | 70 6c 79 28 5b 76 61 6c 75 65 5d 29 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 67 65 74 3a | ply([value]).......},.......get: |
17600 | 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 7d 0a 20 20 20 20 7d 29 0a 20 20 20 20 69 70 63 4d 61 | .function.().{}.....}).....ipcMa |
17620 | 69 6e 2e 65 6d 69 74 28 63 68 61 6e 6e 65 6c 2c 20 65 76 65 6e 74 2c 20 2e 2e 2e 61 72 67 73 29 | in.emit(channel,.event,....args) |
17640 | 0a 20 20 7d 29 0a 0a 20 20 74 68 69 73 2e 6f 6e 28 27 69 70 63 2d 69 6e 74 65 72 6e 61 6c 2d 6d | ...})....this.on('ipc-internal-m |
17660 | 65 73 73 61 67 65 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 5b 63 68 61 6e 6e | essage',.function.(event,.[chann |
17680 | 65 6c 2c 20 2e 2e 2e 61 72 67 73 5d 29 20 7b 0a 20 20 20 20 69 70 63 4d 61 69 6e 49 6e 74 65 72 | el,....args]).{.....ipcMainInter |
176a0 | 6e 61 6c 2e 65 6d 69 74 28 63 68 61 6e 6e 65 6c 2c 20 65 76 65 6e 74 2c 20 2e 2e 2e 61 72 67 73 | nal.emit(channel,.event,....args |
176c0 | 29 0a 20 20 7d 29 0a 20 20 74 68 69 73 2e 6f 6e 28 27 69 70 63 2d 69 6e 74 65 72 6e 61 6c 2d 6d | )...})...this.on('ipc-internal-m |
176e0 | 65 73 73 61 67 65 2d 73 79 6e 63 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 5b | essage-sync',.function.(event,.[ |
17700 | 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 5d 29 20 7b 0a 20 20 20 20 4f 62 6a 65 63 74 2e | channel,....args]).{.....Object. |
17720 | 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 65 76 65 6e 74 2c 20 27 72 65 74 75 72 6e 56 61 6c | defineProperty(event,.'returnVal |
17740 | 75 65 27 2c 20 7b 0a 20 20 20 20 20 20 73 65 74 3a 20 66 75 6e 63 74 69 6f 6e 20 28 76 61 6c 75 | ue',.{.......set:.function.(valu |
17760 | 65 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 65 76 65 6e 74 2e 73 65 6e 64 52 65 | e).{.........return.event.sendRe |
17780 | 70 6c 79 28 5b 76 61 6c 75 65 5d 29 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 67 65 74 3a | ply([value]).......},.......get: |
177a0 | 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 7d 0a 20 20 20 20 7d 29 0a 20 20 20 20 69 70 63 4d 61 | .function.().{}.....}).....ipcMa |
177c0 | 69 6e 49 6e 74 65 72 6e 61 6c 2e 65 6d 69 74 28 63 68 61 6e 6e 65 6c 2c 20 65 76 65 6e 74 2c 20 | inInternal.emit(channel,.event,. |
177e0 | 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 48 61 6e 64 6c 65 20 63 6f 6e 74 65 | ...args)...})....//.Handle.conte |
17800 | 78 74 20 6d 65 6e 75 20 61 63 74 69 6f 6e 20 72 65 71 75 65 73 74 20 66 72 6f 6d 20 70 65 70 70 | xt.menu.action.request.from.pepp |
17820 | 65 72 20 70 6c 75 67 69 6e 2e 0a 20 20 74 68 69 73 2e 6f 6e 28 27 70 65 70 70 65 72 2d 63 6f 6e | er.plugin....this.on('pepper-con |
17840 | 74 65 78 74 2d 6d 65 6e 75 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 70 61 72 | text-menu',.function.(event,.par |
17860 | 61 6d 73 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 2f 2f 20 41 63 63 65 73 73 20 4d | ams,.callback).{.....//.Access.M |
17880 | 65 6e 75 20 76 69 61 20 65 6c 65 63 74 72 6f 6e 2e 4d 65 6e 75 20 74 6f 20 70 72 65 76 65 6e 74 | enu.via.electron.Menu.to.prevent |
178a0 | 20 63 69 72 63 75 6c 61 72 20 72 65 71 75 69 72 65 2e 0a 20 20 20 20 63 6f 6e 73 74 20 6d 65 6e | .circular.require......const.men |
178c0 | 75 20 3d 20 65 6c 65 63 74 72 6f 6e 2e 4d 65 6e 75 2e 62 75 69 6c 64 46 72 6f 6d 54 65 6d 70 6c | u.=.electron.Menu.buildFromTempl |
178e0 | 61 74 65 28 70 61 72 61 6d 73 2e 6d 65 6e 75 29 0a 20 20 20 20 6d 65 6e 75 2e 70 6f 70 75 70 28 | ate(params.menu).....menu.popup( |
17900 | 7b 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 3a 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 65 74 | {.......window:.event.sender.get |
17920 | 4f 77 6e 65 72 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 28 29 2c 0a 20 20 20 20 20 20 78 3a 20 70 | OwnerBrowserWindow(),.......x:.p |
17940 | 61 72 61 6d 73 2e 78 2c 0a 20 20 20 20 20 20 79 3a 20 70 61 72 61 6d 73 2e 79 2c 0a 20 20 20 20 | arams.x,.......y:.params.y,..... |
17960 | 20 20 63 61 6c 6c 62 61 63 6b 0a 20 20 20 20 7d 29 0a 20 20 7d 29 0a 0a 20 20 63 6f 6e 73 74 20 | ..callback.....})...})....const. |
17980 | 66 6f 72 77 61 72 64 65 64 45 76 65 6e 74 73 20 3d 20 5b 0a 20 20 20 20 27 72 65 6d 6f 74 65 2d | forwardedEvents.=.[.....'remote- |
179a0 | 72 65 71 75 69 72 65 27 2c 0a 20 20 20 20 27 72 65 6d 6f 74 65 2d 67 65 74 2d 67 6c 6f 62 61 6c | require',.....'remote-get-global |
179c0 | 27 2c 0a 20 20 20 20 27 72 65 6d 6f 74 65 2d 67 65 74 2d 62 75 69 6c 74 69 6e 27 2c 0a 20 20 20 | ',.....'remote-get-builtin',.... |
179e0 | 20 27 72 65 6d 6f 74 65 2d 67 65 74 2d 63 75 72 72 65 6e 74 2d 77 69 6e 64 6f 77 27 2c 0a 20 20 | .'remote-get-current-window',... |
17a00 | 20 20 27 72 65 6d 6f 74 65 2d 67 65 74 2d 63 75 72 72 65 6e 74 2d 77 65 62 2d 63 6f 6e 74 65 6e | ..'remote-get-current-web-conten |
17a20 | 74 73 27 2c 0a 20 20 20 20 27 72 65 6d 6f 74 65 2d 67 65 74 2d 67 75 65 73 74 2d 77 65 62 2d 63 | ts',.....'remote-get-guest-web-c |
17a40 | 6f 6e 74 65 6e 74 73 27 0a 20 20 5d 0a 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 65 76 65 6e 74 | ontents'...]....for.(const.event |
17a60 | 4e 61 6d 65 20 6f 66 20 66 6f 72 77 61 72 64 65 64 45 76 65 6e 74 73 29 20 7b 0a 20 20 20 20 74 | Name.of.forwardedEvents).{.....t |
17a80 | 68 69 73 2e 6f 6e 28 65 76 65 6e 74 4e 61 6d 65 2c 20 28 65 76 65 6e 74 2c 20 2e 2e 2e 61 72 67 | his.on(eventName,.(event,....arg |
17aa0 | 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 69 66 20 28 21 69 73 57 65 62 43 6f 6e 74 65 6e 74 73 | s).=>.{.......if.(!isWebContents |
17ac0 | 54 72 75 73 74 65 64 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 29 29 20 7b 0a 20 20 20 20 20 20 20 | Trusted(event.sender)).{........ |
17ae0 | 20 61 70 70 2e 65 6d 69 74 28 65 76 65 6e 74 4e 61 6d 65 2c 20 65 76 65 6e 74 2c 20 74 68 69 73 | .app.emit(eventName,.event,.this |
17b00 | 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 | ,....args).......}.....})...}... |
17b20 | 20 64 65 70 72 65 63 61 74 65 2e 65 76 65 6e 74 28 74 68 69 73 2c 20 27 64 69 64 2d 67 65 74 2d | .deprecate.event(this,.'did-get- |
17b40 | 72 65 73 70 6f 6e 73 65 2d 64 65 74 61 69 6c 73 27 2c 20 27 2d 64 69 64 2d 67 65 74 2d 72 65 73 | response-details',.'-did-get-res |
17b60 | 70 6f 6e 73 65 2d 64 65 74 61 69 6c 73 27 29 0a 20 20 64 65 70 72 65 63 61 74 65 2e 65 76 65 6e | ponse-details')...deprecate.even |
17b80 | 74 28 74 68 69 73 2c 20 27 64 69 64 2d 67 65 74 2d 72 65 64 69 72 65 63 74 2d 72 65 71 75 65 73 | t(this,.'did-get-redirect-reques |
17ba0 | 74 27 2c 20 27 2d 64 69 64 2d 67 65 74 2d 72 65 64 69 72 65 63 74 2d 72 65 71 75 65 73 74 27 29 | t',.'-did-get-redirect-request') |
17bc0 | 0a 0a 20 20 2f 2f 20 54 68 65 20 64 65 76 74 6f 6f 6c 73 20 72 65 71 75 65 73 74 73 20 74 68 65 | ....//.The.devtools.requests.the |
17be0 | 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 74 6f 20 72 65 6c 6f 61 64 2e 0a 20 20 74 68 69 73 2e 6f | .webContents.to.reload....this.o |
17c00 | 6e 28 27 64 65 76 74 6f 6f 6c 73 2d 72 65 6c 6f 61 64 2d 70 61 67 65 27 2c 20 66 75 6e 63 74 69 | n('devtools-reload-page',.functi |
17c20 | 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 72 65 6c 6f 61 64 28 29 0a 20 20 7d 29 0a 0a | on.().{.....this.reload()...}).. |
17c40 | 20 20 2f 2f 20 48 61 6e 64 6c 65 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 20 66 6f 72 20 42 72 6f 77 | ..//.Handle.window.open.for.Brow |
17c60 | 73 65 72 57 69 6e 64 6f 77 20 61 6e 64 20 42 72 6f 77 73 65 72 56 69 65 77 2e 0a 20 20 69 66 20 | serWindow.and.BrowserView....if. |
17c80 | 28 5b 27 62 72 6f 77 73 65 72 56 69 65 77 27 2c 20 27 77 69 6e 64 6f 77 27 5d 2e 69 6e 63 6c 75 | (['browserView',.'window'].inclu |
17ca0 | 64 65 73 28 74 68 69 73 2e 67 65 74 54 79 70 65 28 29 29 29 20 7b 0a 20 20 20 20 2f 2f 20 4d 61 | des(this.getType())).{.....//.Ma |
17cc0 | 6b 65 20 6e 65 77 20 77 69 6e 64 6f 77 73 20 72 65 71 75 65 73 74 65 64 20 62 79 20 6c 69 6e 6b | ke.new.windows.requested.by.link |
17ce0 | 73 20 62 65 68 61 76 65 20 6c 69 6b 65 20 22 77 69 6e 64 6f 77 2e 6f 70 65 6e 22 0a 20 20 20 20 | s.behave.like."window.open"..... |
17d00 | 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 2d 6e 65 77 2d 77 69 6e 64 6f 77 | this.webContents.on('-new-window |
17d20 | 27 2c 20 28 65 76 65 6e 74 2c 20 75 72 6c 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 64 69 73 70 6f | ',.(event,.url,.frameName,.dispo |
17d40 | 73 69 74 69 6f 6e 2c 0a 20 20 20 20 20 20 61 64 64 69 74 69 6f 6e 61 6c 46 65 61 74 75 72 65 73 | sition,.......additionalFeatures |
17d60 | 2c 20 70 6f 73 74 44 61 74 61 2c 0a 20 20 20 20 20 20 72 65 66 65 72 72 65 72 29 20 3d 3e 20 7b | ,.postData,.......referrer).=>.{ |
17d80 | 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 6f 70 74 69 6f 6e 73 20 3d 20 7b 0a 20 20 20 20 20 20 20 | .......const.options.=.{........ |
17da0 | 20 73 68 6f 77 3a 20 74 72 75 65 2c 0a 20 20 20 20 20 20 20 20 77 69 64 74 68 3a 20 38 30 30 2c | .show:.true,.........width:.800, |
17dc0 | 0a 20 20 20 20 20 20 20 20 68 65 69 67 68 74 3a 20 36 30 30 0a 20 20 20 20 20 20 7d 0a 20 20 20 | .........height:.600.......}.... |
17de0 | 20 20 20 69 70 63 4d 61 69 6e 49 6e 74 65 72 6e 61 6c 2e 65 6d 69 74 28 27 45 4c 45 43 54 52 4f | ...ipcMainInternal.emit('ELECTRO |
17e00 | 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 49 4e 54 45 52 4e 41 4c 5f | N_GUEST_WINDOW_MANAGER_INTERNAL_ |
17e20 | 57 49 4e 44 4f 57 5f 4f 50 45 4e 27 2c 0a 20 20 20 20 20 20 20 20 65 76 65 6e 74 2c 20 75 72 6c | WINDOW_OPEN',.........event,.url |
17e40 | 2c 20 72 65 66 65 72 72 65 72 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 64 69 73 70 6f 73 69 74 69 | ,.referrer,.frameName,.dispositi |
17e60 | 6f 6e 2c 0a 20 20 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 2c 20 61 64 64 69 74 69 6f 6e 61 6c 46 | on,.........options,.additionalF |
17e80 | 65 61 74 75 72 65 73 2c 20 70 6f 73 74 44 61 74 61 29 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 74 | eatures,.postData).....})......t |
17ea0 | 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 2d 77 65 62 2d 63 6f 6e 74 65 6e 74 | his.webContents.on('-web-content |
17ec0 | 73 2d 63 72 65 61 74 65 64 27 2c 20 28 65 76 65 6e 74 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 2c | s-created',.(event,.webContents, |
17ee0 | 20 75 72 6c 2c 0a 20 20 20 20 20 20 66 72 61 6d 65 4e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 20 20 | .url,.......frameName).=>.{..... |
17f00 | 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 77 65 62 43 6f 6e 74 65 | ..v8Util.setHiddenValue(webConte |
17f20 | 6e 74 73 2c 20 27 75 72 6c 2d 66 72 61 6d 65 6e 61 6d 65 27 2c 20 7b 20 75 72 6c 2c 20 66 72 61 | nts,.'url-framename',.{.url,.fra |
17f40 | 6d 65 4e 61 6d 65 20 7d 29 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 2f 2f 20 43 72 65 61 74 65 20 | meName.}).....})......//.Create. |
17f60 | 61 20 6e 65 77 20 62 72 6f 77 73 65 72 20 77 69 6e 64 6f 77 20 66 6f 72 20 74 68 65 20 6e 61 74 | a.new.browser.window.for.the.nat |
17f80 | 69 76 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 0a 20 20 20 20 2f 2f 20 22 77 69 | ive.implementation.of.....//."wi |
17fa0 | 6e 64 6f 77 2e 6f 70 65 6e 22 2c 20 75 73 65 64 20 69 6e 20 73 61 6e 64 62 6f 78 20 61 6e 64 20 | ndow.open",.used.in.sandbox.and. |
17fc0 | 6e 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 20 6d 6f 64 65 0a 20 20 20 20 74 68 69 73 2e 77 | nativeWindowOpen.mode.....this.w |
17fe0 | 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 2d 61 64 64 2d 6e 65 77 2d 63 6f 6e 74 65 6e 74 73 | ebContents.on('-add-new-contents |
18000 | 27 2c 20 28 65 76 65 6e 74 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 64 69 73 70 6f 73 69 74 | ',.(event,.webContents,.disposit |
18020 | 69 6f 6e 2c 0a 20 20 20 20 20 20 75 73 65 72 47 65 73 74 75 72 65 2c 20 6c 65 66 74 2c 20 74 6f | ion,.......userGesture,.left,.to |
18040 | 70 2c 20 77 69 64 74 68 2c 0a 20 20 20 20 20 20 68 65 69 67 68 74 29 20 3d 3e 20 7b 0a 20 20 20 | p,.width,.......height).=>.{.... |
18060 | 20 20 20 63 6f 6e 73 74 20 75 72 6c 46 72 61 6d 65 4e 61 6d 65 20 3d 20 76 38 55 74 69 6c 2e 67 | ...const.urlFrameName.=.v8Util.g |
18080 | 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 27 75 72 6c 2d | etHiddenValue(webContents,.'url- |
180a0 | 66 72 61 6d 65 6e 61 6d 65 27 29 0a 20 20 20 20 20 20 69 66 20 28 28 64 69 73 70 6f 73 69 74 69 | framename').......if.((dispositi |
180c0 | 6f 6e 20 21 3d 3d 20 27 66 6f 72 65 67 72 6f 75 6e 64 2d 74 61 62 27 20 26 26 20 64 69 73 70 6f | on.!==.'foreground-tab'.&&.dispo |
180e0 | 73 69 74 69 6f 6e 20 21 3d 3d 20 27 6e 65 77 2d 77 69 6e 64 6f 77 27 20 26 26 0a 20 20 20 20 20 | sition.!==.'new-window'.&&...... |
18100 | 20 20 20 20 20 20 64 69 73 70 6f 73 69 74 69 6f 6e 20 21 3d 3d 20 27 62 61 63 6b 67 72 6f 75 6e | ......disposition.!==.'backgroun |
18120 | 64 2d 74 61 62 27 29 20 7c 7c 20 21 75 72 6c 46 72 61 6d 65 4e 61 6d 65 29 20 7b 0a 20 20 20 20 | d-tab').||.!urlFrameName).{..... |
18140 | 20 20 20 20 65 76 65 6e 74 2e 70 72 65 76 65 6e 74 44 65 66 61 75 6c 74 28 29 0a 20 20 20 20 20 | ....event.preventDefault()...... |
18160 | 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 69 66 20 28 77 65 62 | ...return.......}........if.(web |
18180 | 43 6f 6e 74 65 6e 74 73 2e 67 65 74 4c 61 73 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 28 29 | Contents.getLastWebPreferences() |
181a0 | 2e 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 20 3d 3d 3d 20 74 72 75 65 29 20 7b 0a 20 20 20 | .nodeIntegration.===.true).{.... |
181c0 | 20 20 20 20 20 63 6f 6e 73 74 20 6d 65 73 73 61 67 65 20 3d 0a 20 20 20 20 20 20 20 20 20 20 27 | .....const.message.=...........' |
181e0 | 45 6e 61 62 6c 69 6e 67 20 4e 6f 64 65 2e 6a 73 20 69 6e 74 65 67 72 61 74 69 6f 6e 20 69 6e 20 | Enabling.Node.js.integration.in. |
18200 | 63 68 69 6c 64 20 77 69 6e 64 6f 77 73 20 6f 70 65 6e 65 64 20 77 69 74 68 20 74 68 65 20 27 20 | child.windows.opened.with.the.'. |
18220 | 2b 0a 20 20 20 20 20 20 20 20 20 20 27 22 6e 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 22 20 | +...........'"nativeWindowOpen". |
18240 | 6f 70 74 69 6f 6e 20 77 69 6c 6c 20 63 61 75 73 65 20 6d 65 6d 6f 72 79 20 6c 65 61 6b 73 2c 20 | option.will.cause.memory.leaks,. |
18260 | 70 6c 65 61 73 65 20 74 75 72 6e 20 6f 66 66 20 27 20 2b 0a 20 20 20 20 20 20 20 20 20 20 27 74 | please.turn.off.'.+...........'t |
18280 | 68 65 20 22 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 22 20 6f 70 74 69 6f 6e 2e 5c 5c 6e 27 | he."nodeIntegration".option.\\n' |
182a0 | 20 2b 0a 20 20 20 20 20 20 20 20 20 20 27 46 72 6f 6d 20 35 2e 78 20 63 68 69 6c 64 20 77 69 6e | .+...........'From.5.x.child.win |
182c0 | 64 6f 77 73 20 6f 70 65 6e 65 64 20 77 69 74 68 20 74 68 65 20 22 6e 61 74 69 76 65 57 69 6e 64 | dows.opened.with.the."nativeWind |
182e0 | 6f 77 4f 70 65 6e 22 20 6f 70 74 69 6f 6e 20 27 20 2b 0a 20 20 20 20 20 20 20 20 20 20 27 77 69 | owOpen".option.'.+...........'wi |
18300 | 6c 6c 20 61 6c 77 61 79 73 20 68 61 76 65 20 4e 6f 64 65 2e 6a 73 20 69 6e 74 65 67 72 61 74 69 | ll.always.have.Node.js.integrati |
18320 | 6f 6e 20 64 69 73 61 62 6c 65 64 2e 5c 5c 6e 27 20 2b 0a 20 20 20 20 20 20 20 20 20 20 27 53 65 | on.disabled.\\n'.+...........'Se |
18340 | 65 20 68 74 74 70 73 3a 2f 2f 67 69 74 68 75 62 2e 63 6f 6d 2f 65 6c 65 63 74 72 6f 6e 2f 65 6c | e.https://github.com/electron/el |
18360 | 65 63 74 72 6f 6e 2f 70 75 6c 6c 2f 31 35 30 37 36 20 66 6f 72 20 6d 6f 72 65 2e 27 0a 20 20 20 | ectron/pull/15076.for.more.'.... |
18380 | 20 20 20 20 20 2f 2f 20 63 6f 6e 73 6f 6c 65 20 69 73 20 6f 6e 6c 79 20 61 76 61 69 6c 61 62 6c | .....//.console.is.only.availabl |
183a0 | 65 20 61 66 74 65 72 20 44 4f 4d 20 69 73 20 63 72 65 61 74 65 64 2e 0a 20 20 20 20 20 20 20 20 | e.after.DOM.is.created.......... |
183c0 | 63 6f 6e 73 74 20 70 72 69 6e 74 57 61 72 6e 69 6e 67 20 3d 20 28 29 20 3d 3e 20 74 68 69 73 2e | const.printWarning.=.().=>.this. |
183e0 | 77 65 62 43 6f 6e 74 65 6e 74 73 2e 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 28 60 63 | webContents.executeJavaScript(`c |
18400 | 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 27 24 7b 6d 65 73 73 61 67 65 7d 27 29 60 29 0a 20 20 20 20 | onsole.warn('${message}')`)..... |
18420 | 20 20 20 20 69 66 20 28 74 68 69 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 73 44 6f 6d 52 65 | ....if.(this.webContents.isDomRe |
18440 | 61 64 79 28 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 70 72 69 6e 74 57 61 72 6e 69 6e 67 28 | ady()).{...........printWarning( |
18460 | 29 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 20 20 74 68 69 | ).........}.else.{...........thi |
18480 | 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 63 65 28 27 64 6f 6d 2d 72 65 61 64 79 27 2c 20 | s.webContents.once('dom-ready',. |
184a0 | 70 72 69 6e 74 57 61 72 6e 69 6e 67 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 0a | printWarning).........}.......}. |
184c0 | 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 7b 20 75 72 6c 2c 20 66 72 61 6d 65 4e 61 6d 65 20 7d 20 | .......const.{.url,.frameName.}. |
184e0 | 3d 20 75 72 6c 46 72 61 6d 65 4e 61 6d 65 0a 20 20 20 20 20 20 76 38 55 74 69 6c 2e 64 65 6c 65 | =.urlFrameName.......v8Util.dele |
18500 | 74 65 48 69 64 64 65 6e 56 61 6c 75 65 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 27 75 72 6c 2d | teHiddenValue(webContents,.'url- |
18520 | 66 72 61 6d 65 6e 61 6d 65 27 29 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 6f 70 74 69 6f 6e 73 20 | framename').......const.options. |
18540 | 3d 20 7b 0a 20 20 20 20 20 20 20 20 73 68 6f 77 3a 20 74 72 75 65 2c 0a 20 20 20 20 20 20 20 20 | =.{.........show:.true,......... |
18560 | 78 3a 20 6c 65 66 74 2c 0a 20 20 20 20 20 20 20 20 79 3a 20 74 6f 70 2c 0a 20 20 20 20 20 20 20 | x:.left,.........y:.top,........ |
18580 | 20 77 69 64 74 68 3a 20 77 69 64 74 68 20 7c 7c 20 38 30 30 2c 0a 20 20 20 20 20 20 20 20 68 65 | .width:.width.||.800,.........he |
185a0 | 69 67 68 74 3a 20 68 65 69 67 68 74 20 7c 7c 20 36 30 30 2c 0a 20 20 20 20 20 20 20 20 77 65 62 | ight:.height.||.600,.........web |
185c0 | 43 6f 6e 74 65 6e 74 73 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 66 | Contents.......}.......const.ref |
185e0 | 65 72 72 65 72 20 3d 20 7b 20 75 72 6c 3a 20 27 27 2c 20 70 6f 6c 69 63 79 3a 20 27 64 65 66 61 | errer.=.{.url:.'',.policy:.'defa |
18600 | 75 6c 74 27 20 7d 0a 20 20 20 20 20 20 69 70 63 4d 61 69 6e 49 6e 74 65 72 6e 61 6c 2e 65 6d 69 | ult'.}.......ipcMainInternal.emi |
18620 | 74 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 | t('ELECTRON_GUEST_WINDOW_MANAGER |
18640 | 5f 49 4e 54 45 52 4e 41 4c 5f 57 49 4e 44 4f 57 5f 4f 50 45 4e 27 2c 0a 20 20 20 20 20 20 20 20 | _INTERNAL_WINDOW_OPEN',......... |
18660 | 65 76 65 6e 74 2c 20 75 72 6c 2c 20 72 65 66 65 72 72 65 72 2c 20 66 72 61 6d 65 4e 61 6d 65 2c | event,.url,.referrer,.frameName, |
18680 | 20 64 69 73 70 6f 73 69 74 69 6f 6e 2c 20 6f 70 74 69 6f 6e 73 29 0a 20 20 20 20 7d 29 0a 20 20 | .disposition,.options).....})... |
186a0 | 7d 0a 0a 20 20 61 70 70 2e 65 6d 69 74 28 27 77 65 62 2d 63 6f 6e 74 65 6e 74 73 2d 63 72 65 61 | }....app.emit('web-contents-crea |
186c0 | 74 65 64 27 2c 20 7b 7d 2c 20 74 68 69 73 29 0a 7d 0a 0a 2f 2f 20 4a 61 76 61 53 63 72 69 70 74 | ted',.{},.this).}..//.JavaScript |
186e0 | 20 77 72 61 70 70 65 72 20 6f 66 20 44 65 62 75 67 67 65 72 2e 0a 63 6f 6e 73 74 20 7b 20 44 65 | .wrapper.of.Debugger..const.{.De |
18700 | 62 75 67 67 65 72 20 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 | bugger.}.=.process.atomBinding(' |
18720 | 64 65 62 75 67 67 65 72 27 29 0a 0a 4f 62 6a 65 63 74 2e 73 65 74 50 72 6f 74 6f 74 79 70 65 4f | debugger')..Object.setPrototypeO |
18740 | 66 28 44 65 62 75 67 67 65 72 2e 70 72 6f 74 6f 74 79 70 65 2c 20 45 76 65 6e 74 45 6d 69 74 74 | f(Debugger.prototype,.EventEmitt |
18760 | 65 72 2e 70 72 6f 74 6f 74 79 70 65 29 0a 0a 2f 2f 20 50 75 62 6c 69 63 20 41 50 49 73 2e 0a 6d | er.prototype)..//.Public.APIs..m |
18780 | 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 7b 0a 20 20 63 72 65 61 74 65 20 28 6f 70 74 69 | odule.exports.=.{...create.(opti |
187a0 | 6f 6e 73 20 3d 20 7b 7d 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 63 | ons.=.{}).{.....return.binding.c |
187c0 | 72 65 61 74 65 28 6f 70 74 69 6f 6e 73 29 0a 20 20 7d 2c 0a 0a 20 20 66 72 6f 6d 49 64 20 28 69 | reate(options)...},....fromId.(i |
187e0 | 64 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 66 72 6f 6d 49 64 28 69 | d).{.....return.binding.fromId(i |
18800 | 64 29 0a 20 20 7d 2c 0a 0a 20 20 67 65 74 46 6f 63 75 73 65 64 57 65 62 43 6f 6e 74 65 6e 74 73 | d)...},....getFocusedWebContents |
18820 | 20 28 29 20 7b 0a 20 20 20 20 6c 65 74 20 66 6f 63 75 73 65 64 20 3d 20 6e 75 6c 6c 0a 20 20 20 | .().{.....let.focused.=.null.... |
18840 | 20 66 6f 72 20 28 63 6f 6e 73 74 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 62 69 6e 64 69 6e 67 2e | .for.(const.contents.of.binding. |
18860 | 67 65 74 41 6c 6c 57 65 62 43 6f 6e 74 65 6e 74 73 28 29 29 20 7b 0a 20 20 20 20 20 20 69 66 20 | getAllWebContents()).{.......if. |
18880 | 28 21 63 6f 6e 74 65 6e 74 73 2e 69 73 46 6f 63 75 73 65 64 28 29 29 20 63 6f 6e 74 69 6e 75 65 | (!contents.isFocused()).continue |
188a0 | 0a 20 20 20 20 20 20 69 66 20 28 66 6f 63 75 73 65 64 20 3d 3d 20 6e 75 6c 6c 29 20 66 6f 63 75 | .......if.(focused.==.null).focu |
188c0 | 73 65 64 20 3d 20 63 6f 6e 74 65 6e 74 73 0a 20 20 20 20 20 20 2f 2f 20 52 65 74 75 72 6e 20 77 | sed.=.contents.......//.Return.w |
188e0 | 65 62 76 69 65 77 20 77 65 62 20 63 6f 6e 74 65 6e 74 73 20 77 68 69 63 68 20 6d 61 79 20 62 65 | ebview.web.contents.which.may.be |
18900 | 20 65 6d 62 65 64 64 65 64 20 69 6e 73 69 64 65 20 61 6e 6f 74 68 65 72 0a 20 20 20 20 20 20 2f | .embedded.inside.another......./ |
18920 | 2f 20 77 65 62 20 63 6f 6e 74 65 6e 74 73 20 74 68 61 74 20 69 73 20 61 6c 73 6f 20 72 65 70 6f | /.web.contents.that.is.also.repo |
18940 | 72 74 69 6e 67 20 61 73 20 66 6f 63 75 73 65 64 0a 20 20 20 20 20 20 69 66 20 28 63 6f 6e 74 65 | rting.as.focused.......if.(conte |
18960 | 6e 74 73 2e 67 65 74 54 79 70 65 28 29 20 3d 3d 3d 20 27 77 65 62 76 69 65 77 27 29 20 72 65 74 | nts.getType().===.'webview').ret |
18980 | 75 72 6e 20 63 6f 6e 74 65 6e 74 73 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 66 6f | urn.contents.....}.....return.fo |
189a0 | 63 75 73 65 64 0a 20 20 7d 2c 0a 0a 20 20 67 65 74 41 6c 6c 57 65 62 43 6f 6e 74 65 6e 74 73 20 | cused...},....getAllWebContents. |
189c0 | 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 67 65 74 41 6c 6c 57 65 | ().{.....return.binding.getAllWe |
189e0 | 62 43 6f 6e 74 65 6e 74 73 28 29 0a 20 20 7d 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a | bContents()...}.}.'use.strict'.. |
18a00 | 63 6f 6e 73 74 20 7b 20 61 70 70 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 42 72 6f 77 73 65 | const.{.app,.webContents,.Browse |
18a20 | 72 57 69 6e 64 6f 77 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a | rWindow.}.=.require('electron'). |
18a40 | 63 6f 6e 73 74 20 7b 20 67 65 74 41 6c 6c 57 65 62 43 6f 6e 74 65 6e 74 73 20 7d 20 3d 20 70 72 | const.{.getAllWebContents.}.=.pr |
18a60 | 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 77 65 62 5f 63 6f 6e 74 65 6e 74 73 27 | ocess.atomBinding('web_contents' |
18a80 | 29 0a 63 6f 6e 73 74 20 72 65 6e 64 65 72 50 72 6f 63 65 73 73 50 72 65 66 65 72 65 6e 63 65 73 | ).const.renderProcessPreferences |
18aa0 | 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 72 65 6e 64 65 72 5f 70 | .=.process.atomBinding('render_p |
18ac0 | 72 6f 63 65 73 73 5f 70 72 65 66 65 72 65 6e 63 65 73 27 29 2e 66 6f 72 41 6c 6c 57 65 62 43 6f | rocess_preferences').forAllWebCo |
18ae0 | 6e 74 65 6e 74 73 28 29 0a 63 6f 6e 73 74 20 69 70 63 4d 61 69 6e 20 3d 20 72 65 71 75 69 72 65 | ntents().const.ipcMain.=.require |
18b00 | 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 69 70 63 | ('@electron/internal/browser/ipc |
18b20 | 2d 6d 61 69 6e 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 0a 63 6f 6e 73 74 20 7b 20 42 75 66 66 65 72 | -main-internal')..const.{.Buffer |
18b40 | 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 62 75 66 66 65 72 27 29 0a 63 6f 6e 73 74 20 66 73 20 | .}.=.require('buffer').const.fs. |
18b60 | 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 29 0a 63 6f 6e 73 74 20 70 61 74 68 20 3d 20 72 65 71 | =.require('fs').const.path.=.req |
18b80 | 75 69 72 65 28 27 70 61 74 68 27 29 0a 63 6f 6e 73 74 20 75 72 6c 20 3d 20 72 65 71 75 69 72 65 | uire('path').const.url.=.require |
18ba0 | 28 27 75 72 6c 27 29 0a 0a 2f 2f 20 4d 61 70 70 69 6e 67 20 62 65 74 77 65 65 6e 20 65 78 74 65 | ('url')..//.Mapping.between.exte |
18bc0 | 6e 73 69 6f 6e 49 64 28 68 6f 73 74 6e 61 6d 65 29 20 61 6e 64 20 6d 61 6e 69 66 65 73 74 2e 0a | nsionId(hostname).and.manifest.. |
18be0 | 63 6f 6e 73 74 20 6d 61 6e 69 66 65 73 74 4d 61 70 20 3d 20 7b 7d 20 2f 2f 20 65 78 74 65 6e 73 | const.manifestMap.=.{}.//.extens |
18c00 | 69 6f 6e 49 64 20 3d 3e 20 6d 61 6e 69 66 65 73 74 0a 63 6f 6e 73 74 20 6d 61 6e 69 66 65 73 74 | ionId.=>.manifest.const.manifest |
18c20 | 4e 61 6d 65 4d 61 70 20 3d 20 7b 7d 20 2f 2f 20 6e 61 6d 65 20 3d 3e 20 6d 61 6e 69 66 65 73 74 | NameMap.=.{}.//.name.=>.manifest |
18c40 | 0a 63 6f 6e 73 74 20 64 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 4e 61 6d 65 73 20 3d 20 | .const.devToolsExtensionNames.=. |
18c60 | 6e 65 77 20 53 65 74 28 29 0a 0a 63 6f 6e 73 74 20 67 65 6e 65 72 61 74 65 45 78 74 65 6e 73 69 | new.Set()..const.generateExtensi |
18c80 | 6f 6e 49 64 46 72 6f 6d 4e 61 6d 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 29 20 7b | onIdFromName.=.function.(name).{ |
18ca0 | 0a 20 20 72 65 74 75 72 6e 20 6e 61 6d 65 2e 72 65 70 6c 61 63 65 28 2f 5b 5c 57 5f 5d 2b 2f 67 | ...return.name.replace(/[\W_]+/g |
18cc0 | 2c 20 27 2d 27 29 2e 74 6f 4c 6f 77 65 72 43 61 73 65 28 29 0a 7d 0a 0a 63 6f 6e 73 74 20 69 73 | ,.'-').toLowerCase().}..const.is |
18ce0 | 57 69 6e 64 6f 77 4f 72 57 65 62 56 69 65 77 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 65 62 43 | WindowOrWebView.=.function.(webC |
18d00 | 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 74 79 70 65 20 3d 20 77 65 62 43 6f 6e | ontents).{...const.type.=.webCon |
18d20 | 74 65 6e 74 73 2e 67 65 74 54 79 70 65 28 29 0a 20 20 72 65 74 75 72 6e 20 74 79 70 65 20 3d 3d | tents.getType()...return.type.== |
18d40 | 3d 20 27 77 69 6e 64 6f 77 27 20 7c 7c 20 74 79 70 65 20 3d 3d 3d 20 27 77 65 62 76 69 65 77 27 | =.'window'.||.type.===.'webview' |
18d60 | 0a 7d 0a 0a 2f 2f 20 43 72 65 61 74 65 20 6f 72 20 67 65 74 20 6d 61 6e 69 66 65 73 74 20 6f 62 | .}..//.Create.or.get.manifest.ob |
18d80 | 6a 65 63 74 20 66 72 6f 6d 20 7c 73 72 63 44 69 72 65 63 74 6f 72 79 7c 2e 0a 63 6f 6e 73 74 20 | ject.from.|srcDirectory|..const. |
18da0 | 67 65 74 4d 61 6e 69 66 65 73 74 46 72 6f 6d 50 61 74 68 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 | getManifestFromPath.=.function.( |
18dc0 | 73 72 63 44 69 72 65 63 74 6f 72 79 29 20 7b 0a 20 20 6c 65 74 20 6d 61 6e 69 66 65 73 74 0a 20 | srcDirectory).{...let.manifest.. |
18de0 | 20 6c 65 74 20 6d 61 6e 69 66 65 73 74 43 6f 6e 74 65 6e 74 0a 0a 20 20 74 72 79 20 7b 0a 20 20 | .let.manifestContent....try.{... |
18e00 | 20 20 6d 61 6e 69 66 65 73 74 43 6f 6e 74 65 6e 74 20 3d 20 66 73 2e 72 65 61 64 46 69 6c 65 53 | ..manifestContent.=.fs.readFileS |
18e20 | 79 6e 63 28 70 61 74 68 2e 6a 6f 69 6e 28 73 72 63 44 69 72 65 63 74 6f 72 79 2c 20 27 6d 61 6e | ync(path.join(srcDirectory,.'man |
18e40 | 69 66 65 73 74 2e 6a 73 6f 6e 27 29 29 0a 20 20 7d 20 63 61 74 63 68 20 28 72 65 61 64 45 72 72 | ifest.json'))...}.catch.(readErr |
18e60 | 6f 72 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 60 52 65 61 64 69 6e 67 20 | or).{.....console.warn(`Reading. |
18e80 | 24 7b 70 61 74 68 2e 6a 6f 69 6e 28 73 72 63 44 69 72 65 63 74 6f 72 79 2c 20 27 6d 61 6e 69 66 | ${path.join(srcDirectory,.'manif |
18ea0 | 65 73 74 2e 6a 73 6f 6e 27 29 7d 20 66 61 69 6c 65 64 2e 60 29 0a 20 20 20 20 63 6f 6e 73 6f 6c | est.json')}.failed.`).....consol |
18ec0 | 65 2e 77 61 72 6e 28 72 65 61 64 45 72 72 6f 72 2e 73 74 61 63 6b 20 7c 7c 20 72 65 61 64 45 72 | e.warn(readError.stack.||.readEr |
18ee0 | 72 6f 72 29 0a 20 20 20 20 74 68 72 6f 77 20 72 65 61 64 45 72 72 6f 72 0a 20 20 7d 0a 0a 20 20 | ror).....throw.readError...}.... |
18f00 | 74 72 79 20 7b 0a 20 20 20 20 6d 61 6e 69 66 65 73 74 20 3d 20 4a 53 4f 4e 2e 70 61 72 73 65 28 | try.{.....manifest.=.JSON.parse( |
18f20 | 6d 61 6e 69 66 65 73 74 43 6f 6e 74 65 6e 74 29 0a 20 20 7d 20 63 61 74 63 68 20 28 70 61 72 73 | manifestContent)...}.catch.(pars |
18f40 | 65 45 72 72 6f 72 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 60 50 61 72 73 | eError).{.....console.warn(`Pars |
18f60 | 69 6e 67 20 24 7b 70 61 74 68 2e 6a 6f 69 6e 28 73 72 63 44 69 72 65 63 74 6f 72 79 2c 20 27 6d | ing.${path.join(srcDirectory,.'m |
18f80 | 61 6e 69 66 65 73 74 2e 6a 73 6f 6e 27 29 7d 20 66 61 69 6c 65 64 2e 60 29 0a 20 20 20 20 63 6f | anifest.json')}.failed.`).....co |
18fa0 | 6e 73 6f 6c 65 2e 77 61 72 6e 28 70 61 72 73 65 45 72 72 6f 72 2e 73 74 61 63 6b 20 7c 7c 20 70 | nsole.warn(parseError.stack.||.p |
18fc0 | 61 72 73 65 45 72 72 6f 72 29 0a 20 20 20 20 74 68 72 6f 77 20 70 61 72 73 65 45 72 72 6f 72 0a | arseError).....throw.parseError. |
18fe0 | 20 20 7d 0a 0a 20 20 69 66 20 28 21 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 70 5b 6d 61 6e 69 | ..}....if.(!manifestNameMap[mani |
19000 | 66 65 73 74 2e 6e 61 6d 65 5d 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 65 78 74 65 6e 73 69 6f | fest.name]).{.....const.extensio |
19020 | 6e 49 64 20 3d 20 67 65 6e 65 72 61 74 65 45 78 74 65 6e 73 69 6f 6e 49 64 46 72 6f 6d 4e 61 6d | nId.=.generateExtensionIdFromNam |
19040 | 65 28 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 29 0a 20 20 20 20 6d 61 6e 69 66 65 73 74 4d 61 70 | e(manifest.name).....manifestMap |
19060 | 5b 65 78 74 65 6e 73 69 6f 6e 49 64 5d 20 3d 20 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 70 5b | [extensionId].=.manifestNameMap[ |
19080 | 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 5d 20 3d 20 6d 61 6e 69 66 65 73 74 0a 20 20 20 20 4f 62 | manifest.name].=.manifest.....Ob |
190a0 | 6a 65 63 74 2e 61 73 73 69 67 6e 28 6d 61 6e 69 66 65 73 74 2c 20 7b 0a 20 20 20 20 20 20 73 72 | ject.assign(manifest,.{.......sr |
190c0 | 63 44 69 72 65 63 74 6f 72 79 3a 20 73 72 63 44 69 72 65 63 74 6f 72 79 2c 0a 20 20 20 20 20 20 | cDirectory:.srcDirectory,....... |
190e0 | 65 78 74 65 6e 73 69 6f 6e 49 64 3a 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 0a 20 20 20 20 20 20 | extensionId:.extensionId,....... |
19100 | 2f 2f 20 57 65 20 63 61 6e 20 6e 6f 74 20 75 73 65 20 27 66 69 6c 65 3a 2f 2f 27 20 64 69 72 65 | //.We.can.not.use.'file://'.dire |
19120 | 63 74 6c 79 20 62 65 63 61 75 73 65 20 61 6c 6c 20 72 65 73 6f 75 72 63 65 73 20 69 6e 20 74 68 | ctly.because.all.resources.in.th |
19140 | 65 20 65 78 74 65 6e 73 69 6f 6e 0a 20 20 20 20 20 20 2f 2f 20 77 69 6c 6c 20 62 65 20 74 72 65 | e.extension.......//.will.be.tre |
19160 | 61 74 65 64 20 61 73 20 72 65 6c 61 74 69 76 65 20 74 6f 20 74 68 65 20 72 6f 6f 74 20 69 6e 20 | ated.as.relative.to.the.root.in. |
19180 | 43 68 72 6f 6d 65 2e 0a 20 20 20 20 20 20 73 74 61 72 74 50 61 67 65 3a 20 75 72 6c 2e 66 6f 72 | Chrome........startPage:.url.for |
191a0 | 6d 61 74 28 7b 0a 20 20 20 20 20 20 20 20 70 72 6f 74 6f 63 6f 6c 3a 20 27 63 68 72 6f 6d 65 2d | mat({.........protocol:.'chrome- |
191c0 | 65 78 74 65 6e 73 69 6f 6e 27 2c 0a 20 20 20 20 20 20 20 20 73 6c 61 73 68 65 73 3a 20 74 72 75 | extension',.........slashes:.tru |
191e0 | 65 2c 0a 20 20 20 20 20 20 20 20 68 6f 73 74 6e 61 6d 65 3a 20 65 78 74 65 6e 73 69 6f 6e 49 64 | e,.........hostname:.extensionId |
19200 | 2c 0a 20 20 20 20 20 20 20 20 70 61 74 68 6e 61 6d 65 3a 20 6d 61 6e 69 66 65 73 74 2e 64 65 76 | ,.........pathname:.manifest.dev |
19220 | 74 6f 6f 6c 73 5f 70 61 67 65 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 29 0a 20 20 20 20 72 | tools_page.......}).....}).....r |
19240 | 65 74 75 72 6e 20 6d 61 6e 69 66 65 73 74 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 6d 61 6e 69 | eturn.manifest...}.else.if.(mani |
19260 | 66 65 73 74 20 26 26 20 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 29 20 7b 0a 20 20 20 20 63 6f 6e | fest.&&.manifest.name).{.....con |
19280 | 73 6f 6c 65 2e 77 61 72 6e 28 60 41 74 74 65 6d 70 74 65 64 20 74 6f 20 6c 6f 61 64 20 65 78 74 | sole.warn(`Attempted.to.load.ext |
192a0 | 65 6e 73 69 6f 6e 20 22 24 7b 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 7d 22 20 74 68 61 74 20 68 | ension."${manifest.name}".that.h |
192c0 | 61 73 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 6c 6f 61 64 65 64 2e 60 29 0a 20 20 20 20 72 65 | as.already.been.loaded.`).....re |
192e0 | 74 75 72 6e 20 6d 61 6e 69 66 65 73 74 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 4d 61 6e 61 67 65 20 74 | turn.manifest...}.}..//.Manage.t |
19300 | 68 65 20 62 61 63 6b 67 72 6f 75 6e 64 20 70 61 67 65 73 2e 0a 63 6f 6e 73 74 20 62 61 63 6b 67 | he.background.pages..const.backg |
19320 | 72 6f 75 6e 64 50 61 67 65 73 20 3d 20 7b 7d 0a 0a 63 6f 6e 73 74 20 73 74 61 72 74 42 61 63 6b | roundPages.=.{}..const.startBack |
19340 | 67 72 6f 75 6e 64 50 61 67 65 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 61 6e 69 66 65 73 74 | groundPages.=.function.(manifest |
19360 | 29 20 7b 0a 20 20 69 66 20 28 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b 6d 61 6e 69 66 65 | ).{...if.(backgroundPages[manife |
19380 | 73 74 2e 65 78 74 65 6e 73 69 6f 6e 49 64 5d 20 7c 7c 20 21 6d 61 6e 69 66 65 73 74 2e 62 61 63 | st.extensionId].||.!manifest.bac |
193a0 | 6b 67 72 6f 75 6e 64 29 20 72 65 74 75 72 6e 0a 0a 20 20 6c 65 74 20 68 74 6d 6c 0a 20 20 6c 65 | kground).return....let.html...le |
193c0 | 74 20 6e 61 6d 65 0a 20 20 69 66 20 28 6d 61 6e 69 66 65 73 74 2e 62 61 63 6b 67 72 6f 75 6e 64 | t.name...if.(manifest.background |
193e0 | 2e 70 61 67 65 29 20 7b 0a 20 20 20 20 6e 61 6d 65 20 3d 20 6d 61 6e 69 66 65 73 74 2e 62 61 63 | .page).{.....name.=.manifest.bac |
19400 | 6b 67 72 6f 75 6e 64 2e 70 61 67 65 0a 20 20 20 20 68 74 6d 6c 20 3d 20 66 73 2e 72 65 61 64 46 | kground.page.....html.=.fs.readF |
19420 | 69 6c 65 53 79 6e 63 28 70 61 74 68 2e 6a 6f 69 6e 28 6d 61 6e 69 66 65 73 74 2e 73 72 63 44 69 | ileSync(path.join(manifest.srcDi |
19440 | 72 65 63 74 6f 72 79 2c 20 6d 61 6e 69 66 65 73 74 2e 62 61 63 6b 67 72 6f 75 6e 64 2e 70 61 67 | rectory,.manifest.background.pag |
19460 | 65 29 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 6e 61 6d 65 20 3d 20 27 5f 67 65 6e 65 | e))...}.else.{.....name.=.'_gene |
19480 | 72 61 74 65 64 5f 62 61 63 6b 67 72 6f 75 6e 64 5f 70 61 67 65 2e 68 74 6d 6c 27 0a 20 20 20 20 | rated_background_page.html'..... |
194a0 | 63 6f 6e 73 74 20 73 63 72 69 70 74 73 20 3d 20 6d 61 6e 69 66 65 73 74 2e 62 61 63 6b 67 72 6f | const.scripts.=.manifest.backgro |
194c0 | 75 6e 64 2e 73 63 72 69 70 74 73 2e 6d 61 70 28 28 6e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 20 20 | und.scripts.map((name).=>.{..... |
194e0 | 20 20 72 65 74 75 72 6e 20 60 3c 73 63 72 69 70 74 20 73 72 63 3d 22 24 7b 6e 61 6d 65 7d 22 3e | ..return.`<script.src="${name}"> |
19500 | 3c 2f 73 63 72 69 70 74 3e 60 0a 20 20 20 20 7d 29 2e 6a 6f 69 6e 28 27 27 29 0a 20 20 20 20 68 | </script>`.....}).join('').....h |
19520 | 74 6d 6c 20 3d 20 42 75 66 66 65 72 2e 66 72 6f 6d 28 60 3c 68 74 6d 6c 3e 3c 62 6f 64 79 3e 24 | tml.=.Buffer.from(`<html><body>$ |
19540 | 7b 73 63 72 69 70 74 73 7d 3c 2f 62 6f 64 79 3e 3c 2f 68 74 6d 6c 3e 60 29 0a 20 20 7d 0a 0a 20 | {scripts}</body></html>`)...}... |
19560 | 20 63 6f 6e 73 74 20 63 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 63 72 | .const.contents.=.webContents.cr |
19580 | 65 61 74 65 28 7b 0a 20 20 20 20 70 61 72 74 69 74 69 6f 6e 3a 20 27 70 65 72 73 69 73 74 3a 5f | eate({.....partition:.'persist:_ |
195a0 | 5f 63 68 72 6f 6d 65 5f 65 78 74 65 6e 73 69 6f 6e 27 2c 0a 20 20 20 20 69 73 42 61 63 6b 67 72 | _chrome_extension',.....isBackgr |
195c0 | 6f 75 6e 64 50 61 67 65 3a 20 74 72 75 65 2c 0a 20 20 20 20 63 6f 6d 6d 61 6e 64 4c 69 6e 65 53 | oundPage:.true,.....commandLineS |
195e0 | 77 69 74 63 68 65 73 3a 20 5b 27 2d 2d 62 61 63 6b 67 72 6f 75 6e 64 2d 70 61 67 65 27 5d 0a 20 | witches:.['--background-page'].. |
19600 | 20 7d 29 0a 20 20 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b 6d 61 6e 69 66 65 73 74 2e 65 | .})...backgroundPages[manifest.e |
19620 | 78 74 65 6e 73 69 6f 6e 49 64 5d 20 3d 20 7b 20 68 74 6d 6c 3a 20 68 74 6d 6c 2c 20 77 65 62 43 | xtensionId].=.{.html:.html,.webC |
19640 | 6f 6e 74 65 6e 74 73 3a 20 63 6f 6e 74 65 6e 74 73 2c 20 6e 61 6d 65 3a 20 6e 61 6d 65 20 7d 0a | ontents:.contents,.name:.name.}. |
19660 | 20 20 63 6f 6e 74 65 6e 74 73 2e 6c 6f 61 64 55 52 4c 28 75 72 6c 2e 66 6f 72 6d 61 74 28 7b 0a | ..contents.loadURL(url.format({. |
19680 | 20 20 20 20 70 72 6f 74 6f 63 6f 6c 3a 20 27 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 27 | ....protocol:.'chrome-extension' |
196a0 | 2c 0a 20 20 20 20 73 6c 61 73 68 65 73 3a 20 74 72 75 65 2c 0a 20 20 20 20 68 6f 73 74 6e 61 6d | ,.....slashes:.true,.....hostnam |
196c0 | 65 3a 20 6d 61 6e 69 66 65 73 74 2e 65 78 74 65 6e 73 69 6f 6e 49 64 2c 0a 20 20 20 20 70 61 74 | e:.manifest.extensionId,.....pat |
196e0 | 68 6e 61 6d 65 3a 20 6e 61 6d 65 0a 20 20 7d 29 29 0a 7d 0a 0a 63 6f 6e 73 74 20 72 65 6d 6f 76 | hname:.name...})).}..const.remov |
19700 | 65 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 61 6e | eBackgroundPages.=.function.(man |
19720 | 69 66 65 73 74 29 20 7b 0a 20 20 69 66 20 28 21 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b | ifest).{...if.(!backgroundPages[ |
19740 | 6d 61 6e 69 66 65 73 74 2e 65 78 74 65 6e 73 69 6f 6e 49 64 5d 29 20 72 65 74 75 72 6e 0a 0a 20 | manifest.extensionId]).return... |
19760 | 20 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b 6d 61 6e 69 66 65 73 74 2e 65 78 74 65 6e 73 | .backgroundPages[manifest.extens |
19780 | 69 6f 6e 49 64 5d 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 64 65 73 74 72 6f 79 28 29 0a 20 20 64 | ionId].webContents.destroy()...d |
197a0 | 65 6c 65 74 65 20 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b 6d 61 6e 69 66 65 73 74 2e 65 | elete.backgroundPages[manifest.e |
197c0 | 78 74 65 6e 73 69 6f 6e 49 64 5d 0a 7d 0a 0a 63 6f 6e 73 74 20 73 65 6e 64 54 6f 42 61 63 6b 67 | xtensionId].}..const.sendToBackg |
197e0 | 72 6f 75 6e 64 50 61 67 65 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 | roundPages.=.function.(...args). |
19800 | 7b 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 70 61 67 65 20 6f 66 20 4f 62 6a 65 63 74 2e 76 61 | {...for.(const.page.of.Object.va |
19820 | 6c 75 65 73 28 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 29 29 20 7b 0a 20 20 20 20 70 61 67 | lues(backgroundPages)).{.....pag |
19840 | 65 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 54 6f 41 6c 6c | e.webContents._sendInternalToAll |
19860 | 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 44 69 73 70 61 74 63 68 20 77 65 62 | (...args)...}.}..//.Dispatch.web |
19880 | 20 63 6f 6e 74 65 6e 74 73 20 65 76 65 6e 74 73 20 74 6f 20 43 68 72 6f 6d 65 20 41 50 49 73 0a | .contents.events.to.Chrome.APIs. |
198a0 | 63 6f 6e 73 74 20 68 6f 6f 6b 57 65 62 43 6f 6e 74 65 6e 74 73 45 76 65 6e 74 73 20 3d 20 66 75 | const.hookWebContentsEvents.=.fu |
198c0 | 6e 63 74 69 6f 6e 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 74 | nction.(webContents).{...const.t |
198e0 | 61 62 49 64 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 64 0a 0a 20 20 73 65 6e 64 54 6f 42 | abId.=.webContents.id....sendToB |
19900 | 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 4f 4e 43 52 | ackgroundPages('CHROME_TABS_ONCR |
19920 | 45 41 54 45 44 27 29 0a 0a 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 77 69 6c 6c 2d | EATED')....webContents.on('will- |
19940 | 6e 61 76 69 67 61 74 65 27 2c 20 28 65 76 65 6e 74 2c 20 75 72 6c 29 20 3d 3e 20 7b 0a 20 20 20 | navigate',.(event,.url).=>.{.... |
19960 | 20 73 65 6e 64 54 6f 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 28 27 43 48 52 4f 4d 45 5f 57 | .sendToBackgroundPages('CHROME_W |
19980 | 45 42 4e 41 56 49 47 41 54 49 4f 4e 5f 4f 4e 42 45 46 4f 52 45 4e 41 56 49 47 41 54 45 27 2c 20 | EBNAVIGATION_ONBEFORENAVIGATE',. |
199a0 | 7b 0a 20 20 20 20 20 20 66 72 61 6d 65 49 64 3a 20 30 2c 0a 20 20 20 20 20 20 70 61 72 65 6e 74 | {.......frameId:.0,.......parent |
199c0 | 46 72 61 6d 65 49 64 3a 20 2d 31 2c 0a 20 20 20 20 20 20 70 72 6f 63 65 73 73 49 64 3a 20 77 65 | FrameId:.-1,.......processId:.we |
199e0 | 62 43 6f 6e 74 65 6e 74 73 2e 67 65 74 50 72 6f 63 65 73 73 49 64 28 29 2c 0a 20 20 20 20 20 20 | bContents.getProcessId(),....... |
19a00 | 74 61 62 49 64 3a 20 74 61 62 49 64 2c 0a 20 20 20 20 20 20 74 69 6d 65 53 74 61 6d 70 3a 20 44 | tabId:.tabId,.......timeStamp:.D |
19a20 | 61 74 65 2e 6e 6f 77 28 29 2c 0a 20 20 20 20 20 20 75 72 6c 3a 20 75 72 6c 0a 20 20 20 20 7d 29 | ate.now(),.......url:.url.....}) |
19a40 | 0a 20 20 7d 29 0a 0a 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 64 69 64 2d 6e 61 76 | ...})....webContents.on('did-nav |
19a60 | 69 67 61 74 65 27 2c 20 28 65 76 65 6e 74 2c 20 75 72 6c 29 20 3d 3e 20 7b 0a 20 20 20 20 73 65 | igate',.(event,.url).=>.{.....se |
19a80 | 6e 64 54 6f 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 28 27 43 48 52 4f 4d 45 5f 57 45 42 4e | ndToBackgroundPages('CHROME_WEBN |
19aa0 | 41 56 49 47 41 54 49 4f 4e 5f 4f 4e 43 4f 4d 50 4c 45 54 45 44 27 2c 20 7b 0a 20 20 20 20 20 20 | AVIGATION_ONCOMPLETED',.{....... |
19ac0 | 66 72 61 6d 65 49 64 3a 20 30 2c 0a 20 20 20 20 20 20 70 61 72 65 6e 74 46 72 61 6d 65 49 64 3a | frameId:.0,.......parentFrameId: |
19ae0 | 20 2d 31 2c 0a 20 20 20 20 20 20 70 72 6f 63 65 73 73 49 64 3a 20 77 65 62 43 6f 6e 74 65 6e 74 | .-1,.......processId:.webContent |
19b00 | 73 2e 67 65 74 50 72 6f 63 65 73 73 49 64 28 29 2c 0a 20 20 20 20 20 20 74 61 62 49 64 3a 20 74 | s.getProcessId(),.......tabId:.t |
19b20 | 61 62 49 64 2c 0a 20 20 20 20 20 20 74 69 6d 65 53 74 61 6d 70 3a 20 44 61 74 65 2e 6e 6f 77 28 | abId,.......timeStamp:.Date.now( |
19b40 | 29 2c 0a 20 20 20 20 20 20 75 72 6c 3a 20 75 72 6c 0a 20 20 20 20 7d 29 0a 20 20 7d 29 0a 0a 20 | ),.......url:.url.....})...})... |
19b60 | 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 6f 6e 63 65 28 27 64 65 73 74 72 6f 79 65 64 27 2c 20 28 | .webContents.once('destroyed',.( |
19b80 | 29 20 3d 3e 20 7b 0a 20 20 20 20 73 65 6e 64 54 6f 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 | ).=>.{.....sendToBackgroundPages |
19ba0 | 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 4f 4e 52 45 4d 4f 56 45 44 27 2c 20 74 61 62 49 64 29 | ('CHROME_TABS_ONREMOVED',.tabId) |
19bc0 | 0a 20 20 7d 29 0a 7d 0a 0a 2f 2f 20 48 61 6e 64 6c 65 20 74 68 65 20 63 68 72 6f 6d 65 2e 2a 20 | ...}).}..//.Handle.the.chrome.*. |
19be0 | 41 50 49 20 6d 65 73 73 61 67 65 73 2e 0a 6c 65 74 20 6e 65 78 74 49 64 20 3d 20 30 0a 0a 69 70 | API.messages..let.nextId.=.0..ip |
19c00 | 63 4d 61 69 6e 2e 6f 6e 28 27 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 43 4f 4e 4e 45 43 54 | cMain.on('CHROME_RUNTIME_CONNECT |
19c20 | 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c | ',.function.(event,.extensionId, |
19c40 | 20 63 6f 6e 6e 65 63 74 49 6e 66 6f 29 20 7b 0a 20 20 63 6f 6e 73 74 20 70 61 67 65 20 3d 20 62 | .connectInfo).{...const.page.=.b |
19c60 | 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b 65 78 74 65 6e 73 69 6f 6e 49 64 5d 0a 20 20 69 66 | ackgroundPages[extensionId]...if |
19c80 | 20 28 21 70 61 67 65 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 60 43 6f | .(!page).{.....console.error(`Co |
19ca0 | 6e 6e 65 63 74 20 74 6f 20 75 6e 6b 6e 6f 77 6e 20 65 78 74 65 6e 73 69 6f 6e 20 24 7b 65 78 74 | nnect.to.unknown.extension.${ext |
19cc0 | 65 6e 73 69 6f 6e 49 64 7d 60 29 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 63 6f | ensionId}`).....return...}....co |
19ce0 | 6e 73 74 20 70 6f 72 74 49 64 20 3d 20 2b 2b 6e 65 78 74 49 64 0a 20 20 65 76 65 6e 74 2e 72 65 | nst.portId.=.++nextId...event.re |
19d00 | 74 75 72 6e 56 61 6c 75 65 20 3d 20 7b 20 74 61 62 49 64 3a 20 70 61 67 65 2e 77 65 62 43 6f 6e | turnValue.=.{.tabId:.page.webCon |
19d20 | 74 65 6e 74 73 2e 69 64 2c 20 70 6f 72 74 49 64 3a 20 70 6f 72 74 49 64 20 7d 0a 0a 20 20 65 76 | tents.id,.portId:.portId.}....ev |
19d40 | 65 6e 74 2e 73 65 6e 64 65 72 2e 6f 6e 63 65 28 27 72 65 6e 64 65 72 2d 76 69 65 77 2d 64 65 6c | ent.sender.once('render-view-del |
19d60 | 65 74 65 64 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 70 61 67 65 2e 77 65 62 43 | eted',.().=>.{.....if.(page.webC |
19d80 | 6f 6e 74 65 6e 74 73 2e 69 73 44 65 73 74 72 6f 79 65 64 28 29 29 20 72 65 74 75 72 6e 0a 20 20 | ontents.isDestroyed()).return... |
19da0 | 20 20 70 61 67 65 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c | ..page.webContents._sendInternal |
19dc0 | 54 6f 41 6c 6c 28 60 43 48 52 4f 4d 45 5f 50 4f 52 54 5f 44 49 53 43 4f 4e 4e 45 43 54 5f 24 7b | ToAll(`CHROME_PORT_DISCONNECT_${ |
19de0 | 70 6f 72 74 49 64 7d 60 29 0a 20 20 7d 29 0a 20 20 70 61 67 65 2e 77 65 62 43 6f 6e 74 65 6e 74 | portId}`)...})...page.webContent |
19e00 | 73 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 54 6f 41 6c 6c 28 60 43 48 52 4f 4d 45 5f 52 55 4e | s._sendInternalToAll(`CHROME_RUN |
19e20 | 54 49 4d 45 5f 4f 4e 43 4f 4e 4e 45 43 54 5f 24 7b 65 78 74 65 6e 73 69 6f 6e 49 64 7d 60 2c 20 | TIME_ONCONNECT_${extensionId}`,. |
19e40 | 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 69 64 2c 20 70 6f 72 74 49 64 2c 20 63 6f 6e 6e 65 63 74 | event.sender.id,.portId,.connect |
19e60 | 49 6e 66 6f 29 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 43 48 52 4f 4d 45 5f 49 31 38 | Info).})..ipcMain.on('CHROME_I18 |
19e80 | 4e 5f 4d 41 4e 49 46 45 53 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 65 78 | N_MANIFEST',.function.(event,.ex |
19ea0 | 74 65 6e 73 69 6f 6e 49 64 29 20 7b 0a 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 | tensionId).{...event.returnValue |
19ec0 | 20 3d 20 6d 61 6e 69 66 65 73 74 4d 61 70 5b 65 78 74 65 6e 73 69 6f 6e 49 64 5d 0a 7d 29 0a 0a | .=.manifestMap[extensionId].}).. |
19ee0 | 6c 65 74 20 72 65 73 75 6c 74 49 44 20 3d 20 31 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 43 48 52 | let.resultID.=.1.ipcMain.on('CHR |
19f00 | 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 53 45 4e 44 4d 45 53 53 41 47 45 27 2c 20 66 75 6e 63 74 69 | OME_RUNTIME_SENDMESSAGE',.functi |
19f20 | 6f 6e 20 28 65 76 65 6e 74 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6d 65 73 73 61 67 65 2c | on.(event,.extensionId,.message, |
19f40 | 20 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 29 20 7b 0a 20 20 63 6f 6e 73 74 20 70 61 67 65 20 | .originResultID).{...const.page. |
19f60 | 3d 20 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b 65 78 74 65 6e 73 69 6f 6e 49 64 5d 0a 20 | =.backgroundPages[extensionId].. |
19f80 | 20 69 66 20 28 21 70 61 67 65 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 | .if.(!page).{.....console.error( |
19fa0 | 60 43 6f 6e 6e 65 63 74 20 74 6f 20 75 6e 6b 6e 6f 77 6e 20 65 78 74 65 6e 73 69 6f 6e 20 24 7b | `Connect.to.unknown.extension.${ |
19fc0 | 65 78 74 65 6e 73 69 6f 6e 49 64 7d 60 29 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 | extensionId}`).....return...}... |
19fe0 | 20 70 61 67 65 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 54 | .page.webContents._sendInternalT |
1a000 | 6f 41 6c 6c 28 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 4f 4e 4d 45 53 53 41 47 45 5f 24 | oAll(`CHROME_RUNTIME_ONMESSAGE_$ |
1a020 | 7b 65 78 74 65 6e 73 69 6f 6e 49 64 7d 60 2c 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 69 64 2c | {extensionId}`,.event.sender.id, |
1a040 | 20 6d 65 73 73 61 67 65 2c 20 72 65 73 75 6c 74 49 44 29 0a 20 20 69 70 63 4d 61 69 6e 2e 6f 6e | .message,.resultID)...ipcMain.on |
1a060 | 63 65 28 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 4f 4e 4d 45 53 53 41 47 45 5f 52 45 53 | ce(`CHROME_RUNTIME_ONMESSAGE_RES |
1a080 | 55 4c 54 5f 24 7b 72 65 73 75 6c 74 49 44 7d 60 2c 20 28 65 76 65 6e 74 2c 20 72 65 73 75 6c 74 | ULT_${resultID}`,.(event,.result |
1a0a0 | 29 20 3d 3e 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 5f 73 65 6e 64 49 6e 74 | ).=>.{.....event.sender._sendInt |
1a0c0 | 65 72 6e 61 6c 28 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 53 45 4e 44 4d 45 53 53 41 47 | ernal(`CHROME_RUNTIME_SENDMESSAG |
1a0e0 | 45 5f 52 45 53 55 4c 54 5f 24 7b 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 7d 60 2c 20 72 65 73 | E_RESULT_${originResultID}`,.res |
1a100 | 75 6c 74 29 0a 20 20 7d 29 0a 20 20 72 65 73 75 6c 74 49 44 2b 2b 0a 7d 29 0a 0a 69 70 63 4d 61 | ult)...})...resultID++.})..ipcMa |
1a120 | 69 6e 2e 6f 6e 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 53 45 4e 44 5f 4d 45 53 53 41 47 45 27 | in.on('CHROME_TABS_SEND_MESSAGE' |
1a140 | 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 74 61 62 49 64 2c 20 65 78 74 65 6e 73 | ,.function.(event,.tabId,.extens |
1a160 | 69 6f 6e 49 64 2c 20 69 73 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 2c 20 6d 65 73 73 61 67 65 | ionId,.isBackgroundPage,.message |
1a180 | 2c 20 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 29 20 7b 0a 20 20 63 6f 6e 73 74 20 63 6f 6e 74 | ,.originResultID).{...const.cont |
1a1a0 | 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 66 72 6f 6d 49 64 28 74 61 62 49 64 29 | ents.=.webContents.fromId(tabId) |
1a1c0 | 0a 20 20 69 66 20 28 21 63 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e | ...if.(!contents).{.....console. |
1a1e0 | 65 72 72 6f 72 28 60 53 65 6e 64 69 6e 67 20 6d 65 73 73 61 67 65 20 74 6f 20 75 6e 6b 6e 6f 77 | error(`Sending.message.to.unknow |
1a200 | 6e 20 74 61 62 20 24 7b 74 61 62 49 64 7d 60 29 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a | n.tab.${tabId}`).....return...}. |
1a220 | 0a 20 20 63 6f 6e 73 74 20 73 65 6e 64 65 72 54 61 62 49 64 20 3d 20 69 73 42 61 63 6b 67 72 6f | ...const.senderTabId.=.isBackgro |
1a240 | 75 6e 64 50 61 67 65 20 3f 20 6e 75 6c 6c 20 3a 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 69 64 | undPage.?.null.:.event.sender.id |
1a260 | 0a 0a 20 20 63 6f 6e 74 65 6e 74 73 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 54 6f 41 6c 6c 28 | ....contents._sendInternalToAll( |
1a280 | 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 4f 4e 4d 45 53 53 41 47 45 5f 24 7b 65 78 74 65 | `CHROME_RUNTIME_ONMESSAGE_${exte |
1a2a0 | 6e 73 69 6f 6e 49 64 7d 60 2c 20 73 65 6e 64 65 72 54 61 62 49 64 2c 20 6d 65 73 73 61 67 65 2c | nsionId}`,.senderTabId,.message, |
1a2c0 | 20 72 65 73 75 6c 74 49 44 29 0a 20 20 69 70 63 4d 61 69 6e 2e 6f 6e 63 65 28 60 43 48 52 4f 4d | .resultID)...ipcMain.once(`CHROM |
1a2e0 | 45 5f 52 55 4e 54 49 4d 45 5f 4f 4e 4d 45 53 53 41 47 45 5f 52 45 53 55 4c 54 5f 24 7b 72 65 73 | E_RUNTIME_ONMESSAGE_RESULT_${res |
1a300 | 75 6c 74 49 44 7d 60 2c 20 28 65 76 65 6e 74 2c 20 72 65 73 75 6c 74 29 20 3d 3e 20 7b 0a 20 20 | ultID}`,.(event,.result).=>.{... |
1a320 | 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 28 60 43 48 | ..event.sender._sendInternal(`CH |
1a340 | 52 4f 4d 45 5f 54 41 42 53 5f 53 45 4e 44 5f 4d 45 53 53 41 47 45 5f 52 45 53 55 4c 54 5f 24 7b | ROME_TABS_SEND_MESSAGE_RESULT_${ |
1a360 | 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 7d 60 2c 20 72 65 73 75 6c 74 29 0a 20 20 7d 29 0a 20 | originResultID}`,.result)...}).. |
1a380 | 20 72 65 73 75 6c 74 49 44 2b 2b 0a 7d 29 0a 0a 63 6f 6e 73 74 20 69 73 43 68 72 6f 6d 65 45 78 | .resultID++.})..const.isChromeEx |
1a3a0 | 74 65 6e 73 69 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 70 61 67 65 55 52 4c 29 20 7b 0a 20 | tension.=.function.(pageURL).{.. |
1a3c0 | 20 63 6f 6e 73 74 20 7b 20 70 72 6f 74 6f 63 6f 6c 20 7d 20 3d 20 75 72 6c 2e 70 61 72 73 65 28 | .const.{.protocol.}.=.url.parse( |
1a3e0 | 70 61 67 65 55 52 4c 29 0a 20 20 72 65 74 75 72 6e 20 70 72 6f 74 6f 63 6f 6c 20 3d 3d 3d 20 27 | pageURL)...return.protocol.===.' |
1a400 | 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 3a 27 0a 7d 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e | chrome-extension:'.}..ipcMain.on |
1a420 | 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 45 58 45 43 55 54 45 53 43 52 49 50 54 27 2c 20 66 75 | ('CHROME_TABS_EXECUTESCRIPT',.fu |
1a440 | 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 72 65 71 75 65 73 74 49 64 2c 20 74 61 62 49 64 2c | nction.(event,.requestId,.tabId, |
1a460 | 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 64 65 74 61 69 6c 73 29 20 7b 0a 20 20 63 6f 6e 73 74 | .extensionId,.details).{...const |
1a480 | 20 70 61 67 65 55 52 4c 20 3d 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 5f 67 65 74 55 52 4c 28 | .pageURL.=.event.sender._getURL( |
1a4a0 | 29 0a 20 20 69 66 20 28 21 69 73 43 68 72 6f 6d 65 45 78 74 65 6e 73 69 6f 6e 28 70 61 67 65 55 | )...if.(!isChromeExtension(pageU |
1a4c0 | 52 4c 29 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 60 42 6c 6f 63 6b 65 | RL)).{.....console.error(`Blocke |
1a4e0 | 64 20 24 7b 70 61 67 65 55 52 4c 7d 20 66 72 6f 6d 20 63 61 6c 6c 69 6e 67 20 63 68 72 6f 6d 65 | d.${pageURL}.from.calling.chrome |
1a500 | 2e 74 61 62 73 2e 65 78 65 63 75 74 65 53 63 72 69 70 74 28 29 60 29 0a 20 20 20 20 72 65 74 75 | .tabs.executeScript()`).....retu |
1a520 | 72 6e 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 63 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f | rn...}....const.contents.=.webCo |
1a540 | 6e 74 65 6e 74 73 2e 66 72 6f 6d 49 64 28 74 61 62 49 64 29 0a 20 20 69 66 20 28 21 63 6f 6e 74 | ntents.fromId(tabId)...if.(!cont |
1a560 | 65 6e 74 73 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 60 53 65 6e 64 69 | ents).{.....console.error(`Sendi |
1a580 | 6e 67 20 6d 65 73 73 61 67 65 20 74 6f 20 75 6e 6b 6e 6f 77 6e 20 74 61 62 20 24 7b 74 61 62 49 | ng.message.to.unknown.tab.${tabI |
1a5a0 | 64 7d 60 29 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 6c 65 74 20 63 6f 64 65 2c | d}`).....return...}....let.code, |
1a5c0 | 20 75 72 6c 0a 20 20 69 66 20 28 64 65 74 61 69 6c 73 2e 66 69 6c 65 29 20 7b 0a 20 20 20 20 63 | .url...if.(details.file).{.....c |
1a5e0 | 6f 6e 73 74 20 6d 61 6e 69 66 65 73 74 20 3d 20 6d 61 6e 69 66 65 73 74 4d 61 70 5b 65 78 74 65 | onst.manifest.=.manifestMap[exte |
1a600 | 6e 73 69 6f 6e 49 64 5d 0a 20 20 20 20 63 6f 64 65 20 3d 20 53 74 72 69 6e 67 28 66 73 2e 72 65 | nsionId].....code.=.String(fs.re |
1a620 | 61 64 46 69 6c 65 53 79 6e 63 28 70 61 74 68 2e 6a 6f 69 6e 28 6d 61 6e 69 66 65 73 74 2e 73 72 | adFileSync(path.join(manifest.sr |
1a640 | 63 44 69 72 65 63 74 6f 72 79 2c 20 64 65 74 61 69 6c 73 2e 66 69 6c 65 29 29 29 0a 20 20 20 20 | cDirectory,.details.file)))..... |
1a660 | 75 72 6c 20 3d 20 60 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 3a 2f 2f 24 7b 65 78 74 65 | url.=.`chrome-extension://${exte |
1a680 | 6e 73 69 6f 6e 49 64 7d 24 7b 64 65 74 61 69 6c 73 2e 66 69 6c 65 7d 60 0a 20 20 7d 20 65 6c 73 | nsionId}${details.file}`...}.els |
1a6a0 | 65 20 7b 0a 20 20 20 20 63 6f 64 65 20 3d 20 64 65 74 61 69 6c 73 2e 63 6f 64 65 0a 20 20 20 20 | e.{.....code.=.details.code..... |
1a6c0 | 75 72 6c 20 3d 20 60 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 3a 2f 2f 24 7b 65 78 74 65 | url.=.`chrome-extension://${exte |
1a6e0 | 6e 73 69 6f 6e 49 64 7d 2f 24 7b 53 74 72 69 6e 67 28 4d 61 74 68 2e 72 61 6e 64 6f 6d 28 29 29 | nsionId}/${String(Math.random()) |
1a700 | 2e 73 75 62 73 74 72 28 32 2c 20 38 29 7d 2e 6a 73 60 0a 20 20 7d 0a 0a 20 20 63 6f 6e 74 65 6e | .substr(2,.8)}.js`...}....conten |
1a720 | 74 73 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 45 58 | ts._sendInternal('CHROME_TABS_EX |
1a740 | 45 43 55 54 45 53 43 52 49 50 54 27 2c 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 69 64 2c 20 72 | ECUTESCRIPT',.event.sender.id,.r |
1a760 | 65 71 75 65 73 74 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 75 72 6c 2c 20 63 6f 64 65 | equestId,.extensionId,.url,.code |
1a780 | 29 0a 7d 29 0a 0a 2f 2f 20 54 72 61 6e 73 66 65 72 20 74 68 65 20 63 6f 6e 74 65 6e 74 20 73 63 | ).})..//.Transfer.the.content.sc |
1a7a0 | 72 69 70 74 73 20 74 6f 20 72 65 6e 64 65 72 65 72 2e 0a 63 6f 6e 73 74 20 63 6f 6e 74 65 6e 74 | ripts.to.renderer..const.content |
1a7c0 | 53 63 72 69 70 74 73 20 3d 20 7b 7d 0a 0a 63 6f 6e 73 74 20 69 6e 6a 65 63 74 43 6f 6e 74 65 6e | Scripts.=.{}..const.injectConten |
1a7e0 | 74 53 63 72 69 70 74 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 61 6e 69 66 65 73 74 29 20 7b | tScripts.=.function.(manifest).{ |
1a800 | 0a 20 20 69 66 20 28 63 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 5b 6d 61 6e 69 66 65 73 74 2e 6e | ...if.(contentScripts[manifest.n |
1a820 | 61 6d 65 5d 20 7c 7c 20 21 6d 61 6e 69 66 65 73 74 2e 63 6f 6e 74 65 6e 74 5f 73 63 72 69 70 74 | ame].||.!manifest.content_script |
1a840 | 73 29 20 72 65 74 75 72 6e 0a 0a 20 20 63 6f 6e 73 74 20 72 65 61 64 41 72 72 61 79 4f 66 46 69 | s).return....const.readArrayOfFi |
1a860 | 6c 65 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 72 65 6c 61 74 69 76 65 50 61 74 68 29 20 7b 0a | les.=.function.(relativePath).{. |
1a880 | 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 75 72 6c 3a 20 60 63 68 72 6f 6d 65 2d | ....return.{.......url:.`chrome- |
1a8a0 | 65 78 74 65 6e 73 69 6f 6e 3a 2f 2f 24 7b 6d 61 6e 69 66 65 73 74 2e 65 78 74 65 6e 73 69 6f 6e | extension://${manifest.extension |
1a8c0 | 49 64 7d 2f 24 7b 72 65 6c 61 74 69 76 65 50 61 74 68 7d 60 2c 0a 20 20 20 20 20 20 63 6f 64 65 | Id}/${relativePath}`,.......code |
1a8e0 | 3a 20 53 74 72 69 6e 67 28 66 73 2e 72 65 61 64 46 69 6c 65 53 79 6e 63 28 70 61 74 68 2e 6a 6f | :.String(fs.readFileSync(path.jo |
1a900 | 69 6e 28 6d 61 6e 69 66 65 73 74 2e 73 72 63 44 69 72 65 63 74 6f 72 79 2c 20 72 65 6c 61 74 69 | in(manifest.srcDirectory,.relati |
1a920 | 76 65 50 61 74 68 29 29 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 63 6f 6e | vePath))).....}...}....const.con |
1a940 | 74 65 6e 74 53 63 72 69 70 74 54 6f 45 6e 74 72 79 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 63 | tentScriptToEntry.=.function.(sc |
1a960 | 72 69 70 74 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 6d 61 74 63 68 | ript).{.....return.{.......match |
1a980 | 65 73 3a 20 73 63 72 69 70 74 2e 6d 61 74 63 68 65 73 2c 0a 20 20 20 20 20 20 6a 73 3a 20 73 63 | es:.script.matches,.......js:.sc |
1a9a0 | 72 69 70 74 2e 6a 73 20 3f 20 73 63 72 69 70 74 2e 6a 73 2e 6d 61 70 28 72 65 61 64 41 72 72 61 | ript.js.?.script.js.map(readArra |
1a9c0 | 79 4f 66 46 69 6c 65 73 29 20 3a 20 5b 5d 2c 0a 20 20 20 20 20 20 63 73 73 3a 20 73 63 72 69 70 | yOfFiles).:.[],.......css:.scrip |
1a9e0 | 74 2e 63 73 73 20 3f 20 73 63 72 69 70 74 2e 63 73 73 2e 6d 61 70 28 72 65 61 64 41 72 72 61 79 | t.css.?.script.css.map(readArray |
1aa00 | 4f 66 46 69 6c 65 73 29 20 3a 20 5b 5d 2c 0a 20 20 20 20 20 20 72 75 6e 41 74 3a 20 73 63 72 69 | OfFiles).:.[],.......runAt:.scri |
1aa20 | 70 74 2e 72 75 6e 5f 61 74 20 7c 7c 20 27 64 6f 63 75 6d 65 6e 74 5f 69 64 6c 65 27 0a 20 20 20 | pt.run_at.||.'document_idle'.... |
1aa40 | 20 7d 0a 20 20 7d 0a 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 65 6e 74 72 79 20 | .}...}....try.{.....const.entry. |
1aa60 | 3d 20 7b 0a 20 20 20 20 20 20 65 78 74 65 6e 73 69 6f 6e 49 64 3a 20 6d 61 6e 69 66 65 73 74 2e | =.{.......extensionId:.manifest. |
1aa80 | 65 78 74 65 6e 73 69 6f 6e 49 64 2c 0a 20 20 20 20 20 20 63 6f 6e 74 65 6e 74 53 63 72 69 70 74 | extensionId,.......contentScript |
1aaa0 | 73 3a 20 6d 61 6e 69 66 65 73 74 2e 63 6f 6e 74 65 6e 74 5f 73 63 72 69 70 74 73 2e 6d 61 70 28 | s:.manifest.content_scripts.map( |
1aac0 | 63 6f 6e 74 65 6e 74 53 63 72 69 70 74 54 6f 45 6e 74 72 79 29 0a 20 20 20 20 7d 0a 20 20 20 20 | contentScriptToEntry).....}..... |
1aae0 | 63 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 5b 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 5d 20 3d 20 | contentScripts[manifest.name].=. |
1ab00 | 72 65 6e 64 65 72 50 72 6f 63 65 73 73 50 72 65 66 65 72 65 6e 63 65 73 2e 61 64 64 45 6e 74 72 | renderProcessPreferences.addEntr |
1ab20 | 79 28 65 6e 74 72 79 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 29 20 7b 0a 20 20 20 20 63 6f 6e | y(entry)...}.catch.(e).{.....con |
1ab40 | 73 6f 6c 65 2e 65 72 72 6f 72 28 27 46 61 69 6c 65 64 20 74 6f 20 72 65 61 64 20 63 6f 6e 74 65 | sole.error('Failed.to.read.conte |
1ab60 | 6e 74 20 73 63 72 69 70 74 73 27 2c 20 65 29 0a 20 20 7d 0a 7d 0a 0a 63 6f 6e 73 74 20 72 65 6d | nt.scripts',.e)...}.}..const.rem |
1ab80 | 6f 76 65 43 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 61 | oveContentScripts.=.function.(ma |
1aba0 | 6e 69 66 65 73 74 29 20 7b 0a 20 20 69 66 20 28 21 63 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 5b | nifest).{...if.(!contentScripts[ |
1abc0 | 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 5d 29 20 72 65 74 75 72 6e 0a 0a 20 20 72 65 6e 64 65 72 | manifest.name]).return....render |
1abe0 | 50 72 6f 63 65 73 73 50 72 65 66 65 72 65 6e 63 65 73 2e 72 65 6d 6f 76 65 45 6e 74 72 79 28 63 | ProcessPreferences.removeEntry(c |
1ac00 | 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 5b 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 5d 29 0a 20 20 | ontentScripts[manifest.name])... |
1ac20 | 64 65 6c 65 74 65 20 63 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 5b 6d 61 6e 69 66 65 73 74 2e 6e | delete.contentScripts[manifest.n |
1ac40 | 61 6d 65 5d 0a 7d 0a 0a 2f 2f 20 54 72 61 6e 73 66 65 72 20 74 68 65 20 7c 6d 61 6e 69 66 65 73 | ame].}..//.Transfer.the.|manifes |
1ac60 | 74 7c 20 74 6f 20 61 20 66 6f 72 6d 61 74 20 74 68 61 74 20 63 61 6e 20 62 65 20 72 65 63 6f 67 | t|.to.a.format.that.can.be.recog |
1ac80 | 6e 69 7a 65 64 20 62 79 20 74 68 65 0a 2f 2f 20 7c 44 65 76 54 6f 6f 6c 73 41 50 49 2e 61 64 64 | nized.by.the.//.|DevToolsAPI.add |
1aca0 | 45 78 74 65 6e 73 69 6f 6e 73 7c 2e 0a 63 6f 6e 73 74 20 6d 61 6e 69 66 65 73 74 54 6f 45 78 74 | Extensions|..const.manifestToExt |
1acc0 | 65 6e 73 69 6f 6e 49 6e 66 6f 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 61 6e 69 66 65 73 74 29 | ensionInfo.=.function.(manifest) |
1ace0 | 20 7b 0a 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 73 74 61 72 74 50 61 67 65 3a 20 6d 61 6e | .{...return.{.....startPage:.man |
1ad00 | 69 66 65 73 74 2e 73 74 61 72 74 50 61 67 65 2c 0a 20 20 20 20 73 72 63 44 69 72 65 63 74 6f 72 | ifest.startPage,.....srcDirector |
1ad20 | 79 3a 20 6d 61 6e 69 66 65 73 74 2e 73 72 63 44 69 72 65 63 74 6f 72 79 2c 0a 20 20 20 20 6e 61 | y:.manifest.srcDirectory,.....na |
1ad40 | 6d 65 3a 20 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 2c 0a 20 20 20 20 65 78 70 6f 73 65 45 78 70 | me:.manifest.name,.....exposeExp |
1ad60 | 65 72 69 6d 65 6e 74 61 6c 41 50 49 73 3a 20 74 72 75 65 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 4c 6f | erimentalAPIs:.true...}.}..//.Lo |
1ad80 | 61 64 20 74 68 65 20 65 78 74 65 6e 73 69 6f 6e 73 20 66 6f 72 20 74 68 65 20 77 69 6e 64 6f 77 | ad.the.extensions.for.the.window |
1ada0 | 2e 0a 63 6f 6e 73 74 20 6c 6f 61 64 45 78 74 65 6e 73 69 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e | ..const.loadExtension.=.function |
1adc0 | 20 28 6d 61 6e 69 66 65 73 74 29 20 7b 0a 20 20 73 74 61 72 74 42 61 63 6b 67 72 6f 75 6e 64 50 | .(manifest).{...startBackgroundP |
1ade0 | 61 67 65 73 28 6d 61 6e 69 66 65 73 74 29 0a 20 20 69 6e 6a 65 63 74 43 6f 6e 74 65 6e 74 53 63 | ages(manifest)...injectContentSc |
1ae00 | 72 69 70 74 73 28 6d 61 6e 69 66 65 73 74 29 0a 7d 0a 0a 63 6f 6e 73 74 20 6c 6f 61 64 44 65 76 | ripts(manifest).}..const.loadDev |
1ae20 | 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 69 6e 2c | ToolsExtensions.=.function.(win, |
1ae40 | 20 6d 61 6e 69 66 65 73 74 73 29 20 7b 0a 20 20 69 66 20 28 21 77 69 6e 2e 64 65 76 54 6f 6f 6c | .manifests).{...if.(!win.devTool |
1ae60 | 73 57 65 62 43 6f 6e 74 65 6e 74 73 29 20 72 65 74 75 72 6e 0a 0a 20 20 6d 61 6e 69 66 65 73 74 | sWebContents).return....manifest |
1ae80 | 73 2e 66 6f 72 45 61 63 68 28 6c 6f 61 64 45 78 74 65 6e 73 69 6f 6e 29 0a 0a 20 20 63 6f 6e 73 | s.forEach(loadExtension)....cons |
1aea0 | 74 20 65 78 74 65 6e 73 69 6f 6e 49 6e 66 6f 41 72 72 61 79 20 3d 20 6d 61 6e 69 66 65 73 74 73 | t.extensionInfoArray.=.manifests |
1aec0 | 2e 6d 61 70 28 6d 61 6e 69 66 65 73 74 54 6f 45 78 74 65 6e 73 69 6f 6e 49 6e 66 6f 29 0a 20 20 | .map(manifestToExtensionInfo)... |
1aee0 | 65 78 74 65 6e 73 69 6f 6e 49 6e 66 6f 41 72 72 61 79 2e 66 6f 72 45 61 63 68 28 28 65 78 74 65 | extensionInfoArray.forEach((exte |
1af00 | 6e 73 69 6f 6e 29 20 3d 3e 20 7b 0a 20 20 20 20 77 69 6e 2e 64 65 76 54 6f 6f 6c 73 57 65 62 43 | nsion).=>.{.....win.devToolsWebC |
1af20 | 6f 6e 74 65 6e 74 73 2e 5f 67 72 61 6e 74 4f 72 69 67 69 6e 41 63 63 65 73 73 28 65 78 74 65 6e | ontents._grantOriginAccess(exten |
1af40 | 73 69 6f 6e 2e 73 74 61 72 74 50 61 67 65 29 0a 20 20 7d 29 0a 20 20 77 69 6e 2e 64 65 76 54 6f | sion.startPage)...})...win.devTo |
1af60 | 6f 6c 73 57 65 62 43 6f 6e 74 65 6e 74 73 2e 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 | olsWebContents.executeJavaScript |
1af80 | 28 60 44 65 76 54 6f 6f 6c 73 41 50 49 2e 61 64 64 45 78 74 65 6e 73 69 6f 6e 73 28 24 7b 4a 53 | (`DevToolsAPI.addExtensions(${JS |
1afa0 | 4f 4e 2e 73 74 72 69 6e 67 69 66 79 28 65 78 74 65 6e 73 69 6f 6e 49 6e 66 6f 41 72 72 61 79 29 | ON.stringify(extensionInfoArray) |
1afc0 | 7d 29 60 29 0a 7d 0a 0a 61 70 70 2e 6f 6e 28 27 77 65 62 2d 63 6f 6e 74 65 6e 74 73 2d 63 72 65 | })`).}..app.on('web-contents-cre |
1afe0 | 61 74 65 64 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 77 65 62 43 6f 6e 74 65 | ated',.function.(event,.webConte |
1b000 | 6e 74 73 29 20 7b 0a 20 20 69 66 20 28 21 69 73 57 69 6e 64 6f 77 4f 72 57 65 62 56 69 65 77 28 | nts).{...if.(!isWindowOrWebView( |
1b020 | 77 65 62 43 6f 6e 74 65 6e 74 73 29 29 20 72 65 74 75 72 6e 0a 0a 20 20 68 6f 6f 6b 57 65 62 43 | webContents)).return....hookWebC |
1b040 | 6f 6e 74 65 6e 74 73 45 76 65 6e 74 73 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 0a 20 20 77 65 62 | ontentsEvents(webContents)...web |
1b060 | 43 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 64 65 76 74 6f 6f 6c 73 2d 6f 70 65 6e 65 64 27 2c 20 66 | Contents.on('devtools-opened',.f |
1b080 | 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 6c 6f 61 64 44 65 76 54 6f 6f 6c 73 45 78 74 | unction.().{.....loadDevToolsExt |
1b0a0 | 65 6e 73 69 6f 6e 73 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 4f 62 6a 65 63 74 2e 76 61 6c 75 | ensions(webContents,.Object.valu |
1b0c0 | 65 73 28 6d 61 6e 69 66 65 73 74 4d 61 70 29 29 0a 20 20 7d 29 0a 7d 29 0a 0a 2f 2f 20 54 68 65 | es(manifestMap))...}).})..//.The |
1b0e0 | 20 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 3a 20 63 61 6e 20 6d 61 70 20 61 20 65 78 74 | .chrome-extension:.can.map.a.ext |
1b100 | 65 6e 73 69 6f 6e 20 55 52 4c 20 72 65 71 75 65 73 74 20 74 6f 20 72 65 61 6c 20 66 69 6c 65 20 | ension.URL.request.to.real.file. |
1b120 | 70 61 74 68 2e 0a 63 6f 6e 73 74 20 63 68 72 6f 6d 65 45 78 74 65 6e 73 69 6f 6e 48 61 6e 64 6c | path..const.chromeExtensionHandl |
1b140 | 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 72 65 71 75 65 73 74 2c 20 63 61 6c 6c 62 61 63 6b | er.=.function.(request,.callback |
1b160 | 29 20 7b 0a 20 20 63 6f 6e 73 74 20 70 61 72 73 65 64 20 3d 20 75 72 6c 2e 70 61 72 73 65 28 72 | ).{...const.parsed.=.url.parse(r |
1b180 | 65 71 75 65 73 74 2e 75 72 6c 29 0a 20 20 69 66 20 28 21 70 61 72 73 65 64 2e 68 6f 73 74 6e 61 | equest.url)...if.(!parsed.hostna |
1b1a0 | 6d 65 20 7c 7c 20 21 70 61 72 73 65 64 2e 70 61 74 68 29 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 | me.||.!parsed.path).return.callb |
1b1c0 | 61 63 6b 28 29 0a 0a 20 20 63 6f 6e 73 74 20 6d 61 6e 69 66 65 73 74 20 3d 20 6d 61 6e 69 66 65 | ack()....const.manifest.=.manife |
1b1e0 | 73 74 4d 61 70 5b 70 61 72 73 65 64 2e 68 6f 73 74 6e 61 6d 65 5d 0a 20 20 69 66 20 28 21 6d 61 | stMap[parsed.hostname]...if.(!ma |
1b200 | 6e 69 66 65 73 74 29 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 29 0a 0a 20 20 63 6f 6e | nifest).return.callback()....con |
1b220 | 73 74 20 70 61 67 65 20 3d 20 62 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 5b 70 61 72 73 65 64 | st.page.=.backgroundPages[parsed |
1b240 | 2e 68 6f 73 74 6e 61 6d 65 5d 0a 20 20 69 66 20 28 70 61 67 65 20 26 26 20 70 61 72 73 65 64 2e | .hostname]...if.(page.&&.parsed. |
1b260 | 70 61 74 68 20 3d 3d 3d 20 60 2f 24 7b 70 61 67 65 2e 6e 61 6d 65 7d 60 29 20 7b 0a 20 20 20 20 | path.===.`/${page.name}`).{..... |
1b280 | 2f 2f 20 44 69 73 61 62 6c 65 64 20 64 75 65 20 74 6f 20 66 61 6c 73 65 20 70 6f 73 69 74 69 76 | //.Disabled.due.to.false.positiv |
1b2a0 | 65 20 69 6e 20 53 74 61 6e 64 61 72 64 4a 53 0a 20 20 20 20 2f 2f 20 65 73 6c 69 6e 74 2d 64 69 | e.in.StandardJS.....//.eslint-di |
1b2c0 | 73 61 62 6c 65 2d 6e 65 78 74 2d 6c 69 6e 65 20 73 74 61 6e 64 61 72 64 2f 6e 6f 2d 63 61 6c 6c | sable-next-line.standard/no-call |
1b2e0 | 62 61 63 6b 2d 6c 69 74 65 72 61 6c 0a 20 20 20 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b | back-literal.....return.callback |
1b300 | 28 7b 0a 20 20 20 20 20 20 6d 69 6d 65 54 79 70 65 3a 20 27 74 65 78 74 2f 68 74 6d 6c 27 2c 0a | ({.......mimeType:.'text/html',. |
1b320 | 20 20 20 20 20 20 64 61 74 61 3a 20 70 61 67 65 2e 68 74 6d 6c 0a 20 20 20 20 7d 29 0a 20 20 7d | ......data:.page.html.....})...} |
1b340 | 0a 0a 20 20 66 73 2e 72 65 61 64 46 69 6c 65 28 70 61 74 68 2e 6a 6f 69 6e 28 6d 61 6e 69 66 65 | ....fs.readFile(path.join(manife |
1b360 | 73 74 2e 73 72 63 44 69 72 65 63 74 6f 72 79 2c 20 70 61 72 73 65 64 2e 70 61 74 68 29 2c 20 66 | st.srcDirectory,.parsed.path),.f |
1b380 | 75 6e 63 74 69 6f 6e 20 28 65 72 72 2c 20 63 6f 6e 74 65 6e 74 29 20 7b 0a 20 20 20 20 69 66 20 | unction.(err,.content).{.....if. |
1b3a0 | 28 65 72 72 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 44 69 73 61 62 6c 65 64 20 64 75 65 20 74 6f | (err).{.......//.Disabled.due.to |
1b3c0 | 20 66 61 6c 73 65 20 70 6f 73 69 74 69 76 65 20 69 6e 20 53 74 61 6e 64 61 72 64 4a 53 0a 20 20 | .false.positive.in.StandardJS... |
1b3e0 | 20 20 20 20 2f 2f 20 65 73 6c 69 6e 74 2d 64 69 73 61 62 6c 65 2d 6e 65 78 74 2d 6c 69 6e 65 20 | ....//.eslint-disable-next-line. |
1b400 | 73 74 61 6e 64 61 72 64 2f 6e 6f 2d 63 61 6c 6c 62 61 63 6b 2d 6c 69 74 65 72 61 6c 0a 20 20 20 | standard/no-callback-literal.... |
1b420 | 20 20 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 2d 36 29 20 2f 2f 20 46 49 4c 45 5f 4e | ...return.callback(-6).//.FILE_N |
1b440 | 4f 54 5f 46 4f 55 4e 44 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 | OT_FOUND.....}.else.{.......retu |
1b460 | 72 6e 20 63 61 6c 6c 62 61 63 6b 28 63 6f 6e 74 65 6e 74 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a | rn.callback(content).....}...}). |
1b480 | 7d 0a 0a 61 70 70 2e 6f 6e 28 27 73 65 73 73 69 6f 6e 2d 63 72 65 61 74 65 64 27 2c 20 66 75 6e | }..app.on('session-created',.fun |
1b4a0 | 63 74 69 6f 6e 20 28 73 65 73 29 20 7b 0a 20 20 73 65 73 2e 70 72 6f 74 6f 63 6f 6c 2e 72 65 67 | ction.(ses).{...ses.protocol.reg |
1b4c0 | 69 73 74 65 72 42 75 66 66 65 72 50 72 6f 74 6f 63 6f 6c 28 27 63 68 72 6f 6d 65 2d 65 78 74 65 | isterBufferProtocol('chrome-exte |
1b4e0 | 6e 73 69 6f 6e 27 2c 20 63 68 72 6f 6d 65 45 78 74 65 6e 73 69 6f 6e 48 61 6e 64 6c 65 72 2c 20 | nsion',.chromeExtensionHandler,. |
1b500 | 66 75 6e 63 74 69 6f 6e 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 69 66 20 28 65 72 72 6f 72 | function.(error).{.....if.(error |
1b520 | 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 60 55 6e 61 62 6c 65 20 | ).{.......console.error(`Unable. |
1b540 | 74 6f 20 72 65 67 69 73 74 65 72 20 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 20 70 72 6f | to.register.chrome-extension.pro |
1b560 | 74 6f 63 6f 6c 3a 20 24 7b 65 72 72 6f 72 7d 60 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 7d 29 0a | tocol:.${error}`).....}...}).}). |
1b580 | 0a 2f 2f 20 54 68 65 20 70 65 72 73 69 73 74 65 6e 74 20 70 61 74 68 20 6f 66 20 22 44 65 76 54 | .//.The.persistent.path.of."DevT |
1b5a0 | 6f 6f 6c 73 20 45 78 74 65 6e 73 69 6f 6e 73 22 20 70 72 65 66 65 72 65 6e 63 65 20 66 69 6c 65 | ools.Extensions".preference.file |
1b5c0 | 2e 0a 6c 65 74 20 6c 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 50 61 | ..let.loadedDevToolsExtensionsPa |
1b5e0 | 74 68 20 3d 20 6e 75 6c 6c 0a 0a 61 70 70 2e 6f 6e 28 27 77 69 6c 6c 2d 71 75 69 74 27 2c 20 66 | th.=.null..app.on('will-quit',.f |
1b600 | 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6c | unction.().{...try.{.....const.l |
1b620 | 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 20 3d 20 41 72 72 61 79 2e | oadedDevToolsExtensions.=.Array. |
1b640 | 66 72 6f 6d 28 64 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 4e 61 6d 65 73 29 0a 20 20 20 | from(devToolsExtensionNames).... |
1b660 | 20 20 20 2e 6d 61 70 28 6e 61 6d 65 20 3d 3e 20 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 70 5b | ....map(name.=>.manifestNameMap[ |
1b680 | 6e 61 6d 65 5d 2e 73 72 63 44 69 72 65 63 74 6f 72 79 29 0a 20 20 20 20 69 66 20 28 6c 6f 61 64 | name].srcDirectory).....if.(load |
1b6a0 | 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 2e 6c 65 6e 67 74 68 20 3e 20 30 29 | edDevToolsExtensions.length.>.0) |
1b6c0 | 20 7b 0a 20 20 20 20 20 20 74 72 79 20 7b 0a 20 20 20 20 20 20 20 20 66 73 2e 6d 6b 64 69 72 53 | .{.......try.{.........fs.mkdirS |
1b6e0 | 79 6e 63 28 70 61 74 68 2e 64 69 72 6e 61 6d 65 28 6c 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 | ync(path.dirname(loadedDevToolsE |
1b700 | 78 74 65 6e 73 69 6f 6e 73 50 61 74 68 29 29 0a 20 20 20 20 20 20 7d 20 63 61 74 63 68 20 28 65 | xtensionsPath)).......}.catch.(e |
1b720 | 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 49 67 6e 6f 72 65 20 65 72 72 6f 72 0a | rror).{.........//.Ignore.error. |
1b740 | 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 66 73 2e 77 72 69 74 65 46 69 6c 65 53 79 6e 63 28 6c | ......}.......fs.writeFileSync(l |
1b760 | 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 50 61 74 68 2c 20 4a 53 4f | oadedDevToolsExtensionsPath,.JSO |
1b780 | 4e 2e 73 74 72 69 6e 67 69 66 79 28 6c 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 | N.stringify(loadedDevToolsExtens |
1b7a0 | 69 6f 6e 73 29 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 66 73 2e 75 6e 6c | ions)).....}.else.{.......fs.unl |
1b7c0 | 69 6e 6b 53 79 6e 63 28 6c 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 | inkSync(loadedDevToolsExtensions |
1b7e0 | 50 61 74 68 29 0a 20 20 20 20 7d 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a | Path).....}...}.catch.(error).{. |
1b800 | 20 20 20 20 2f 2f 20 49 67 6e 6f 72 65 20 65 72 72 6f 72 0a 20 20 7d 0a 7d 29 0a 0a 2f 2f 20 57 | ....//.Ignore.error...}.})..//.W |
1b820 | 65 20 63 61 6e 20 6e 6f 74 20 75 73 65 20 70 72 6f 74 6f 63 6f 6c 20 6f 72 20 42 72 6f 77 73 65 | e.can.not.use.protocol.or.Browse |
1b840 | 72 57 69 6e 64 6f 77 20 75 6e 74 69 6c 20 61 70 70 20 69 73 20 72 65 61 64 79 2e 0a 61 70 70 2e | rWindow.until.app.is.ready..app. |
1b860 | 6f 6e 63 65 28 27 72 65 61 64 79 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 2f 2f | once('ready',.function.().{...// |
1b880 | 20 54 68 65 20 70 75 62 6c 69 63 20 41 50 49 20 74 6f 20 61 64 64 2f 72 65 6d 6f 76 65 20 65 78 | .The.public.API.to.add/remove.ex |
1b8a0 | 74 65 6e 73 69 6f 6e 73 2e 0a 20 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 61 64 64 45 78 74 | tensions....BrowserWindow.addExt |
1b8c0 | 65 6e 73 69 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 72 63 44 69 72 65 63 74 6f 72 79 29 | ension.=.function.(srcDirectory) |
1b8e0 | 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6d 61 6e 69 66 65 73 74 20 3d 20 67 65 74 4d 61 6e 69 66 | .{.....const.manifest.=.getManif |
1b900 | 65 73 74 46 72 6f 6d 50 61 74 68 28 73 72 63 44 69 72 65 63 74 6f 72 79 29 0a 20 20 20 20 69 66 | estFromPath(srcDirectory).....if |
1b920 | 20 28 6d 61 6e 69 66 65 73 74 29 20 7b 0a 20 20 20 20 20 20 6c 6f 61 64 45 78 74 65 6e 73 69 6f | .(manifest).{.......loadExtensio |
1b940 | 6e 28 6d 61 6e 69 66 65 73 74 29 0a 20 20 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 77 65 62 | n(manifest).......for.(const.web |
1b960 | 43 6f 6e 74 65 6e 74 73 20 6f 66 20 67 65 74 41 6c 6c 57 65 62 43 6f 6e 74 65 6e 74 73 28 29 29 | Contents.of.getAllWebContents()) |
1b980 | 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 69 73 57 69 6e 64 6f 77 4f 72 57 65 62 56 69 65 77 | .{.........if.(isWindowOrWebView |
1b9a0 | 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 6c 6f 61 64 44 | (webContents)).{...........loadD |
1b9c0 | 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 5b | evToolsExtensions(webContents,.[ |
1b9e0 | 6d 61 6e 69 66 65 73 74 5d 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 0a 20 20 20 | manifest]).........}.......}.... |
1ba00 | 20 20 20 72 65 74 75 72 6e 20 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 0a 20 20 20 20 7d 0a 20 20 | ...return.manifest.name.....}... |
1ba20 | 7d 0a 0a 20 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 72 65 6d 6f 76 65 45 78 74 65 6e 73 69 | }....BrowserWindow.removeExtensi |
1ba40 | 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 | on.=.function.(name).{.....const |
1ba60 | 20 6d 61 6e 69 66 65 73 74 20 3d 20 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 70 5b 6e 61 6d 65 | .manifest.=.manifestNameMap[name |
1ba80 | 5d 0a 20 20 20 20 69 66 20 28 21 6d 61 6e 69 66 65 73 74 29 20 72 65 74 75 72 6e 0a 0a 20 20 20 | ].....if.(!manifest).return..... |
1baa0 | 20 72 65 6d 6f 76 65 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 73 28 6d 61 6e 69 66 65 73 74 29 | .removeBackgroundPages(manifest) |
1bac0 | 0a 20 20 20 20 72 65 6d 6f 76 65 43 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 28 6d 61 6e 69 66 65 | .....removeContentScripts(manife |
1bae0 | 73 74 29 0a 20 20 20 20 64 65 6c 65 74 65 20 6d 61 6e 69 66 65 73 74 4d 61 70 5b 6d 61 6e 69 66 | st).....delete.manifestMap[manif |
1bb00 | 65 73 74 2e 65 78 74 65 6e 73 69 6f 6e 49 64 5d 0a 20 20 20 20 64 65 6c 65 74 65 20 6d 61 6e 69 | est.extensionId].....delete.mani |
1bb20 | 66 65 73 74 4e 61 6d 65 4d 61 70 5b 6e 61 6d 65 5d 0a 20 20 7d 0a 0a 20 20 42 72 6f 77 73 65 72 | festNameMap[name]...}....Browser |
1bb40 | 57 69 6e 64 6f 77 2e 67 65 74 45 78 74 65 6e 73 69 6f 6e 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 | Window.getExtensions.=.function. |
1bb60 | 28 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 65 78 74 65 6e 73 69 6f 6e 73 20 3d 20 7b 7d 0a 20 | ().{.....const.extensions.=.{}.. |
1bb80 | 20 20 20 4f 62 6a 65 63 74 2e 6b 65 79 73 28 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 70 29 2e | ...Object.keys(manifestNameMap). |
1bba0 | 66 6f 72 45 61 63 68 28 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 29 20 7b 0a 20 20 20 20 20 20 | forEach(function.(name).{....... |
1bbc0 | 63 6f 6e 73 74 20 6d 61 6e 69 66 65 73 74 20 3d 20 6d 61 6e 69 66 65 73 74 4e 61 6d 65 4d 61 70 | const.manifest.=.manifestNameMap |
1bbe0 | 5b 6e 61 6d 65 5d 0a 20 20 20 20 20 20 65 78 74 65 6e 73 69 6f 6e 73 5b 6e 61 6d 65 5d 20 3d 20 | [name].......extensions[name].=. |
1bc00 | 7b 20 6e 61 6d 65 3a 20 6d 61 6e 69 66 65 73 74 2e 6e 61 6d 65 2c 20 76 65 72 73 69 6f 6e 3a 20 | {.name:.manifest.name,.version:. |
1bc20 | 6d 61 6e 69 66 65 73 74 2e 76 65 72 73 69 6f 6e 20 7d 0a 20 20 20 20 7d 29 0a 20 20 20 20 72 65 | manifest.version.}.....}).....re |
1bc40 | 74 75 72 6e 20 65 78 74 65 6e 73 69 6f 6e 73 0a 20 20 7d 0a 0a 20 20 42 72 6f 77 73 65 72 57 69 | turn.extensions...}....BrowserWi |
1bc60 | 6e 64 6f 77 2e 61 64 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 20 3d 20 66 75 6e 63 | ndow.addDevToolsExtension.=.func |
1bc80 | 74 69 6f 6e 20 28 73 72 63 44 69 72 65 63 74 6f 72 79 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 | tion.(srcDirectory).{.....const. |
1bca0 | 6d 61 6e 69 66 65 73 74 4e 61 6d 65 20 3d 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 61 64 64 | manifestName.=.BrowserWindow.add |
1bcc0 | 45 78 74 65 6e 73 69 6f 6e 28 73 72 63 44 69 72 65 63 74 6f 72 79 29 0a 20 20 20 20 69 66 20 28 | Extension(srcDirectory).....if.( |
1bce0 | 6d 61 6e 69 66 65 73 74 4e 61 6d 65 29 20 7b 0a 20 20 20 20 20 20 64 65 76 54 6f 6f 6c 73 45 78 | manifestName).{.......devToolsEx |
1bd00 | 74 65 6e 73 69 6f 6e 4e 61 6d 65 73 2e 61 64 64 28 6d 61 6e 69 66 65 73 74 4e 61 6d 65 29 0a 20 | tensionNames.add(manifestName).. |
1bd20 | 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 6d 61 6e 69 66 65 73 74 4e 61 6d 65 0a 20 20 7d | ...}.....return.manifestName...} |
1bd40 | 0a 0a 20 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 72 65 6d 6f 76 65 44 65 76 54 6f 6f 6c 73 | ....BrowserWindow.removeDevTools |
1bd60 | 45 78 74 65 6e 73 69 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 29 20 7b 0a 20 20 | Extension.=.function.(name).{... |
1bd80 | 20 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 72 65 6d 6f 76 65 45 78 74 65 6e 73 69 6f 6e 28 | ..BrowserWindow.removeExtension( |
1bda0 | 6e 61 6d 65 29 0a 20 20 20 20 64 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 4e 61 6d 65 73 | name).....devToolsExtensionNames |
1bdc0 | 2e 64 65 6c 65 74 65 28 6e 61 6d 65 29 0a 20 20 7d 0a 0a 20 20 42 72 6f 77 73 65 72 57 69 6e 64 | .delete(name)...}....BrowserWind |
1bde0 | 6f 77 2e 67 65 74 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 20 3d 20 66 75 6e 63 74 | ow.getDevToolsExtensions.=.funct |
1be00 | 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 65 78 74 65 6e 73 69 6f 6e 73 20 3d 20 | ion.().{.....const.extensions.=. |
1be20 | 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 67 65 74 45 78 74 65 6e 73 69 6f 6e 73 28 29 0a 20 20 | BrowserWindow.getExtensions()... |
1be40 | 20 20 63 6f 6e 73 74 20 64 65 76 45 78 74 65 6e 73 69 6f 6e 73 20 3d 20 7b 7d 0a 20 20 20 20 41 | ..const.devExtensions.=.{}.....A |
1be60 | 72 72 61 79 2e 66 72 6f 6d 28 64 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 4e 61 6d 65 73 | rray.from(devToolsExtensionNames |
1be80 | 29 2e 66 6f 72 45 61 63 68 28 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 29 20 7b 0a 20 20 20 20 | ).forEach(function.(name).{..... |
1bea0 | 20 20 69 66 20 28 21 65 78 74 65 6e 73 69 6f 6e 73 5b 6e 61 6d 65 5d 29 20 72 65 74 75 72 6e 0a | ..if.(!extensions[name]).return. |
1bec0 | 20 20 20 20 20 20 64 65 76 45 78 74 65 6e 73 69 6f 6e 73 5b 6e 61 6d 65 5d 20 3d 20 65 78 74 65 | ......devExtensions[name].=.exte |
1bee0 | 6e 73 69 6f 6e 73 5b 6e 61 6d 65 5d 0a 20 20 20 20 7d 29 0a 20 20 20 20 72 65 74 75 72 6e 20 64 | nsions[name].....}).....return.d |
1bf00 | 65 76 45 78 74 65 6e 73 69 6f 6e 73 0a 20 20 7d 0a 0a 20 20 2f 2f 20 4c 6f 61 64 20 70 65 72 73 | evExtensions...}....//.Load.pers |
1bf20 | 69 73 74 65 64 20 65 78 74 65 6e 73 69 6f 6e 73 2e 0a 20 20 6c 6f 61 64 65 64 44 65 76 54 6f 6f | isted.extensions....loadedDevToo |
1bf40 | 6c 73 45 78 74 65 6e 73 69 6f 6e 73 50 61 74 68 20 3d 20 70 61 74 68 2e 6a 6f 69 6e 28 61 70 70 | lsExtensionsPath.=.path.join(app |
1bf60 | 2e 67 65 74 50 61 74 68 28 27 75 73 65 72 44 61 74 61 27 29 2c 20 27 44 65 76 54 6f 6f 6c 73 20 | .getPath('userData'),.'DevTools. |
1bf80 | 45 78 74 65 6e 73 69 6f 6e 73 27 29 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6c | Extensions')...try.{.....const.l |
1bfa0 | 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 20 3d 20 4a 53 4f 4e 2e 70 | oadedDevToolsExtensions.=.JSON.p |
1bfc0 | 61 72 73 65 28 66 73 2e 72 65 61 64 46 69 6c 65 53 79 6e 63 28 6c 6f 61 64 65 64 44 65 76 54 6f | arse(fs.readFileSync(loadedDevTo |
1bfe0 | 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 50 61 74 68 29 29 0a 20 20 20 20 69 66 20 28 41 72 72 61 | olsExtensionsPath)).....if.(Arra |
1c000 | 79 2e 69 73 41 72 72 61 79 28 6c 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f | y.isArray(loadedDevToolsExtensio |
1c020 | 6e 73 29 29 20 7b 0a 20 20 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 73 72 63 44 69 72 65 63 | ns)).{.......for.(const.srcDirec |
1c040 | 74 6f 72 79 20 6f 66 20 6c 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e 73 69 6f 6e 73 | tory.of.loadedDevToolsExtensions |
1c060 | 29 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 53 74 61 72 74 20 62 61 63 6b 67 72 6f 75 6e 64 20 | ).{.........//.Start.background. |
1c080 | 70 61 67 65 73 20 61 6e 64 20 73 65 74 20 63 6f 6e 74 65 6e 74 20 73 63 72 69 70 74 73 2e 0a 20 | pages.and.set.content.scripts... |
1c0a0 | 20 20 20 20 20 20 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 61 64 64 44 65 76 54 6f 6f 6c 73 | .......BrowserWindow.addDevTools |
1c0c0 | 45 78 74 65 6e 73 69 6f 6e 28 73 72 63 44 69 72 65 63 74 6f 72 79 29 0a 20 20 20 20 20 20 7d 0a | Extension(srcDirectory).......}. |
1c0e0 | 20 20 20 20 7d 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 69 66 | ....}...}.catch.(error).{.....if |
1c100 | 20 28 70 72 6f 63 65 73 73 2e 65 6e 76 2e 45 4c 45 43 54 52 4f 4e 5f 45 4e 41 42 4c 45 5f 4c 4f | .(process.env.ELECTRON_ENABLE_LO |
1c120 | 47 47 49 4e 47 20 26 26 20 65 72 72 6f 72 2e 63 6f 64 65 20 21 3d 3d 20 27 45 4e 4f 45 4e 54 27 | GGING.&&.error.code.!==.'ENOENT' |
1c140 | 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 27 46 61 69 6c 65 64 20 | ).{.......console.error('Failed. |
1c160 | 74 6f 20 6c 6f 61 64 20 62 72 6f 77 73 65 72 20 65 78 74 65 6e 73 69 6f 6e 73 20 66 72 6f 6d 20 | to.load.browser.extensions.from. |
1c180 | 64 69 72 65 63 74 6f 72 79 3a 27 2c 20 6c 6f 61 64 65 64 44 65 76 54 6f 6f 6c 73 45 78 74 65 6e | directory:',.loadedDevToolsExten |
1c1a0 | 73 69 6f 6e 73 50 61 74 68 29 0a 20 20 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 65 | sionsPath).......console.error(e |
1c1c0 | 72 72 6f 72 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a | rror).....}...}.}).'use.strict'. |
1c1e0 | 0a 63 6f 6e 73 74 20 7b 20 61 70 70 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 | .const.{.app.}.=.require('electr |
1c200 | 6f 6e 27 29 0a 63 6f 6e 73 74 20 63 70 20 3d 20 72 65 71 75 69 72 65 28 27 63 68 69 6c 64 5f 70 | on').const.cp.=.require('child_p |
1c220 | 72 6f 63 65 73 73 27 29 0a 63 6f 6e 73 74 20 6f 73 20 3d 20 72 65 71 75 69 72 65 28 27 6f 73 27 | rocess').const.os.=.require('os' |
1c240 | 29 0a 63 6f 6e 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 74 68 27 29 0a 0a | ).const.path.=.require('path').. |
1c260 | 63 6f 6e 73 74 20 67 65 74 54 65 6d 70 44 69 72 65 63 74 6f 72 79 20 3d 20 66 75 6e 63 74 69 6f | const.getTempDirectory.=.functio |
1c280 | 6e 20 28 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 61 70 70 2e 67 65 | n.().{...try.{.....return.app.ge |
1c2a0 | 74 50 61 74 68 28 27 74 65 6d 70 27 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 | tPath('temp')...}.catch.(error). |
1c2c0 | 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 6f 73 2e 74 6d 70 64 69 72 28 29 0a 20 20 7d 0a 7d 0a 0a | {.....return.os.tmpdir()...}.}.. |
1c2e0 | 65 78 70 6f 72 74 73 2e 63 72 61 73 68 52 65 70 6f 72 74 65 72 49 6e 69 74 20 3d 20 66 75 6e 63 | exports.crashReporterInit.=.func |
1c300 | 74 69 6f 6e 20 28 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 70 72 6f 64 75 63 74 | tion.(options).{...const.product |
1c320 | 4e 61 6d 65 20 3d 20 6f 70 74 69 6f 6e 73 2e 70 72 6f 64 75 63 74 4e 61 6d 65 20 7c 7c 20 61 70 | Name.=.options.productName.||.ap |
1c340 | 70 2e 67 65 74 4e 61 6d 65 28 29 0a 20 20 63 6f 6e 73 74 20 63 72 61 73 68 65 73 44 69 72 65 63 | p.getName()...const.crashesDirec |
1c360 | 74 6f 72 79 20 3d 20 70 61 74 68 2e 6a 6f 69 6e 28 67 65 74 54 65 6d 70 44 69 72 65 63 74 6f 72 | tory.=.path.join(getTempDirector |
1c380 | 79 28 29 2c 20 60 24 7b 70 72 6f 64 75 63 74 4e 61 6d 65 7d 20 43 72 61 73 68 65 73 60 29 0a 20 | y(),.`${productName}.Crashes`).. |
1c3a0 | 20 6c 65 74 20 63 72 61 73 68 53 65 72 76 69 63 65 50 69 64 0a 0a 20 20 69 66 20 28 70 72 6f 63 | .let.crashServicePid....if.(proc |
1c3c0 | 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 29 20 7b 0a 20 20 20 20 | ess.platform.===.'win32').{..... |
1c3e0 | 63 6f 6e 73 74 20 65 6e 76 20 3d 20 7b 0a 20 20 20 20 20 20 45 4c 45 43 54 52 4f 4e 5f 49 4e 54 | const.env.=.{.......ELECTRON_INT |
1c400 | 45 52 4e 41 4c 5f 43 52 41 53 48 5f 53 45 52 56 49 43 45 3a 20 31 0a 20 20 20 20 7d 0a 20 20 20 | ERNAL_CRASH_SERVICE:.1.....}.... |
1c420 | 20 63 6f 6e 73 74 20 61 72 67 73 20 3d 20 5b 0a 20 20 20 20 20 20 27 2d 2d 72 65 70 6f 72 74 65 | .const.args.=.[.......'--reporte |
1c440 | 72 2d 75 72 6c 3d 27 20 2b 20 6f 70 74 69 6f 6e 73 2e 73 75 62 6d 69 74 55 52 4c 2c 0a 20 20 20 | r-url='.+.options.submitURL,.... |
1c460 | 20 20 20 27 2d 2d 61 70 70 6c 69 63 61 74 69 6f 6e 2d 6e 61 6d 65 3d 27 20 2b 20 70 72 6f 64 75 | ...'--application-name='.+.produ |
1c480 | 63 74 4e 61 6d 65 2c 0a 20 20 20 20 20 20 27 2d 2d 63 72 61 73 68 65 73 2d 64 69 72 65 63 74 6f | ctName,.......'--crashes-directo |
1c4a0 | 72 79 3d 27 20 2b 20 63 72 61 73 68 65 73 44 69 72 65 63 74 6f 72 79 2c 0a 20 20 20 20 20 20 27 | ry='.+.crashesDirectory,.......' |
1c4c0 | 2d 2d 76 3d 31 27 0a 20 20 20 20 5d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 63 72 61 73 68 53 65 72 | --v=1'.....]......const.crashSer |
1c4e0 | 76 69 63 65 50 72 6f 63 65 73 73 20 3d 20 63 70 2e 73 70 61 77 6e 28 70 72 6f 63 65 73 73 2e 68 | viceProcess.=.cp.spawn(process.h |
1c500 | 65 6c 70 65 72 45 78 65 63 50 61 74 68 2c 20 61 72 67 73 2c 20 7b 0a 20 20 20 20 20 20 65 6e 76 | elperExecPath,.args,.{.......env |
1c520 | 2c 0a 20 20 20 20 20 20 64 65 74 61 63 68 65 64 3a 20 74 72 75 65 0a 20 20 20 20 7d 29 0a 0a 20 | ,.......detached:.true.....})... |
1c540 | 20 20 20 63 72 61 73 68 53 65 72 76 69 63 65 50 69 64 20 3d 20 63 72 61 73 68 53 65 72 76 69 63 | ...crashServicePid.=.crashServic |
1c560 | 65 50 72 6f 63 65 73 73 2e 70 69 64 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 | eProcess.pid...}....return.{.... |
1c580 | 20 70 72 6f 64 75 63 74 4e 61 6d 65 2c 0a 20 20 20 20 63 72 61 73 68 65 73 44 69 72 65 63 74 6f | .productName,.....crashesDirecto |
1c5a0 | 72 79 2c 0a 20 20 20 20 63 72 61 73 68 53 65 72 76 69 63 65 50 69 64 2c 0a 20 20 20 20 61 70 70 | ry,.....crashServicePid,.....app |
1c5c0 | 56 65 72 73 69 6f 6e 3a 20 61 70 70 2e 67 65 74 56 65 72 73 69 6f 6e 28 29 0a 20 20 7d 0a 7d 0a | Version:.app.getVersion()...}.}. |
1c5e0 | 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 69 70 63 4d 61 69 6e 20 3d 20 72 65 | 'use.strict'..const.ipcMain.=.re |
1c600 | 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 | quire('@electron/internal/browse |
1c620 | 72 2f 69 70 63 2d 6d 61 69 6e 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 63 6f 6e 73 74 20 7b 20 64 65 | r/ipc-main-internal').const.{.de |
1c640 | 73 6b 74 6f 70 43 61 70 74 75 72 65 72 20 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 | sktopCapturer.}.=.process.atomBi |
1c660 | 6e 64 69 6e 67 28 27 64 65 73 6b 74 6f 70 5f 63 61 70 74 75 72 65 72 27 29 0a 0a 63 6f 6e 73 74 | nding('desktop_capturer')..const |
1c680 | 20 64 65 65 70 45 71 75 61 6c 20 3d 20 28 61 2c 20 62 29 20 3d 3e 20 4a 53 4f 4e 2e 73 74 72 69 | .deepEqual.=.(a,.b).=>.JSON.stri |
1c6a0 | 6e 67 69 66 79 28 61 29 20 3d 3d 3d 20 4a 53 4f 4e 2e 73 74 72 69 6e 67 69 66 79 28 62 29 0a 0a | ngify(a).===.JSON.stringify(b).. |
1c6c0 | 2f 2f 20 41 20 71 75 65 75 65 20 66 6f 72 20 68 6f 6c 64 69 6e 67 20 61 6c 6c 20 72 65 71 75 65 | //.A.queue.for.holding.all.reque |
1c6e0 | 73 74 73 20 66 72 6f 6d 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 73 2e 0a 6c 65 74 20 72 | sts.from.renderer.process..let.r |
1c700 | 65 71 75 65 73 74 73 51 75 65 75 65 20 3d 20 5b 5d 0a 0a 63 6f 6e 73 74 20 65 6c 65 63 74 72 6f | equestsQueue.=.[]..const.electro |
1c720 | 6e 53 6f 75 72 63 65 73 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 44 45 53 | nSources.=.'ELECTRON_BROWSER_DES |
1c740 | 4b 54 4f 50 5f 43 41 50 54 55 52 45 52 5f 47 45 54 5f 53 4f 55 52 43 45 53 27 0a 63 6f 6e 73 74 | KTOP_CAPTURER_GET_SOURCES'.const |
1c760 | 20 63 61 70 74 75 72 65 72 52 65 73 75 6c 74 20 3d 20 28 69 64 29 20 3d 3e 20 60 45 4c 45 43 54 | .capturerResult.=.(id).=>.`ELECT |
1c780 | 52 4f 4e 5f 52 45 4e 44 45 52 45 52 5f 44 45 53 4b 54 4f 50 5f 43 41 50 54 55 52 45 52 5f 52 45 | RON_RENDERER_DESKTOP_CAPTURER_RE |
1c7a0 | 53 55 4c 54 5f 24 7b 69 64 7d 60 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 65 6c 65 63 74 72 6f 6e | SULT_${id}`..ipcMain.on(electron |
1c7c0 | 53 6f 75 72 63 65 73 2c 20 28 65 76 65 6e 74 2c 20 63 61 70 74 75 72 65 57 69 6e 64 6f 77 2c 20 | Sources,.(event,.captureWindow,. |
1c7e0 | 63 61 70 74 75 72 65 53 63 72 65 65 6e 2c 20 74 68 75 6d 62 6e 61 69 6c 53 69 7a 65 2c 20 69 64 | captureScreen,.thumbnailSize,.id |
1c800 | 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 72 65 71 75 65 73 74 20 3d 20 7b 0a 20 20 20 20 69 | ).=>.{...const.request.=.{.....i |
1c820 | 64 2c 0a 20 20 20 20 6f 70 74 69 6f 6e 73 3a 20 7b 0a 20 20 20 20 20 20 63 61 70 74 75 72 65 57 | d,.....options:.{.......captureW |
1c840 | 69 6e 64 6f 77 2c 0a 20 20 20 20 20 20 63 61 70 74 75 72 65 53 63 72 65 65 6e 2c 0a 20 20 20 20 | indow,.......captureScreen,..... |
1c860 | 20 20 74 68 75 6d 62 6e 61 69 6c 53 69 7a 65 0a 20 20 20 20 7d 2c 0a 20 20 20 20 77 65 62 43 6f | ..thumbnailSize.....},.....webCo |
1c880 | 6e 74 65 6e 74 73 3a 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 0a 20 20 7d 0a 20 20 72 65 71 75 65 | ntents:.event.sender...}...reque |
1c8a0 | 73 74 73 51 75 65 75 65 2e 70 75 73 68 28 72 65 71 75 65 73 74 29 0a 20 20 69 66 20 28 72 65 71 | stsQueue.push(request)...if.(req |
1c8c0 | 75 65 73 74 73 51 75 65 75 65 2e 6c 65 6e 67 74 68 20 3d 3d 3d 20 31 29 20 7b 0a 20 20 20 20 64 | uestsQueue.length.===.1).{.....d |
1c8e0 | 65 73 6b 74 6f 70 43 61 70 74 75 72 65 72 2e 73 74 61 72 74 48 61 6e 64 6c 69 6e 67 28 63 61 70 | esktopCapturer.startHandling(cap |
1c900 | 74 75 72 65 57 69 6e 64 6f 77 2c 20 63 61 70 74 75 72 65 53 63 72 65 65 6e 2c 20 74 68 75 6d 62 | tureWindow,.captureScreen,.thumb |
1c920 | 6e 61 69 6c 53 69 7a 65 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 49 66 20 74 68 65 20 57 65 62 43 6f | nailSize)...}....//.If.the.WebCo |
1c940 | 6e 74 65 6e 74 73 20 69 73 20 64 65 73 74 72 6f 79 65 64 20 62 65 66 6f 72 65 20 72 65 63 65 69 | ntents.is.destroyed.before.recei |
1c960 | 76 69 6e 67 20 72 65 73 75 6c 74 2c 20 6a 75 73 74 20 72 65 6d 6f 76 65 20 74 68 65 0a 20 20 2f | ving.result,.just.remove.the.../ |
1c980 | 2f 20 72 65 66 65 72 65 6e 63 65 20 66 72 6f 6d 20 72 65 71 75 65 73 74 73 51 75 65 75 65 20 74 | /.reference.from.requestsQueue.t |
1c9a0 | 6f 20 6d 61 6b 65 20 74 68 65 20 6d 6f 64 75 6c 65 20 6e 6f 74 20 73 65 6e 64 20 74 68 65 20 72 | o.make.the.module.not.send.the.r |
1c9c0 | 65 73 75 6c 74 20 74 6f 20 69 74 2e 0a 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 6f 6e 63 65 | esult.to.it....event.sender.once |
1c9e0 | 28 27 64 65 73 74 72 6f 79 65 64 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 72 65 71 75 65 73 | ('destroyed',.().=>.{.....reques |
1ca00 | 74 2e 77 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 6e 75 6c 6c 0a 20 20 7d 29 0a 7d 29 0a 0a 64 65 | t.webContents.=.null...}).})..de |
1ca20 | 73 6b 74 6f 70 43 61 70 74 75 72 65 72 2e 65 6d 69 74 20 3d 20 28 65 76 65 6e 74 2c 20 6e 61 6d | sktopCapturer.emit.=.(event,.nam |
1ca40 | 65 2c 20 73 6f 75 72 63 65 73 29 20 3d 3e 20 7b 0a 20 20 2f 2f 20 52 65 63 65 69 76 69 6e 67 20 | e,.sources).=>.{...//.Receiving. |
1ca60 | 73 6f 75 72 63 65 73 20 72 65 73 75 6c 74 20 66 72 6f 6d 20 6d 61 69 6e 20 70 72 6f 63 65 73 73 | sources.result.from.main.process |
1ca80 | 2c 20 6e 6f 77 20 73 65 6e 64 20 74 68 65 6d 20 62 61 63 6b 20 74 6f 20 72 65 6e 64 65 72 65 72 | ,.now.send.them.back.to.renderer |
1caa0 | 2e 0a 20 20 63 6f 6e 73 74 20 68 61 6e 64 6c 65 64 52 65 71 75 65 73 74 20 3d 20 72 65 71 75 65 | ....const.handledRequest.=.reque |
1cac0 | 73 74 73 51 75 65 75 65 2e 73 68 69 66 74 28 29 0a 20 20 63 6f 6e 73 74 20 68 61 6e 64 6c 65 64 | stsQueue.shift()...const.handled |
1cae0 | 57 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 68 61 6e 64 6c 65 64 52 65 71 75 65 73 74 2e 77 65 62 | WebContents.=.handledRequest.web |
1cb00 | 43 6f 6e 74 65 6e 74 73 0a 20 20 63 6f 6e 73 74 20 75 6e 68 61 6e 64 6c 65 64 52 65 71 75 65 73 | Contents...const.unhandledReques |
1cb20 | 74 73 51 75 65 75 65 20 3d 20 5b 5d 0a 0a 20 20 63 6f 6e 73 74 20 72 65 73 75 6c 74 20 3d 20 73 | tsQueue.=.[]....const.result.=.s |
1cb40 | 6f 75 72 63 65 73 2e 6d 61 70 28 73 6f 75 72 63 65 20 3d 3e 20 7b 0a 20 20 20 20 72 65 74 75 72 | ources.map(source.=>.{.....retur |
1cb60 | 6e 20 7b 0a 20 20 20 20 20 20 69 64 3a 20 73 6f 75 72 63 65 2e 69 64 2c 0a 20 20 20 20 20 20 6e | n.{.......id:.source.id,.......n |
1cb80 | 61 6d 65 3a 20 73 6f 75 72 63 65 2e 6e 61 6d 65 2c 0a 20 20 20 20 20 20 74 68 75 6d 62 6e 61 69 | ame:.source.name,.......thumbnai |
1cba0 | 6c 3a 20 73 6f 75 72 63 65 2e 74 68 75 6d 62 6e 61 69 6c 2e 74 6f 44 61 74 61 55 52 4c 28 29 2c | l:.source.thumbnail.toDataURL(), |
1cbc0 | 0a 20 20 20 20 20 20 64 69 73 70 6c 61 79 5f 69 64 3a 20 73 6f 75 72 63 65 2e 64 69 73 70 6c 61 | .......display_id:.source.displa |
1cbe0 | 79 5f 69 64 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 0a 20 20 69 66 20 28 68 61 6e 64 6c 65 64 57 65 | y_id.....}...})....if.(handledWe |
1cc00 | 62 43 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 20 20 20 68 61 6e 64 6c 65 64 57 65 62 43 6f 6e 74 65 | bContents).{.....handledWebConte |
1cc20 | 6e 74 73 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 28 63 61 70 74 75 72 65 72 52 65 73 75 6c 74 | nts._sendInternal(capturerResult |
1cc40 | 28 68 61 6e 64 6c 65 64 52 65 71 75 65 73 74 2e 69 64 29 2c 20 72 65 73 75 6c 74 29 0a 20 20 7d | (handledRequest.id),.result)...} |
1cc60 | 0a 0a 20 20 2f 2f 20 43 68 65 63 6b 20 74 68 65 20 71 75 65 75 65 20 74 6f 20 73 65 65 20 77 68 | ....//.Check.the.queue.to.see.wh |
1cc80 | 65 74 68 65 72 20 74 68 65 72 65 20 69 73 20 61 6e 6f 74 68 65 72 20 69 64 65 6e 74 69 63 61 6c | ether.there.is.another.identical |
1cca0 | 20 72 65 71 75 65 73 74 20 26 20 68 61 6e 64 6c 65 0a 20 20 72 65 71 75 65 73 74 73 51 75 65 75 | .request.&.handle...requestsQueu |
1ccc0 | 65 2e 66 6f 72 45 61 63 68 28 72 65 71 75 65 73 74 20 3d 3e 20 7b 0a 20 20 20 20 63 6f 6e 73 74 | e.forEach(request.=>.{.....const |
1cce0 | 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 72 65 71 75 65 73 74 2e 77 65 62 43 6f 6e 74 65 6e | .webContents.=.request.webConten |
1cd00 | 74 73 0a 20 20 20 20 69 66 20 28 64 65 65 70 45 71 75 61 6c 28 68 61 6e 64 6c 65 64 52 65 71 75 | ts.....if.(deepEqual(handledRequ |
1cd20 | 65 73 74 2e 6f 70 74 69 6f 6e 73 2c 20 72 65 71 75 65 73 74 2e 6f 70 74 69 6f 6e 73 29 29 20 7b | est.options,.request.options)).{ |
1cd40 | 0a 20 20 20 20 20 20 69 66 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 20 20 20 20 20 | .......if.(webContents).{....... |
1cd60 | 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 28 63 61 70 74 | ..webContents._sendInternal(capt |
1cd80 | 75 72 65 72 52 65 73 75 6c 74 28 72 65 71 75 65 73 74 2e 69 64 29 2c 20 72 65 73 75 6c 74 29 0a | urerResult(request.id),.result). |
1cda0 | 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 75 6e 68 61 6e | ......}.....}.else.{.......unhan |
1cdc0 | 64 6c 65 64 52 65 71 75 65 73 74 73 51 75 65 75 65 2e 70 75 73 68 28 72 65 71 75 65 73 74 29 0a | dledRequestsQueue.push(request). |
1cde0 | 20 20 20 20 7d 0a 20 20 7d 29 0a 20 20 72 65 71 75 65 73 74 73 51 75 65 75 65 20 3d 20 75 6e 68 | ....}...})...requestsQueue.=.unh |
1ce00 | 61 6e 64 6c 65 64 52 65 71 75 65 73 74 73 51 75 65 75 65 0a 0a 20 20 2f 2f 20 49 66 20 74 68 65 | andledRequestsQueue....//.If.the |
1ce20 | 20 72 65 71 75 65 73 74 73 51 75 65 75 65 20 69 73 20 6e 6f 74 20 65 6d 70 74 79 2c 20 73 74 61 | .requestsQueue.is.not.empty,.sta |
1ce40 | 72 74 20 61 20 6e 65 77 20 72 65 71 75 65 73 74 20 68 61 6e 64 6c 69 6e 67 2e 0a 20 20 69 66 20 | rt.a.new.request.handling....if. |
1ce60 | 28 72 65 71 75 65 73 74 73 51 75 65 75 65 2e 6c 65 6e 67 74 68 20 3e 20 30 29 20 7b 0a 20 20 20 | (requestsQueue.length.>.0).{.... |
1ce80 | 20 63 6f 6e 73 74 20 7b 20 63 61 70 74 75 72 65 57 69 6e 64 6f 77 2c 20 63 61 70 74 75 72 65 53 | .const.{.captureWindow,.captureS |
1cea0 | 63 72 65 65 6e 2c 20 74 68 75 6d 62 6e 61 69 6c 53 69 7a 65 20 7d 20 3d 20 72 65 71 75 65 73 74 | creen,.thumbnailSize.}.=.request |
1cec0 | 73 51 75 65 75 65 5b 30 5d 2e 6f 70 74 69 6f 6e 73 0a 20 20 20 20 72 65 74 75 72 6e 20 64 65 73 | sQueue[0].options.....return.des |
1cee0 | 6b 74 6f 70 43 61 70 74 75 72 65 72 2e 73 74 61 72 74 48 61 6e 64 6c 69 6e 67 28 63 61 70 74 75 | ktopCapturer.startHandling(captu |
1cf00 | 72 65 57 69 6e 64 6f 77 2c 20 63 61 70 74 75 72 65 53 63 72 65 65 6e 2c 20 74 68 75 6d 62 6e 61 | reWindow,.captureScreen,.thumbna |
1cf20 | 69 6c 53 69 7a 65 29 0a 20 20 7d 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 | ilSize)...}.}.'use.strict'..cons |
1cf40 | 74 20 7b 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 | t.{.webContents.}.=.require('ele |
1cf60 | 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 69 70 63 4d 61 69 6e 20 3d 20 72 65 71 75 69 72 65 28 | ctron').const.ipcMain.=.require( |
1cf80 | 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 69 70 63 2d | '@electron/internal/browser/ipc- |
1cfa0 | 6d 61 69 6e 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 63 6f 6e 73 74 20 70 61 72 73 65 46 65 61 74 75 | main-internal').const.parseFeatu |
1cfc0 | 72 65 73 53 74 72 69 6e 67 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 | resString.=.require('@electron/i |
1cfe0 | 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 70 61 72 73 65 2d 66 65 61 74 75 72 65 73 2d 73 74 | nternal/common/parse-features-st |
1d000 | 72 69 6e 67 27 29 0a 63 6f 6e 73 74 20 65 72 72 6f 72 55 74 69 6c 73 20 3d 20 72 65 71 75 69 72 | ring').const.errorUtils.=.requir |
1d020 | 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 65 72 72 | e('@electron/internal/common/err |
1d040 | 6f 72 2d 75 74 69 6c 73 27 29 0a 63 6f 6e 73 74 20 7b 0a 20 20 73 79 6e 63 4d 65 74 68 6f 64 73 | or-utils').const.{...syncMethods |
1d060 | 2c 0a 20 20 61 73 79 6e 63 43 61 6c 6c 62 61 63 6b 4d 65 74 68 6f 64 73 2c 0a 20 20 61 73 79 6e | ,...asyncCallbackMethods,...asyn |
1d080 | 63 50 72 6f 6d 69 73 65 4d 65 74 68 6f 64 73 0a 7d 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c | cPromiseMethods.}.=.require('@el |
1d0a0 | 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 77 65 62 2d 76 69 65 77 2d | ectron/internal/common/web-view- |
1d0c0 | 6d 65 74 68 6f 64 73 27 29 0a 0a 2f 2f 20 44 6f 65 73 6e 27 74 20 65 78 69 73 74 20 69 6e 20 65 | methods')..//.Doesn't.exist.in.e |
1d0e0 | 61 72 6c 79 20 69 6e 69 74 69 61 6c 69 7a 61 74 69 6f 6e 2e 0a 6c 65 74 20 77 65 62 56 69 65 77 | arly.initialization..let.webView |
1d100 | 4d 61 6e 61 67 65 72 20 3d 20 6e 75 6c 6c 0a 0a 63 6f 6e 73 74 20 73 75 70 70 6f 72 74 65 64 57 | Manager.=.null..const.supportedW |
1d120 | 65 62 56 69 65 77 45 76 65 6e 74 73 20 3d 20 5b 0a 20 20 27 6c 6f 61 64 2d 63 6f 6d 6d 69 74 27 | ebViewEvents.=.[...'load-commit' |
1d140 | 2c 0a 20 20 27 64 69 64 2d 61 74 74 61 63 68 27 2c 0a 20 20 27 64 69 64 2d 66 69 6e 69 73 68 2d | ,...'did-attach',...'did-finish- |
1d160 | 6c 6f 61 64 27 2c 0a 20 20 27 64 69 64 2d 66 61 69 6c 2d 6c 6f 61 64 27 2c 0a 20 20 27 64 69 64 | load',...'did-fail-load',...'did |
1d180 | 2d 66 72 61 6d 65 2d 66 69 6e 69 73 68 2d 6c 6f 61 64 27 2c 0a 20 20 27 64 69 64 2d 73 74 61 72 | -frame-finish-load',...'did-star |
1d1a0 | 74 2d 6c 6f 61 64 69 6e 67 27 2c 0a 20 20 27 64 69 64 2d 73 74 6f 70 2d 6c 6f 61 64 69 6e 67 27 | t-loading',...'did-stop-loading' |
1d1c0 | 2c 0a 20 20 27 64 6f 6d 2d 72 65 61 64 79 27 2c 0a 20 20 27 63 6f 6e 73 6f 6c 65 2d 6d 65 73 73 | ,...'dom-ready',...'console-mess |
1d1e0 | 61 67 65 27 2c 0a 20 20 27 63 6f 6e 74 65 78 74 2d 6d 65 6e 75 27 2c 0a 20 20 27 64 65 76 74 6f | age',...'context-menu',...'devto |
1d200 | 6f 6c 73 2d 6f 70 65 6e 65 64 27 2c 0a 20 20 27 64 65 76 74 6f 6f 6c 73 2d 63 6c 6f 73 65 64 27 | ols-opened',...'devtools-closed' |
1d220 | 2c 0a 20 20 27 64 65 76 74 6f 6f 6c 73 2d 66 6f 63 75 73 65 64 27 2c 0a 20 20 27 6e 65 77 2d 77 | ,...'devtools-focused',...'new-w |
1d240 | 69 6e 64 6f 77 27 2c 0a 20 20 27 77 69 6c 6c 2d 6e 61 76 69 67 61 74 65 27 2c 0a 20 20 27 64 69 | indow',...'will-navigate',...'di |
1d260 | 64 2d 73 74 61 72 74 2d 6e 61 76 69 67 61 74 69 6f 6e 27 2c 0a 20 20 27 64 69 64 2d 6e 61 76 69 | d-start-navigation',...'did-navi |
1d280 | 67 61 74 65 27 2c 0a 20 20 27 64 69 64 2d 66 72 61 6d 65 2d 6e 61 76 69 67 61 74 65 27 2c 0a 20 | gate',...'did-frame-navigate',.. |
1d2a0 | 20 27 64 69 64 2d 6e 61 76 69 67 61 74 65 2d 69 6e 2d 70 61 67 65 27 2c 0a 20 20 27 66 6f 63 75 | .'did-navigate-in-page',...'focu |
1d2c0 | 73 2d 63 68 61 6e 67 65 27 2c 0a 20 20 27 63 6c 6f 73 65 27 2c 0a 20 20 27 63 72 61 73 68 65 64 | s-change',...'close',...'crashed |
1d2e0 | 27 2c 0a 20 20 27 70 6c 75 67 69 6e 2d 63 72 61 73 68 65 64 27 2c 0a 20 20 27 64 65 73 74 72 6f | ',...'plugin-crashed',...'destro |
1d300 | 79 65 64 27 2c 0a 20 20 27 70 61 67 65 2d 74 69 74 6c 65 2d 75 70 64 61 74 65 64 27 2c 0a 20 20 | yed',...'page-title-updated',... |
1d320 | 27 70 61 67 65 2d 66 61 76 69 63 6f 6e 2d 75 70 64 61 74 65 64 27 2c 0a 20 20 27 65 6e 74 65 72 | 'page-favicon-updated',...'enter |
1d340 | 2d 68 74 6d 6c 2d 66 75 6c 6c 2d 73 63 72 65 65 6e 27 2c 0a 20 20 27 6c 65 61 76 65 2d 68 74 6d | -html-full-screen',...'leave-htm |
1d360 | 6c 2d 66 75 6c 6c 2d 73 63 72 65 65 6e 27 2c 0a 20 20 27 6d 65 64 69 61 2d 73 74 61 72 74 65 64 | l-full-screen',...'media-started |
1d380 | 2d 70 6c 61 79 69 6e 67 27 2c 0a 20 20 27 6d 65 64 69 61 2d 70 61 75 73 65 64 27 2c 0a 20 20 27 | -playing',...'media-paused',...' |
1d3a0 | 66 6f 75 6e 64 2d 69 6e 2d 70 61 67 65 27 2c 0a 20 20 27 64 69 64 2d 63 68 61 6e 67 65 2d 74 68 | found-in-page',...'did-change-th |
1d3c0 | 65 6d 65 2d 63 6f 6c 6f 72 27 2c 0a 20 20 27 75 70 64 61 74 65 2d 74 61 72 67 65 74 2d 75 72 6c | eme-color',...'update-target-url |
1d3e0 | 27 0a 5d 0a 0a 6c 65 74 20 6e 65 78 74 47 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 30 | '.]..let.nextGuestInstanceId.=.0 |
1d400 | 0a 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 20 3d 20 7b 7d 0a 63 6f 6e 73 74 | .const.guestInstances.=.{}.const |
1d420 | 20 65 6d 62 65 64 64 65 72 45 6c 65 6d 65 6e 74 73 4d 61 70 20 3d 20 7b 7d 0a 0a 2f 2f 20 47 65 | .embedderElementsMap.=.{}..//.Ge |
1d440 | 6e 65 72 61 74 65 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2e 0a 63 6f 6e 73 74 20 67 65 | nerate.guestInstanceId..const.ge |
1d460 | 74 4e 65 78 74 47 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 | tNextGuestInstanceId.=.function. |
1d480 | 28 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 2b 2b 6e 65 78 74 47 75 65 73 74 49 6e 73 74 61 6e 63 | ().{...return.++nextGuestInstanc |
1d4a0 | 65 49 64 0a 7d 0a 0a 2f 2f 20 43 72 65 61 74 65 20 61 20 6e 65 77 20 67 75 65 73 74 20 69 6e 73 | eId.}..//.Create.a.new.guest.ins |
1d4c0 | 74 61 6e 63 65 2e 0a 63 6f 6e 73 74 20 63 72 65 61 74 65 47 75 65 73 74 20 3d 20 66 75 6e 63 74 | tance..const.createGuest.=.funct |
1d4e0 | 69 6f 6e 20 28 65 6d 62 65 64 64 65 72 2c 20 70 61 72 61 6d 73 29 20 7b 0a 20 20 69 66 20 28 77 | ion.(embedder,.params).{...if.(w |
1d500 | 65 62 56 69 65 77 4d 61 6e 61 67 65 72 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 77 65 62 | ebViewManager.==.null).{.....web |
1d520 | 56 69 65 77 4d 61 6e 61 67 65 72 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e | ViewManager.=.process.atomBindin |
1d540 | 67 28 27 77 65 62 5f 76 69 65 77 5f 6d 61 6e 61 67 65 72 27 29 0a 20 20 7d 0a 0a 20 20 63 6f 6e | g('web_view_manager')...}....con |
1d560 | 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 67 65 74 4e 65 78 74 47 75 65 73 | st.guestInstanceId.=.getNextGues |
1d580 | 74 49 6e 73 74 61 6e 63 65 49 64 28 65 6d 62 65 64 64 65 72 29 0a 20 20 63 6f 6e 73 74 20 67 75 | tInstanceId(embedder)...const.gu |
1d5a0 | 65 73 74 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 63 72 65 61 74 65 28 7b 0a 20 20 20 20 69 | est.=.webContents.create({.....i |
1d5c0 | 73 47 75 65 73 74 3a 20 74 72 75 65 2c 0a 20 20 20 20 70 61 72 74 69 74 69 6f 6e 3a 20 70 61 72 | sGuest:.true,.....partition:.par |
1d5e0 | 61 6d 73 2e 70 61 72 74 69 74 69 6f 6e 2c 0a 20 20 20 20 65 6d 62 65 64 64 65 72 3a 20 65 6d 62 | ams.partition,.....embedder:.emb |
1d600 | 65 64 64 65 72 0a 20 20 7d 29 0a 20 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 65 73 | edder...})...guestInstances[gues |
1d620 | 74 49 6e 73 74 61 6e 63 65 49 64 5d 20 3d 20 7b 0a 20 20 20 20 67 75 65 73 74 3a 20 67 75 65 73 | tInstanceId].=.{.....guest:.gues |
1d640 | 74 2c 0a 20 20 20 20 65 6d 62 65 64 64 65 72 3a 20 65 6d 62 65 64 64 65 72 0a 20 20 7d 0a 0a 20 | t,.....embedder:.embedder...}... |
1d660 | 20 2f 2f 20 43 6c 65 61 72 20 74 68 65 20 67 75 65 73 74 20 66 72 6f 6d 20 6d 61 70 20 77 68 65 | .//.Clear.the.guest.from.map.whe |
1d680 | 6e 20 69 74 20 69 73 20 64 65 73 74 72 6f 79 65 64 2e 0a 20 20 2f 2f 0a 20 20 2f 2f 20 54 68 65 | n.it.is.destroyed....//...//.The |
1d6a0 | 20 67 75 65 73 74 20 57 65 62 43 6f 6e 74 65 6e 74 73 20 69 73 20 75 73 75 61 6c 6c 79 20 64 65 | .guest.WebContents.is.usually.de |
1d6c0 | 73 74 72 6f 79 65 64 20 69 6e 20 32 20 63 61 73 65 73 3a 0a 20 20 2f 2f 20 31 2e 20 54 68 65 20 | stroyed.in.2.cases:...//.1..The. |
1d6e0 | 65 6d 62 65 64 64 65 72 20 66 72 61 6d 65 20 69 73 20 63 6c 6f 73 65 64 20 28 72 65 6c 6f 61 64 | embedder.frame.is.closed.(reload |
1d700 | 65 64 20 6f 72 20 64 65 73 74 72 6f 79 65 64 29 2c 20 61 6e 64 20 69 74 0a 20 20 2f 2f 20 20 20 | ed.or.destroyed),.and.it...//... |
1d720 | 20 61 75 74 6f 6d 61 74 69 63 61 6c 6c 79 20 63 6c 6f 73 65 73 20 74 68 65 20 67 75 65 73 74 20 | .automatically.closes.the.guest. |
1d740 | 66 72 61 6d 65 2e 0a 20 20 2f 2f 20 32 2e 20 54 68 65 20 67 75 65 73 74 20 66 72 61 6d 65 20 69 | frame....//.2..The.guest.frame.i |
1d760 | 73 20 64 65 74 61 63 68 65 64 20 64 79 6e 61 6d 69 63 61 6c 6c 79 20 76 69 61 20 4a 53 2c 20 61 | s.detached.dynamically.via.JS,.a |
1d780 | 6e 64 20 69 74 20 69 73 20 6d 61 6e 75 61 6c 6c 79 0a 20 20 2f 2f 20 20 20 20 64 65 73 74 72 6f | nd.it.is.manually...//....destro |
1d7a0 | 79 65 64 20 77 68 65 6e 20 74 68 65 20 72 65 6e 64 65 72 65 72 20 73 65 6e 64 73 20 74 68 65 20 | yed.when.the.renderer.sends.the. |
1d7c0 | 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 44 45 53 54 52 4f 59 5f 47 55 45 53 54 | GUEST_VIEW_MANAGER_DESTROY_GUEST |
1d7e0 | 0a 20 20 2f 2f 20 20 20 20 6d 65 73 73 61 67 65 2e 0a 20 20 2f 2f 20 54 68 65 20 73 65 63 6f 6e | ...//....message....//.The.secon |
1d800 | 64 20 63 61 73 65 20 72 65 6c 69 65 73 20 6f 6e 20 74 68 65 20 6c 69 62 63 63 20 70 61 74 63 68 | d.case.relies.on.the.libcc.patch |
1d820 | 3a 0a 20 20 2f 2f 20 20 20 68 74 74 70 73 3a 2f 2f 67 69 74 68 75 62 2e 63 6f 6d 2f 65 6c 65 63 | :...//...https://github.com/elec |
1d840 | 74 72 6f 6e 2f 6c 69 62 63 68 72 6f 6d 69 75 6d 63 6f 6e 74 65 6e 74 2f 70 75 6c 6c 2f 36 37 36 | tron/libchromiumcontent/pull/676 |
1d860 | 0a 20 20 2f 2f 20 54 68 65 20 70 61 74 63 68 20 77 61 73 20 69 6e 74 72 6f 64 75 63 65 64 20 74 | ...//.The.patch.was.introduced.t |
1d880 | 6f 20 77 6f 72 6b 20 61 72 6f 75 6e 64 20 61 20 62 75 67 20 69 6e 20 43 68 72 6f 6d 69 75 6d 3a | o.work.around.a.bug.in.Chromium: |
1d8a0 | 0a 20 20 2f 2f 20 20 20 68 74 74 70 73 3a 2f 2f 67 69 74 68 75 62 2e 63 6f 6d 2f 65 6c 65 63 74 | ...//...https://github.com/elect |
1d8c0 | 72 6f 6e 2f 65 6c 65 63 74 72 6f 6e 2f 69 73 73 75 65 73 2f 31 34 32 31 31 0a 20 20 2f 2f 20 57 | ron/electron/issues/14211...//.W |
1d8e0 | 65 20 73 68 6f 75 6c 64 20 72 65 76 69 73 69 74 20 74 68 65 20 62 75 67 20 74 6f 20 73 65 65 20 | e.should.revisit.the.bug.to.see. |
1d900 | 69 66 20 77 65 20 63 61 6e 20 72 65 6d 6f 76 65 20 6f 75 72 20 6c 69 62 63 63 20 70 61 74 63 68 | if.we.can.remove.our.libcc.patch |
1d920 | 2c 20 74 68 65 0a 20 20 2f 2f 20 70 61 74 63 68 20 77 61 73 20 69 6e 74 72 6f 64 75 63 65 64 20 | ,.the...//.patch.was.introduced. |
1d940 | 69 6e 20 43 68 72 6f 6d 65 20 36 36 2e 0a 20 20 67 75 65 73 74 2e 6f 6e 63 65 28 27 64 65 73 74 | in.Chrome.66....guest.once('dest |
1d960 | 72 6f 79 65 64 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 67 75 65 73 74 49 6e 73 | royed',.().=>.{.....if.(guestIns |
1d980 | 74 61 6e 63 65 49 64 20 69 6e 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 29 20 7b 0a 20 20 20 | tanceId.in.guestInstances).{.... |
1d9a0 | 20 20 20 64 65 74 61 63 68 47 75 65 73 74 28 65 6d 62 65 64 64 65 72 2c 20 67 75 65 73 74 49 6e | ...detachGuest(embedder,.guestIn |
1d9c0 | 73 74 61 6e 63 65 49 64 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 49 6e 69 74 20 | stanceId).....}...})....//.Init. |
1d9e0 | 67 75 65 73 74 20 77 65 62 20 76 69 65 77 20 61 66 74 65 72 20 61 74 74 61 63 68 65 64 2e 0a 20 | guest.web.view.after.attached... |
1da00 | 20 67 75 65 73 74 2e 6f 6e 63 65 28 27 64 69 64 2d 61 74 74 61 63 68 27 2c 20 66 75 6e 63 74 69 | .guest.once('did-attach',.functi |
1da20 | 6f 6e 20 28 65 76 65 6e 74 29 20 7b 0a 20 20 20 20 70 61 72 61 6d 73 20 3d 20 74 68 69 73 2e 61 | on.(event).{.....params.=.this.a |
1da40 | 74 74 61 63 68 50 61 72 61 6d 73 0a 20 20 20 20 64 65 6c 65 74 65 20 74 68 69 73 2e 61 74 74 61 | ttachParams.....delete.this.atta |
1da60 | 63 68 50 61 72 61 6d 73 0a 0a 20 20 20 20 63 6f 6e 73 74 20 70 72 65 76 69 6f 75 73 6c 79 41 74 | chParams......const.previouslyAt |
1da80 | 74 61 63 68 65 64 20 3d 20 74 68 69 73 2e 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 20 21 3d 20 | tached.=.this.viewInstanceId.!=. |
1daa0 | 6e 75 6c 6c 0a 20 20 20 20 74 68 69 73 2e 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 70 | null.....this.viewInstanceId.=.p |
1dac0 | 61 72 61 6d 73 2e 69 6e 73 74 61 6e 63 65 49 64 0a 0a 20 20 20 20 2f 2f 20 4f 6e 6c 79 20 6c 6f | arams.instanceId......//.Only.lo |
1dae0 | 61 64 20 55 52 4c 20 61 6e 64 20 73 65 74 20 73 69 7a 65 20 6f 6e 20 66 69 72 73 74 20 61 74 74 | ad.URL.and.set.size.on.first.att |
1db00 | 61 63 68 0a 20 20 20 20 69 66 20 28 70 72 65 76 69 6f 75 73 6c 79 41 74 74 61 63 68 65 64 29 20 | ach.....if.(previouslyAttached). |
1db20 | 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 70 61 | {.......return.....}......if.(pa |
1db40 | 72 61 6d 73 2e 73 72 63 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 6f 70 74 73 20 3d 20 7b | rams.src).{.......const.opts.=.{ |
1db60 | 7d 0a 20 20 20 20 20 20 69 66 20 28 70 61 72 61 6d 73 2e 68 74 74 70 72 65 66 65 72 72 65 72 29 | }.......if.(params.httpreferrer) |
1db80 | 20 7b 0a 20 20 20 20 20 20 20 20 6f 70 74 73 2e 68 74 74 70 52 65 66 65 72 72 65 72 20 3d 20 70 | .{.........opts.httpReferrer.=.p |
1dba0 | 61 72 61 6d 73 2e 68 74 74 70 72 65 66 65 72 72 65 72 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 | arams.httpreferrer.......}...... |
1dbc0 | 20 69 66 20 28 70 61 72 61 6d 73 2e 75 73 65 72 61 67 65 6e 74 29 20 7b 0a 20 20 20 20 20 20 20 | .if.(params.useragent).{........ |
1dbe0 | 20 6f 70 74 73 2e 75 73 65 72 41 67 65 6e 74 20 3d 20 70 61 72 61 6d 73 2e 75 73 65 72 61 67 65 | .opts.userAgent.=.params.userage |
1dc00 | 6e 74 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 74 68 69 73 2e 6c 6f 61 64 55 52 4c 28 70 61 | nt.......}.......this.loadURL(pa |
1dc20 | 72 61 6d 73 2e 73 72 63 2c 20 6f 70 74 73 29 0a 20 20 20 20 7d 0a 20 20 20 20 65 6d 62 65 64 64 | rams.src,.opts).....}.....embedd |
1dc40 | 65 72 2e 65 6d 69 74 28 27 64 69 64 2d 61 74 74 61 63 68 2d 77 65 62 76 69 65 77 27 2c 20 65 76 | er.emit('did-attach-webview',.ev |
1dc60 | 65 6e 74 2c 20 67 75 65 73 74 29 0a 20 20 7d 29 0a 0a 20 20 63 6f 6e 73 74 20 73 65 6e 64 54 6f | ent,.guest)...})....const.sendTo |
1dc80 | 45 6d 62 65 64 64 65 72 20 3d 20 28 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 20 3d 3e | Embedder.=.(channel,....args).=> |
1dca0 | 20 7b 0a 20 20 20 20 69 66 20 28 21 65 6d 62 65 64 64 65 72 2e 69 73 44 65 73 74 72 6f 79 65 64 | .{.....if.(!embedder.isDestroyed |
1dcc0 | 28 29 29 20 7b 0a 20 20 20 20 20 20 65 6d 62 65 64 64 65 72 2e 5f 73 65 6e 64 49 6e 74 65 72 6e | ()).{.......embedder._sendIntern |
1dce0 | 61 6c 28 60 24 7b 63 68 61 6e 6e 65 6c 7d 2d 24 7b 67 75 65 73 74 2e 76 69 65 77 49 6e 73 74 61 | al(`${channel}-${guest.viewInsta |
1dd00 | 6e 63 65 49 64 7d 60 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 2f | nceId}`,....args).....}...}..../ |
1dd20 | 2f 20 44 69 73 70 61 74 63 68 20 65 76 65 6e 74 73 20 74 6f 20 65 6d 62 65 64 64 65 72 2e 0a 20 | /.Dispatch.events.to.embedder... |
1dd40 | 20 63 6f 6e 73 74 20 66 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 29 20 7b 0a 20 | .const.fn.=.function.(event).{.. |
1dd60 | 20 20 20 67 75 65 73 74 2e 6f 6e 28 65 76 65 6e 74 2c 20 66 75 6e 63 74 69 6f 6e 20 28 5f 2c 20 | ...guest.on(event,.function.(_,. |
1dd80 | 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 73 65 6e 64 54 6f 45 6d 62 65 64 64 65 72 28 | ...args).{.......sendToEmbedder( |
1dda0 | 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 44 49 | 'ELECTRON_GUEST_VIEW_INTERNAL_DI |
1ddc0 | 53 50 41 54 43 48 5f 45 56 45 4e 54 27 2c 20 65 76 65 6e 74 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 | SPATCH_EVENT',.event,....args).. |
1dde0 | 20 20 20 7d 29 0a 20 20 7d 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 65 76 65 6e 74 20 6f 66 20 | ...})...}...for.(const.event.of. |
1de00 | 73 75 70 70 6f 72 74 65 64 57 65 62 56 69 65 77 45 76 65 6e 74 73 29 20 7b 0a 20 20 20 20 66 6e | supportedWebViewEvents).{.....fn |
1de20 | 28 65 76 65 6e 74 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 44 69 73 70 61 74 63 68 20 67 75 65 73 74 | (event)...}....//.Dispatch.guest |
1de40 | 27 73 20 49 50 43 20 6d 65 73 73 61 67 65 73 20 74 6f 20 65 6d 62 65 64 64 65 72 2e 0a 20 20 67 | 's.IPC.messages.to.embedder....g |
1de60 | 75 65 73 74 2e 6f 6e 28 27 69 70 63 2d 6d 65 73 73 61 67 65 2d 68 6f 73 74 27 2c 20 66 75 6e 63 | uest.on('ipc-message-host',.func |
1de80 | 74 69 6f 6e 20 28 5f 2c 20 5b 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 5d 29 20 7b 0a 20 | tion.(_,.[channel,....args]).{.. |
1dea0 | 20 20 20 73 65 6e 64 54 6f 45 6d 62 65 64 64 65 72 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 | ...sendToEmbedder('ELECTRON_GUES |
1dec0 | 54 5f 56 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 49 50 43 5f 4d 45 53 53 41 47 45 27 2c 20 63 68 | T_VIEW_INTERNAL_IPC_MESSAGE',.ch |
1dee0 | 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 4e 6f 74 69 66 | annel,....args)...})....//.Notif |
1df00 | 79 20 67 75 65 73 74 20 6f 66 20 65 6d 62 65 64 64 65 72 20 77 69 6e 64 6f 77 20 76 69 73 69 62 | y.guest.of.embedder.window.visib |
1df20 | 69 6c 69 74 79 20 77 68 65 6e 20 69 74 20 69 73 20 72 65 61 64 79 0a 20 20 2f 2f 20 46 49 58 4d | ility.when.it.is.ready...//.FIXM |
1df40 | 45 20 52 65 6d 6f 76 65 20 6f 6e 63 65 20 68 74 74 70 73 3a 2f 2f 67 69 74 68 75 62 2e 63 6f 6d | E.Remove.once.https://github.com |
1df60 | 2f 65 6c 65 63 74 72 6f 6e 2f 65 6c 65 63 74 72 6f 6e 2f 69 73 73 75 65 73 2f 36 38 32 38 20 69 | /electron/electron/issues/6828.i |
1df80 | 73 20 66 69 78 65 64 0a 20 20 67 75 65 73 74 2e 6f 6e 28 27 64 6f 6d 2d 72 65 61 64 79 27 2c 20 | s.fixed...guest.on('dom-ready',. |
1dfa0 | 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 | function.().{.....const.guestIns |
1dfc0 | 74 61 6e 63 65 20 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 65 73 74 49 6e 73 74 | tance.=.guestInstances[guestInst |
1dfe0 | 61 6e 63 65 49 64 5d 0a 20 20 20 20 69 66 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 20 21 3d | anceId].....if.(guestInstance.!= |
1e000 | 20 6e 75 6c 6c 20 26 26 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 76 69 73 69 62 69 6c 69 74 | .null.&&.guestInstance.visibilit |
1e020 | 79 53 74 61 74 65 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 67 75 65 73 74 2e 5f 73 | yState.!=.null).{.......guest._s |
1e040 | 65 6e 64 49 6e 74 65 72 6e 61 6c 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 49 4e 53 54 | endInternal('ELECTRON_GUEST_INST |
1e060 | 41 4e 43 45 5f 56 49 53 49 42 49 4c 49 54 59 5f 43 48 41 4e 47 45 27 2c 20 67 75 65 73 74 49 6e | ANCE_VISIBILITY_CHANGE',.guestIn |
1e080 | 73 74 61 6e 63 65 2e 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 29 0a 20 20 20 20 7d 0a 20 20 | stance.visibilityState).....}... |
1e0a0 | 7d 29 0a 0a 20 20 2f 2f 20 46 6f 72 77 61 72 64 20 69 6e 74 65 72 6e 61 6c 20 77 65 62 20 63 6f | })....//.Forward.internal.web.co |
1e0c0 | 6e 74 65 6e 74 73 20 65 76 65 6e 74 20 74 6f 20 65 6d 62 65 64 64 65 72 20 74 6f 20 68 61 6e 64 | ntents.event.to.embedder.to.hand |
1e0e0 | 6c 65 0a 20 20 2f 2f 20 6e 61 74 69 76 65 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 20 73 65 74 75 70 | le...//.native.window.open.setup |
1e100 | 0a 20 20 67 75 65 73 74 2e 6f 6e 28 27 2d 61 64 64 2d 6e 65 77 2d 63 6f 6e 74 65 6e 74 73 27 2c | ...guest.on('-add-new-contents', |
1e120 | 20 28 2e 2e 2e 61 72 67 73 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 67 75 65 73 74 2e 67 65 | .(...args).=>.{.....if.(guest.ge |
1e140 | 74 4c 61 73 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 28 29 2e 6e 61 74 69 76 65 57 69 6e 64 | tLastWebPreferences().nativeWind |
1e160 | 6f 77 4f 70 65 6e 20 3d 3d 3d 20 74 72 75 65 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 65 | owOpen.===.true).{.......const.e |
1e180 | 6d 62 65 64 64 65 72 20 3d 20 67 65 74 45 6d 62 65 64 64 65 72 28 67 75 65 73 74 49 6e 73 74 61 | mbedder.=.getEmbedder(guestInsta |
1e1a0 | 6e 63 65 49 64 29 0a 20 20 20 20 20 20 69 66 20 28 65 6d 62 65 64 64 65 72 20 21 3d 20 6e 75 6c | nceId).......if.(embedder.!=.nul |
1e1c0 | 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 65 6d 62 65 64 64 65 72 2e 65 6d 69 74 28 27 2d 61 64 64 | l).{.........embedder.emit('-add |
1e1e0 | 2d 6e 65 77 2d 63 6f 6e 74 65 6e 74 73 27 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 20 20 7d | -new-contents',....args).......} |
1e200 | 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 20 20 67 75 65 73 74 2e 6f 6e 28 27 2d 77 65 62 2d 63 6f 6e | .....}...})...guest.on('-web-con |
1e220 | 74 65 6e 74 73 2d 63 72 65 61 74 65 64 27 2c 20 28 2e 2e 2e 61 72 67 73 29 20 3d 3e 20 7b 0a 20 | tents-created',.(...args).=>.{.. |
1e240 | 20 20 20 69 66 20 28 67 75 65 73 74 2e 67 65 74 4c 61 73 74 57 65 62 50 72 65 66 65 72 65 6e 63 | ...if.(guest.getLastWebPreferenc |
1e260 | 65 73 28 29 2e 6e 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 20 3d 3d 3d 20 74 72 75 65 29 20 | es().nativeWindowOpen.===.true). |
1e280 | 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 65 6d 62 65 64 64 65 72 20 3d 20 67 65 74 45 6d 62 65 | {.......const.embedder.=.getEmbe |
1e2a0 | 64 64 65 72 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 20 20 20 20 69 66 20 28 | dder(guestInstanceId).......if.( |
1e2c0 | 65 6d 62 65 64 64 65 72 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 65 6d 62 65 | embedder.!=.null).{.........embe |
1e2e0 | 64 64 65 72 2e 65 6d 69 74 28 27 2d 77 65 62 2d 63 6f 6e 74 65 6e 74 73 2d 63 72 65 61 74 65 64 | dder.emit('-web-contents-created |
1e300 | 27 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 0a | ',....args).......}.....}...}).. |
1e320 | 20 20 72 65 74 75 72 6e 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 0a 7d 0a 0a 2f 2f 20 41 | ..return.guestInstanceId.}..//.A |
1e340 | 74 74 61 63 68 20 74 68 65 20 67 75 65 73 74 20 74 6f 20 61 6e 20 65 6c 65 6d 65 6e 74 20 6f 66 | ttach.the.guest.to.an.element.of |
1e360 | 20 65 6d 62 65 64 64 65 72 2e 0a 63 6f 6e 73 74 20 61 74 74 61 63 68 47 75 65 73 74 20 3d 20 66 | .embedder..const.attachGuest.=.f |
1e380 | 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 65 6d 62 65 64 64 65 72 46 72 61 6d 65 49 64 2c | unction.(event,.embedderFrameId, |
1e3a0 | 20 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 | .elementInstanceId,.guestInstanc |
1e3c0 | 65 49 64 2c 20 70 61 72 61 6d 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 65 6d 62 65 64 64 65 72 20 | eId,.params).{...const.embedder. |
1e3e0 | 3d 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 0a 20 20 2f 2f 20 44 65 73 74 72 6f 79 20 74 68 65 20 | =.event.sender...//.Destroy.the. |
1e400 | 6f 6c 64 20 67 75 65 73 74 20 77 68 65 6e 20 61 74 74 61 63 68 69 6e 67 2e 0a 20 20 63 6f 6e 73 | old.guest.when.attaching....cons |
1e420 | 74 20 6b 65 79 20 3d 20 60 24 7b 65 6d 62 65 64 64 65 72 2e 69 64 7d 2d 24 7b 65 6c 65 6d 65 6e | t.key.=.`${embedder.id}-${elemen |
1e440 | 74 49 6e 73 74 61 6e 63 65 49 64 7d 60 0a 20 20 63 6f 6e 73 74 20 6f 6c 64 47 75 65 73 74 49 6e | tInstanceId}`...const.oldGuestIn |
1e460 | 73 74 61 6e 63 65 49 64 20 3d 20 65 6d 62 65 64 64 65 72 45 6c 65 6d 65 6e 74 73 4d 61 70 5b 6b | stanceId.=.embedderElementsMap[k |
1e480 | 65 79 5d 0a 20 20 69 66 20 28 6f 6c 64 47 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 21 3d 20 | ey]...if.(oldGuestInstanceId.!=. |
1e4a0 | 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 2f 2f 20 52 65 61 74 74 61 63 68 6d 65 6e 74 20 74 6f 20 74 | null).{.....//.Reattachment.to.t |
1e4c0 | 68 65 20 73 61 6d 65 20 67 75 65 73 74 20 69 73 20 6a 75 73 74 20 61 20 6e 6f 2d 6f 70 2e 0a 20 | he.same.guest.is.just.a.no-op... |
1e4e0 | 20 20 20 69 66 20 28 6f 6c 64 47 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 3d 3d 20 67 75 | ...if.(oldGuestInstanceId.===.gu |
1e500 | 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 | estInstanceId).{.......return... |
1e520 | 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 6f 6c 64 47 75 65 73 74 49 6e 73 74 61 6e 63 65 20 | ..}......const.oldGuestInstance. |
1e540 | 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 6f 6c 64 47 75 65 73 74 49 6e 73 74 61 6e 63 | =.guestInstances[oldGuestInstanc |
1e560 | 65 49 64 5d 0a 20 20 20 20 69 66 20 28 6f 6c 64 47 75 65 73 74 49 6e 73 74 61 6e 63 65 29 20 7b | eId].....if.(oldGuestInstance).{ |
1e580 | 0a 20 20 20 20 20 20 6f 6c 64 47 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 67 75 65 73 74 2e 64 65 | .......oldGuestInstance.guest.de |
1e5a0 | 73 74 72 6f 79 28 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 | stroy().....}...}....const.guest |
1e5c0 | 49 6e 73 74 61 6e 63 65 20 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 65 73 74 49 | Instance.=.guestInstances[guestI |
1e5e0 | 6e 73 74 61 6e 63 65 49 64 5d 0a 20 20 2f 2f 20 49 66 20 74 68 69 73 20 69 73 6e 27 74 20 61 20 | nstanceId]...//.If.this.isn't.a. |
1e600 | 76 61 6c 69 64 20 67 75 65 73 74 20 69 6e 73 74 61 6e 63 65 20 74 68 65 6e 20 64 6f 20 6e 6f 74 | valid.guest.instance.then.do.not |
1e620 | 68 69 6e 67 2e 0a 20 20 69 66 20 28 21 67 75 65 73 74 49 6e 73 74 61 6e 63 65 29 20 7b 0a 20 20 | hing....if.(!guestInstance).{... |
1e640 | 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 60 49 6e 76 61 6c 69 64 20 67 75 65 73 74 | ..throw.new.Error(`Invalid.guest |
1e660 | 49 6e 73 74 61 6e 63 65 49 64 3a 20 24 7b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 7d 60 29 | InstanceId:.${guestInstanceId}`) |
1e680 | 0a 20 20 7d 0a 20 20 63 6f 6e 73 74 20 7b 20 67 75 65 73 74 20 7d 20 3d 20 67 75 65 73 74 49 6e | ...}...const.{.guest.}.=.guestIn |
1e6a0 | 73 74 61 6e 63 65 0a 20 20 69 66 20 28 67 75 65 73 74 2e 68 6f 73 74 57 65 62 43 6f 6e 74 65 6e | stance...if.(guest.hostWebConten |
1e6c0 | 74 73 20 21 3d 3d 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 | ts.!==.event.sender).{.....throw |
1e6e0 | 20 6e 65 77 20 45 72 72 6f 72 28 60 41 63 63 65 73 73 20 64 65 6e 69 65 64 20 74 6f 20 67 75 65 | .new.Error(`Access.denied.to.gue |
1e700 | 73 74 49 6e 73 74 61 6e 63 65 49 64 3a 20 24 7b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 7d | stInstanceId:.${guestInstanceId} |
1e720 | 60 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 49 66 20 74 68 69 73 20 67 75 65 73 74 20 69 73 20 61 6c | `)...}....//.If.this.guest.is.al |
1e740 | 72 65 61 64 79 20 61 74 74 61 63 68 65 64 20 74 6f 20 61 6e 20 65 6c 65 6d 65 6e 74 20 74 68 65 | ready.attached.to.an.element.the |
1e760 | 6e 20 72 65 6d 6f 76 65 20 69 74 0a 20 20 69 66 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e | n.remove.it...if.(guestInstance. |
1e780 | 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6f | elementInstanceId).{.....const.o |
1e7a0 | 6c 64 4b 65 79 20 3d 20 60 24 7b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 65 6d 62 65 64 64 65 | ldKey.=.`${guestInstance.embedde |
1e7c0 | 72 2e 69 64 7d 2d 24 7b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 65 6c 65 6d 65 6e 74 49 6e 73 | r.id}-${guestInstance.elementIns |
1e7e0 | 74 61 6e 63 65 49 64 7d 60 0a 20 20 20 20 64 65 6c 65 74 65 20 65 6d 62 65 64 64 65 72 45 6c 65 | tanceId}`.....delete.embedderEle |
1e800 | 6d 65 6e 74 73 4d 61 70 5b 6f 6c 64 4b 65 79 5d 0a 0a 20 20 20 20 2f 2f 20 52 65 6d 6f 76 65 20 | mentsMap[oldKey]......//.Remove. |
1e820 | 67 75 65 73 74 20 66 72 6f 6d 20 65 6d 62 65 64 64 65 72 20 69 66 20 6d 6f 76 69 6e 67 20 61 63 | guest.from.embedder.if.moving.ac |
1e840 | 72 6f 73 73 20 77 65 62 20 76 69 65 77 73 0a 20 20 20 20 69 66 20 28 67 75 65 73 74 2e 76 69 65 | ross.web.views.....if.(guest.vie |
1e860 | 77 49 6e 73 74 61 6e 63 65 49 64 20 21 3d 3d 20 70 61 72 61 6d 73 2e 69 6e 73 74 61 6e 63 65 49 | wInstanceId.!==.params.instanceI |
1e880 | 64 29 20 7b 0a 20 20 20 20 20 20 77 65 62 56 69 65 77 4d 61 6e 61 67 65 72 2e 72 65 6d 6f 76 65 | d).{.......webViewManager.remove |
1e8a0 | 47 75 65 73 74 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 65 6d 62 65 64 64 65 72 2c 20 67 75 | Guest(guestInstance.embedder,.gu |
1e8c0 | 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 20 20 20 20 67 75 65 73 74 49 6e 73 74 61 6e | estInstanceId).......guestInstan |
1e8e0 | 63 65 2e 65 6d 62 65 64 64 65 72 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 28 60 45 4c 45 43 54 | ce.embedder._sendInternal(`ELECT |
1e900 | 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 44 45 53 54 52 4f 59 5f | RON_GUEST_VIEW_INTERNAL_DESTROY_ |
1e920 | 47 55 45 53 54 2d 24 7b 67 75 65 73 74 2e 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 7d 60 29 0a | GUEST-${guest.viewInstanceId}`). |
1e940 | 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 | ....}...}....const.webPreference |
1e960 | 73 20 3d 20 7b 0a 20 20 20 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 3a 20 67 75 65 73 74 | s.=.{.....guestInstanceId:.guest |
1e980 | 49 6e 73 74 61 6e 63 65 49 64 2c 0a 20 20 20 20 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 3a | InstanceId,.....nodeIntegration: |
1e9a0 | 20 70 61 72 61 6d 73 2e 6e 6f 64 65 69 6e 74 65 67 72 61 74 69 6f 6e 20 21 3d 20 6e 75 6c 6c 20 | .params.nodeintegration.!=.null. |
1e9c0 | 3f 20 70 61 72 61 6d 73 2e 6e 6f 64 65 69 6e 74 65 67 72 61 74 69 6f 6e 20 3a 20 66 61 6c 73 65 | ?.params.nodeintegration.:.false |
1e9e0 | 2c 0a 20 20 20 20 65 6e 61 62 6c 65 52 65 6d 6f 74 65 4d 6f 64 75 6c 65 3a 20 70 61 72 61 6d 73 | ,.....enableRemoteModule:.params |
1ea00 | 2e 65 6e 61 62 6c 65 72 65 6d 6f 74 65 6d 6f 64 75 6c 65 2c 0a 20 20 20 20 70 6c 75 67 69 6e 73 | .enableremotemodule,.....plugins |
1ea20 | 3a 20 70 61 72 61 6d 73 2e 70 6c 75 67 69 6e 73 2c 0a 20 20 20 20 7a 6f 6f 6d 46 61 63 74 6f 72 | :.params.plugins,.....zoomFactor |
1ea40 | 3a 20 65 6d 62 65 64 64 65 72 2e 5f 67 65 74 5a 6f 6f 6d 46 61 63 74 6f 72 28 29 2c 0a 20 20 20 | :.embedder._getZoomFactor(),.... |
1ea60 | 20 64 69 73 61 62 6c 65 50 6f 70 75 70 73 3a 20 21 70 61 72 61 6d 73 2e 61 6c 6c 6f 77 70 6f 70 | .disablePopups:.!params.allowpop |
1ea80 | 75 70 73 2c 0a 20 20 20 20 77 65 62 53 65 63 75 72 69 74 79 3a 20 21 70 61 72 61 6d 73 2e 64 69 | ups,.....webSecurity:.!params.di |
1eaa0 | 73 61 62 6c 65 77 65 62 73 65 63 75 72 69 74 79 2c 0a 20 20 20 20 65 6e 61 62 6c 65 42 6c 69 6e | sablewebsecurity,.....enableBlin |
1eac0 | 6b 46 65 61 74 75 72 65 73 3a 20 70 61 72 61 6d 73 2e 62 6c 69 6e 6b 66 65 61 74 75 72 65 73 2c | kFeatures:.params.blinkfeatures, |
1eae0 | 0a 20 20 20 20 64 69 73 61 62 6c 65 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 3a 20 70 61 72 61 6d | .....disableBlinkFeatures:.param |
1eb00 | 73 2e 64 69 73 61 62 6c 65 62 6c 69 6e 6b 66 65 61 74 75 72 65 73 0a 20 20 7d 0a 0a 20 20 2f 2f | s.disableblinkfeatures...}....// |
1eb20 | 20 70 61 72 73 65 20 74 68 65 20 27 77 65 62 70 72 65 66 65 72 65 6e 63 65 73 27 20 61 74 74 72 | .parse.the.'webpreferences'.attr |
1eb40 | 69 62 75 74 65 20 73 74 72 69 6e 67 2c 20 69 66 20 73 65 74 0a 20 20 2f 2f 20 74 68 69 73 20 75 | ibute.string,.if.set...//.this.u |
1eb60 | 73 65 73 20 74 68 65 20 73 61 6d 65 20 70 61 72 73 69 6e 67 20 72 75 6c 65 73 20 61 73 20 77 69 | ses.the.same.parsing.rules.as.wi |
1eb80 | 6e 64 6f 77 2e 6f 70 65 6e 20 75 73 65 73 20 66 6f 72 20 69 74 73 20 66 65 61 74 75 72 65 73 0a | ndow.open.uses.for.its.features. |
1eba0 | 20 20 69 66 20 28 74 79 70 65 6f 66 20 70 61 72 61 6d 73 2e 77 65 62 70 72 65 66 65 72 65 6e 63 | ..if.(typeof.params.webpreferenc |
1ebc0 | 65 73 20 3d 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 20 20 70 61 72 73 65 46 65 61 74 | es.===.'string').{.....parseFeat |
1ebe0 | 75 72 65 73 53 74 72 69 6e 67 28 70 61 72 61 6d 73 2e 77 65 62 70 72 65 66 65 72 65 6e 63 65 73 | uresString(params.webpreferences |
1ec00 | 2c 20 66 75 6e 63 74 69 6f 6e 20 28 6b 65 79 2c 20 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 | ,.function.(key,.value).{....... |
1ec20 | 69 66 20 28 76 61 6c 75 65 20 3d 3d 3d 20 75 6e 64 65 66 69 6e 65 64 29 20 7b 0a 20 20 20 20 20 | if.(value.===.undefined).{...... |
1ec40 | 20 20 20 2f 2f 20 6e 6f 20 76 61 6c 75 65 20 77 61 73 20 73 70 65 63 69 66 69 65 64 2c 20 64 65 | ...//.no.value.was.specified,.de |
1ec60 | 66 61 75 6c 74 20 69 74 20 74 6f 20 74 72 75 65 0a 20 20 20 20 20 20 20 20 76 61 6c 75 65 20 3d | fault.it.to.true.........value.= |
1ec80 | 20 74 72 75 65 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 77 65 62 50 72 65 66 65 72 65 6e 63 | .true.......}.......webPreferenc |
1eca0 | 65 73 5b 6b 65 79 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 69 66 | es[key].=.value.....})...}....if |
1ecc0 | 20 28 70 61 72 61 6d 73 2e 70 72 65 6c 6f 61 64 29 20 7b 0a 20 20 20 20 77 65 62 50 72 65 66 65 | .(params.preload).{.....webPrefe |
1ece0 | 72 65 6e 63 65 73 2e 70 72 65 6c 6f 61 64 55 52 4c 20 3d 20 70 61 72 61 6d 73 2e 70 72 65 6c 6f | rences.preloadURL.=.params.prelo |
1ed00 | 61 64 0a 20 20 7d 0a 0a 20 20 2f 2f 20 53 65 63 75 72 69 74 79 20 6f 70 74 69 6f 6e 73 20 74 68 | ad...}....//.Security.options.th |
1ed20 | 61 74 20 67 75 65 73 74 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 69 6e 68 65 72 69 74 20 66 72 6f | at.guest.will.always.inherit.fro |
1ed40 | 6d 20 65 6d 62 65 64 64 65 72 0a 20 20 63 6f 6e 73 74 20 69 6e 68 65 72 69 74 65 64 57 65 62 50 | m.embedder...const.inheritedWebP |
1ed60 | 72 65 66 65 72 65 6e 63 65 73 20 3d 20 6e 65 77 20 4d 61 70 28 5b 0a 20 20 20 20 5b 27 63 6f 6e | references.=.new.Map([.....['con |
1ed80 | 74 65 78 74 49 73 6f 6c 61 74 69 6f 6e 27 2c 20 74 72 75 65 5d 2c 0a 20 20 20 20 5b 27 6a 61 76 | textIsolation',.true],.....['jav |
1eda0 | 61 73 63 72 69 70 74 27 2c 20 66 61 6c 73 65 5d 2c 0a 20 20 20 20 5b 27 6e 61 74 69 76 65 57 69 | ascript',.false],.....['nativeWi |
1edc0 | 6e 64 6f 77 4f 70 65 6e 27 2c 20 74 72 75 65 5d 2c 0a 20 20 20 20 5b 27 6e 6f 64 65 49 6e 74 65 | ndowOpen',.true],.....['nodeInte |
1ede0 | 67 72 61 74 69 6f 6e 27 2c 20 66 61 6c 73 65 5d 2c 0a 20 20 20 20 5b 27 65 6e 61 62 6c 65 52 65 | gration',.false],.....['enableRe |
1ee00 | 6d 6f 74 65 4d 6f 64 75 6c 65 27 2c 20 66 61 6c 73 65 5d 2c 0a 20 20 20 20 5b 27 73 61 6e 64 62 | moteModule',.false],.....['sandb |
1ee20 | 6f 78 27 2c 20 74 72 75 65 5d 0a 20 20 5d 29 0a 0a 20 20 2f 2f 20 49 6e 68 65 72 69 74 20 63 65 | ox',.true]...])....//.Inherit.ce |
1ee40 | 72 74 61 69 6e 20 6f 70 74 69 6f 6e 20 76 61 6c 75 65 73 20 66 72 6f 6d 20 65 6d 62 65 64 64 65 | rtain.option.values.from.embedde |
1ee60 | 72 0a 20 20 63 6f 6e 73 74 20 6c 61 73 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d 20 65 | r...const.lastWebPreferences.=.e |
1ee80 | 6d 62 65 64 64 65 72 2e 67 65 74 4c 61 73 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 28 29 0a | mbedder.getLastWebPreferences(). |
1eea0 | 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 5b 6e 61 6d 65 2c 20 76 61 6c 75 65 5d 20 6f 66 20 69 6e | ..for.(const.[name,.value].of.in |
1eec0 | 68 65 72 69 74 65 64 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 20 7b 0a 20 20 20 20 69 66 20 | heritedWebPreferences).{.....if. |
1eee0 | 28 6c 61 73 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 5b 6e 61 6d 65 5d 20 3d 3d 3d 20 76 61 | (lastWebPreferences[name].===.va |
1ef00 | 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 5b 6e 61 6d 65 | lue).{.......webPreferences[name |
1ef20 | 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 65 6d 62 65 64 64 65 72 2e | ].=.value.....}...}....embedder. |
1ef40 | 65 6d 69 74 28 27 77 69 6c 6c 2d 61 74 74 61 63 68 2d 77 65 62 76 69 65 77 27 2c 20 65 76 65 6e | emit('will-attach-webview',.even |
1ef60 | 74 2c 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2c 20 70 61 72 61 6d 73 29 0a 20 20 69 66 20 | t,.webPreferences,.params)...if. |
1ef80 | 28 65 76 65 6e 74 2e 64 65 66 61 75 6c 74 50 72 65 76 65 6e 74 65 64 29 20 7b 0a 20 20 20 20 69 | (event.defaultPrevented).{.....i |
1efa0 | 66 20 28 67 75 65 73 74 2e 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 20 3d 3d 20 6e 75 6c 6c 29 | f.(guest.viewInstanceId.==.null) |
1efc0 | 20 67 75 65 73 74 2e 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 70 61 72 61 6d 73 2e 69 | .guest.viewInstanceId.=.params.i |
1efe0 | 6e 73 74 61 6e 63 65 49 64 0a 20 20 20 20 67 75 65 73 74 2e 64 65 73 74 72 6f 79 28 29 0a 20 20 | nstanceId.....guest.destroy()... |
1f000 | 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 67 75 65 73 74 2e 61 74 74 61 63 68 50 61 72 61 | ..return...}....guest.attachPara |
1f020 | 6d 73 20 3d 20 70 61 72 61 6d 73 0a 20 20 65 6d 62 65 64 64 65 72 45 6c 65 6d 65 6e 74 73 4d 61 | ms.=.params...embedderElementsMa |
1f040 | 70 5b 6b 65 79 5d 20 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 0a 0a 20 20 67 75 65 73 | p[key].=.guestInstanceId....gues |
1f060 | 74 2e 73 65 74 45 6d 62 65 64 64 65 72 28 65 6d 62 65 64 64 65 72 29 0a 20 20 67 75 65 73 74 49 | t.setEmbedder(embedder)...guestI |
1f080 | 6e 73 74 61 6e 63 65 2e 65 6d 62 65 64 64 65 72 20 3d 20 65 6d 62 65 64 64 65 72 0a 20 20 67 75 | nstance.embedder.=.embedder...gu |
1f0a0 | 65 73 74 49 6e 73 74 61 6e 63 65 2e 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 | estInstance.elementInstanceId.=. |
1f0c0 | 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 0a 0a 20 20 77 61 74 63 68 45 6d 62 65 64 64 | elementInstanceId....watchEmbedd |
1f0e0 | 65 72 28 65 6d 62 65 64 64 65 72 29 0a 0a 20 20 77 65 62 56 69 65 77 4d 61 6e 61 67 65 72 2e 61 | er(embedder)....webViewManager.a |
1f100 | 64 64 47 75 65 73 74 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 65 6c 65 6d 65 6e 74 | ddGuest(guestInstanceId,.element |
1f120 | 49 6e 73 74 61 6e 63 65 49 64 2c 20 65 6d 62 65 64 64 65 72 2c 20 67 75 65 73 74 2c 20 77 65 62 | InstanceId,.embedder,.guest,.web |
1f140 | 50 72 65 66 65 72 65 6e 63 65 73 29 0a 20 20 67 75 65 73 74 2e 61 74 74 61 63 68 54 6f 49 66 72 | Preferences)...guest.attachToIfr |
1f160 | 61 6d 65 28 65 6d 62 65 64 64 65 72 2c 20 65 6d 62 65 64 64 65 72 46 72 61 6d 65 49 64 29 0a 7d | ame(embedder,.embedderFrameId).} |
1f180 | 0a 0a 2f 2f 20 52 65 6d 6f 76 65 20 61 6e 20 67 75 65 73 74 2d 65 6d 62 65 64 64 65 72 20 72 65 | ..//.Remove.an.guest-embedder.re |
1f1a0 | 6c 61 74 69 6f 6e 73 68 69 70 2e 0a 63 6f 6e 73 74 20 64 65 74 61 63 68 47 75 65 73 74 20 3d 20 | lationship..const.detachGuest.=. |
1f1c0 | 66 75 6e 63 74 69 6f 6e 20 28 65 6d 62 65 64 64 65 72 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 | function.(embedder,.guestInstanc |
1f1e0 | 65 49 64 29 20 7b 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 20 3d 20 67 | eId).{...const.guestInstance.=.g |
1f200 | 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 5d 0a 20 | uestInstances[guestInstanceId].. |
1f220 | 20 69 66 20 28 65 6d 62 65 64 64 65 72 20 21 3d 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e | .if.(embedder.!==.guestInstance. |
1f240 | 65 6d 62 65 64 64 65 72 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 77 65 | embedder).{.....return...}....we |
1f260 | 62 56 69 65 77 4d 61 6e 61 67 65 72 2e 72 65 6d 6f 76 65 47 75 65 73 74 28 65 6d 62 65 64 64 65 | bViewManager.removeGuest(embedde |
1f280 | 72 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 64 65 6c 65 74 65 20 67 75 65 | r,.guestInstanceId)...delete.gue |
1f2a0 | 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 5d 0a 0a 20 20 | stInstances[guestInstanceId].... |
1f2c0 | 63 6f 6e 73 74 20 6b 65 79 20 3d 20 60 24 7b 65 6d 62 65 64 64 65 72 2e 69 64 7d 2d 24 7b 67 75 | const.key.=.`${embedder.id}-${gu |
1f2e0 | 65 73 74 49 6e 73 74 61 6e 63 65 2e 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 7d 60 0a | estInstance.elementInstanceId}`. |
1f300 | 20 20 64 65 6c 65 74 65 20 65 6d 62 65 64 64 65 72 45 6c 65 6d 65 6e 74 73 4d 61 70 5b 6b 65 79 | ..delete.embedderElementsMap[key |
1f320 | 5d 0a 7d 0a 0a 2f 2f 20 4f 6e 63 65 20 61 6e 20 65 6d 62 65 64 64 65 72 20 68 61 73 20 68 61 64 | ].}..//.Once.an.embedder.has.had |
1f340 | 20 61 20 67 75 65 73 74 20 61 74 74 61 63 68 65 64 20 77 65 20 77 61 74 63 68 20 69 74 20 66 6f | .a.guest.attached.we.watch.it.fo |
1f360 | 72 20 64 65 73 74 72 75 63 74 69 6f 6e 20 74 6f 0a 2f 2f 20 64 65 73 74 72 6f 79 20 61 6e 79 20 | r.destruction.to.//.destroy.any. |
1f380 | 72 65 6d 61 69 6e 69 6e 67 20 67 75 65 73 74 73 2e 0a 63 6f 6e 73 74 20 77 61 74 63 68 65 64 45 | remaining.guests..const.watchedE |
1f3a0 | 6d 62 65 64 64 65 72 73 20 3d 20 6e 65 77 20 53 65 74 28 29 0a 63 6f 6e 73 74 20 77 61 74 63 68 | mbedders.=.new.Set().const.watch |
1f3c0 | 45 6d 62 65 64 64 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 6d 62 65 64 64 65 72 29 20 7b | Embedder.=.function.(embedder).{ |
1f3e0 | 0a 20 20 69 66 20 28 77 61 74 63 68 65 64 45 6d 62 65 64 64 65 72 73 2e 68 61 73 28 65 6d 62 65 | ...if.(watchedEmbedders.has(embe |
1f400 | 64 64 65 72 29 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 20 20 77 61 74 63 68 65 | dder)).{.....return...}...watche |
1f420 | 64 45 6d 62 65 64 64 65 72 73 2e 61 64 64 28 65 6d 62 65 64 64 65 72 29 0a 0a 20 20 2f 2f 20 46 | dEmbedders.add(embedder)....//.F |
1f440 | 6f 72 77 61 72 64 20 65 6d 62 65 64 64 65 72 20 77 69 6e 64 6f 77 20 76 69 73 69 62 6c 69 74 79 | orward.embedder.window.visiblity |
1f460 | 20 63 68 61 6e 67 65 20 65 76 65 6e 74 73 20 74 6f 20 67 75 65 73 74 0a 20 20 63 6f 6e 73 74 20 | .change.events.to.guest...const. |
1f480 | 6f 6e 56 69 73 69 62 69 6c 69 74 79 43 68 61 6e 67 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 76 | onVisibilityChange.=.function.(v |
1f4a0 | 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 29 20 7b 0a 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 | isibilityState).{.....for.(const |
1f4c0 | 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 69 6e 20 67 75 65 73 74 49 6e 73 74 61 6e 63 | .guestInstanceId.in.guestInstanc |
1f4e0 | 65 73 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 20 | es).{.......const.guestInstance. |
1f500 | 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 | =.guestInstances[guestInstanceId |
1f520 | 5d 0a 20 20 20 20 20 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 76 69 73 69 62 69 6c 69 74 79 | ].......guestInstance.visibility |
1f540 | 53 74 61 74 65 20 3d 20 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 0a 20 20 20 20 20 20 69 66 | State.=.visibilityState.......if |
1f560 | 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 65 6d 62 65 64 64 65 72 20 3d 3d 3d 20 65 6d 62 | .(guestInstance.embedder.===.emb |
1f580 | 65 64 64 65 72 29 20 7b 0a 20 20 20 20 20 20 20 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 67 | edder).{.........guestInstance.g |
1f5a0 | 75 65 73 74 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 | uest._sendInternal('ELECTRON_GUE |
1f5c0 | 53 54 5f 49 4e 53 54 41 4e 43 45 5f 56 49 53 49 42 49 4c 49 54 59 5f 43 48 41 4e 47 45 27 2c 20 | ST_INSTANCE_VISIBILITY_CHANGE',. |
1f5e0 | 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 | visibilityState).......}.....}.. |
1f600 | 20 7d 0a 20 20 65 6d 62 65 64 64 65 72 2e 6f 6e 28 27 2d 77 69 6e 64 6f 77 2d 76 69 73 69 62 69 | .}...embedder.on('-window-visibi |
1f620 | 6c 69 74 79 2d 63 68 61 6e 67 65 27 2c 20 6f 6e 56 69 73 69 62 69 6c 69 74 79 43 68 61 6e 67 65 | lity-change',.onVisibilityChange |
1f640 | 29 0a 0a 20 20 65 6d 62 65 64 64 65 72 2e 6f 6e 63 65 28 27 77 69 6c 6c 2d 64 65 73 74 72 6f 79 | )....embedder.once('will-destroy |
1f660 | 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 2f 2f 20 55 73 75 61 6c 6c 79 20 74 68 65 20 67 75 | ',.().=>.{.....//.Usually.the.gu |
1f680 | 65 73 74 49 6e 73 74 61 6e 63 65 73 20 69 73 20 63 6c 65 61 72 65 64 20 77 68 65 6e 20 67 75 65 | estInstances.is.cleared.when.gue |
1f6a0 | 73 74 20 69 73 20 64 65 73 74 72 6f 79 65 64 2c 20 62 75 74 20 69 74 0a 20 20 20 20 2f 2f 20 6d | st.is.destroyed,.but.it.....//.m |
1f6c0 | 61 79 20 68 61 70 70 65 6e 20 74 68 61 74 20 74 68 65 20 65 6d 62 65 64 64 65 72 20 67 65 74 73 | ay.happen.that.the.embedder.gets |
1f6e0 | 20 6d 61 6e 75 61 6c 6c 79 20 64 65 73 74 72 6f 79 65 64 20 65 61 72 6c 69 65 72 20 74 68 61 6e | .manually.destroyed.earlier.than |
1f700 | 20 67 75 65 73 74 2c 0a 20 20 20 20 2f 2f 20 61 6e 64 20 74 68 65 20 65 6d 62 65 64 64 65 72 20 | .guest,.....//.and.the.embedder. |
1f720 | 77 69 6c 6c 20 62 65 20 69 6e 76 61 6c 69 64 20 69 6e 20 74 68 65 20 75 73 75 61 6c 20 63 6f 64 | will.be.invalid.in.the.usual.cod |
1f740 | 65 20 70 61 74 68 2e 0a 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 | e.path......for.(const.guestInst |
1f760 | 61 6e 63 65 49 64 20 69 6e 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 73 29 20 7b 0a 20 20 20 20 | anceId.in.guestInstances).{..... |
1f780 | 20 20 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 20 3d 20 67 75 65 73 74 49 6e 73 | ..const.guestInstance.=.guestIns |
1f7a0 | 74 61 6e 63 65 73 5b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 5d 0a 20 20 20 20 20 20 69 66 | tances[guestInstanceId].......if |
1f7c0 | 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 65 6d 62 65 64 64 65 72 20 3d 3d 3d 20 65 6d 62 | .(guestInstance.embedder.===.emb |
1f7e0 | 65 64 64 65 72 29 20 7b 0a 20 20 20 20 20 20 20 20 64 65 74 61 63 68 47 75 65 73 74 28 65 6d 62 | edder).{.........detachGuest(emb |
1f800 | 65 64 64 65 72 2c 20 70 61 72 73 65 49 6e 74 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 | edder,.parseInt(guestInstanceId) |
1f820 | 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 20 20 2f 2f 20 43 6c 65 61 72 20 74 68 65 | ).......}.....}.....//.Clear.the |
1f840 | 20 6c 69 73 74 65 6e 65 72 73 2e 0a 20 20 20 20 65 6d 62 65 64 64 65 72 2e 72 65 6d 6f 76 65 4c | .listeners......embedder.removeL |
1f860 | 69 73 74 65 6e 65 72 28 27 2d 77 69 6e 64 6f 77 2d 76 69 73 69 62 69 6c 69 74 79 2d 63 68 61 6e | istener('-window-visibility-chan |
1f880 | 67 65 27 2c 20 6f 6e 56 69 73 69 62 69 6c 69 74 79 43 68 61 6e 67 65 29 0a 20 20 20 20 77 61 74 | ge',.onVisibilityChange).....wat |
1f8a0 | 63 68 65 64 45 6d 62 65 64 64 65 72 73 2e 64 65 6c 65 74 65 28 65 6d 62 65 64 64 65 72 29 0a 20 | chedEmbedders.delete(embedder).. |
1f8c0 | 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 69 73 57 65 62 56 69 65 77 54 61 67 45 6e 61 62 6c 65 64 | .}).}..const.isWebViewTagEnabled |
1f8e0 | 43 61 63 68 65 20 3d 20 6e 65 77 20 57 65 61 6b 4d 61 70 28 29 0a 0a 63 6f 6e 73 74 20 69 73 57 | Cache.=.new.WeakMap()..const.isW |
1f900 | 65 62 56 69 65 77 54 61 67 45 6e 61 62 6c 65 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 6f 6e | ebViewTagEnabled.=.function.(con |
1f920 | 74 65 6e 74 73 29 20 7b 0a 20 20 69 66 20 28 21 69 73 57 65 62 56 69 65 77 54 61 67 45 6e 61 62 | tents).{...if.(!isWebViewTagEnab |
1f940 | 6c 65 64 43 61 63 68 65 2e 68 61 73 28 63 6f 6e 74 65 6e 74 73 29 29 20 7b 0a 20 20 20 20 63 6f | ledCache.has(contents)).{.....co |
1f960 | 6e 73 74 20 76 61 6c 75 65 20 3d 20 63 6f 6e 74 65 6e 74 73 2e 67 65 74 4c 61 73 74 57 65 62 50 | nst.value.=.contents.getLastWebP |
1f980 | 72 65 66 65 72 65 6e 63 65 73 28 29 2e 77 65 62 76 69 65 77 54 61 67 0a 20 20 20 20 69 73 57 65 | references().webviewTag.....isWe |
1f9a0 | 62 56 69 65 77 54 61 67 45 6e 61 62 6c 65 64 43 61 63 68 65 2e 73 65 74 28 63 6f 6e 74 65 6e 74 | bViewTagEnabledCache.set(content |
1f9c0 | 73 2c 20 76 61 6c 75 65 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 69 73 57 65 62 56 69 65 | s,.value)...}....return.isWebVie |
1f9e0 | 77 54 61 67 45 6e 61 62 6c 65 64 43 61 63 68 65 2e 67 65 74 28 63 6f 6e 74 65 6e 74 73 29 0a 7d | wTagEnabledCache.get(contents).} |
1fa00 | 0a 0a 63 6f 6e 73 74 20 68 61 6e 64 6c 65 4d 65 73 73 61 67 65 20 3d 20 66 75 6e 63 74 69 6f 6e | ..const.handleMessage.=.function |
1fa20 | 20 28 63 68 61 6e 6e 65 6c 2c 20 68 61 6e 64 6c 65 72 29 20 7b 0a 20 20 69 70 63 4d 61 69 6e 2e | .(channel,.handler).{...ipcMain. |
1fa40 | 6f 6e 28 63 68 61 6e 6e 65 6c 2c 20 28 65 76 65 6e 74 2c 20 2e 2e 2e 61 72 67 73 29 20 3d 3e 20 | on(channel,.(event,....args).=>. |
1fa60 | 7b 0a 20 20 20 20 69 66 20 28 69 73 57 65 62 56 69 65 77 54 61 67 45 6e 61 62 6c 65 64 28 65 76 | {.....if.(isWebViewTagEnabled(ev |
1fa80 | 65 6e 74 2e 73 65 6e 64 65 72 29 29 20 7b 0a 20 20 20 20 20 20 68 61 6e 64 6c 65 72 28 65 76 65 | ent.sender)).{.......handler(eve |
1faa0 | 6e 74 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 | nt,....args).....}.else.{....... |
1fac0 | 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 7d 0a 20 | event.returnValue.=.null.....}.. |
1fae0 | 20 7d 29 0a 7d 0a 0a 68 61 6e 64 6c 65 4d 65 73 73 61 67 65 28 27 45 4c 45 43 54 52 4f 4e 5f 47 | .}).}..handleMessage('ELECTRON_G |
1fb00 | 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 43 52 45 41 54 45 5f 47 55 45 53 54 27 2c | UEST_VIEW_MANAGER_CREATE_GUEST', |
1fb20 | 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 70 61 72 61 6d 73 2c 20 72 65 71 75 65 73 | .function.(event,.params,.reques |
1fb40 | 74 49 64 29 20 7b 0a 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 5f 73 65 6e 64 49 6e 74 65 72 | tId).{...event.sender._sendInter |
1fb60 | 6e 61 6c 28 60 45 4c 45 43 54 52 4f 4e 5f 52 45 53 50 4f 4e 53 45 5f 24 7b 72 65 71 75 65 73 74 | nal(`ELECTRON_RESPONSE_${request |
1fb80 | 49 64 7d 60 2c 20 63 72 65 61 74 65 47 75 65 73 74 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 | Id}`,.createGuest(event.sender,. |
1fba0 | 70 61 72 61 6d 73 29 29 0a 7d 29 0a 0a 68 61 6e 64 6c 65 4d 65 73 73 61 67 65 28 27 45 4c 45 43 | params)).})..handleMessage('ELEC |
1fbc0 | 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 43 52 45 41 54 45 5f 47 | TRON_GUEST_VIEW_MANAGER_CREATE_G |
1fbe0 | 55 45 53 54 5f 53 59 4e 43 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 70 61 72 | UEST_SYNC',.function.(event,.par |
1fc00 | 61 6d 73 29 20 7b 0a 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 63 72 65 | ams).{...event.returnValue.=.cre |
1fc20 | 61 74 65 47 75 65 73 74 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 70 61 72 61 6d 73 29 0a 7d | ateGuest(event.sender,.params).} |
1fc40 | 29 0a 0a 68 61 6e 64 6c 65 4d 65 73 73 61 67 65 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 | )..handleMessage('ELECTRON_GUEST |
1fc60 | 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 44 45 53 54 52 4f 59 5f 47 55 45 53 54 27 2c 20 66 75 | _VIEW_MANAGER_DESTROY_GUEST',.fu |
1fc80 | 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 | nction.(event,.guestInstanceId). |
1fca0 | 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 67 75 65 73 74 20 3d 20 67 65 74 47 | {...try.{.....const.guest.=.getG |
1fcc0 | 75 65 73 74 46 6f 72 57 65 62 43 6f 6e 74 65 6e 74 73 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 | uestForWebContents(guestInstance |
1fce0 | 49 64 2c 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 29 0a 20 20 20 20 67 75 65 73 74 2e 64 65 73 74 | Id,.event.sender).....guest.dest |
1fd00 | 72 6f 79 28 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 63 6f | roy()...}.catch.(error).{.....co |
1fd20 | 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 60 47 75 65 73 74 20 64 65 73 74 72 6f 79 20 66 61 69 6c 65 | nsole.error(`Guest.destroy.faile |
1fd40 | 64 3a 20 24 7b 65 72 72 6f 72 7d 60 29 0a 20 20 7d 0a 7d 29 0a 0a 68 61 6e 64 6c 65 4d 65 73 73 | d:.${error}`)...}.})..handleMess |
1fd60 | 61 67 65 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 | age('ELECTRON_GUEST_VIEW_MANAGER |
1fd80 | 5f 41 54 54 41 43 48 5f 47 55 45 53 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c | _ATTACH_GUEST',.function.(event, |
1fda0 | 20 65 6d 62 65 64 64 65 72 46 72 61 6d 65 49 64 2c 20 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 | .embedderFrameId,.elementInstanc |
1fdc0 | 65 49 64 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 70 61 72 61 6d 73 29 20 7b 0a | eId,.guestInstanceId,.params).{. |
1fde0 | 20 20 74 72 79 20 7b 0a 20 20 20 20 61 74 74 61 63 68 47 75 65 73 74 28 65 76 65 6e 74 2c 20 65 | ..try.{.....attachGuest(event,.e |
1fe00 | 6d 62 65 64 64 65 72 46 72 61 6d 65 49 64 2c 20 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 | mbedderFrameId,.elementInstanceI |
1fe20 | 64 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 70 61 72 61 6d 73 29 0a 20 20 7d 20 | d,.guestInstanceId,.params)...}. |
1fe40 | 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f | catch.(error).{.....console.erro |
1fe60 | 72 28 60 47 75 65 73 74 20 61 74 74 61 63 68 20 66 61 69 6c 65 64 3a 20 24 7b 65 72 72 6f 72 7d | r(`Guest.attach.failed:.${error} |
1fe80 | 60 29 0a 20 20 7d 0a 7d 29 0a 0a 2f 2f 20 74 68 69 73 20 6d 65 73 73 61 67 65 20 69 73 20 73 65 | `)...}.})..//.this.message.is.se |
1fea0 | 6e 74 20 62 79 20 74 68 65 20 61 63 74 75 61 6c 20 3c 77 65 62 76 69 65 77 3e 0a 69 70 63 4d 61 | nt.by.the.actual.<webview>.ipcMa |
1fec0 | 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 | in.on('ELECTRON_GUEST_VIEW_MANAG |
1fee0 | 45 52 5f 46 4f 43 55 53 5f 43 48 41 4e 47 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e | ER_FOCUS_CHANGE',.function.(even |
1ff00 | 74 2c 20 66 6f 63 75 73 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 63 | t,.focus,.guestInstanceId).{...c |
1ff20 | 6f 6e 73 74 20 67 75 65 73 74 20 3d 20 67 65 74 47 75 65 73 74 28 67 75 65 73 74 49 6e 73 74 61 | onst.guest.=.getGuest(guestInsta |
1ff40 | 6e 63 65 49 64 29 0a 20 20 69 66 20 28 67 75 65 73 74 20 3d 3d 3d 20 65 76 65 6e 74 2e 73 65 6e | nceId)...if.(guest.===.event.sen |
1ff60 | 64 65 72 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 65 6d 69 74 28 27 66 6f | der).{.....event.sender.emit('fo |
1ff80 | 63 75 73 2d 63 68 61 6e 67 65 27 2c 20 7b 7d 2c 20 66 6f 63 75 73 2c 20 67 75 65 73 74 49 6e 73 | cus-change',.{},.focus,.guestIns |
1ffa0 | 74 61 6e 63 65 49 64 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e | tanceId)...}.else.{.....console. |
1ffc0 | 65 72 72 6f 72 28 60 66 6f 63 75 73 2d 63 68 61 6e 67 65 20 66 6f 72 20 67 75 65 73 74 49 6e 73 | error(`focus-change.for.guestIns |
1ffe0 | 74 61 6e 63 65 49 64 3a 20 24 7b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 7d 60 29 0a 20 20 | tanceId:.${guestInstanceId}`)... |
20000 | 7d 0a 7d 29 0a 0a 68 61 6e 64 6c 65 4d 65 73 73 61 67 65 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 | }.})..handleMessage('ELECTRON_GU |
20020 | 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 41 53 59 4e 43 5f 43 41 4c 4c 27 2c 20 66 75 | EST_VIEW_MANAGER_ASYNC_CALL',.fu |
20040 | 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 72 65 71 75 65 73 74 49 64 2c 20 67 75 65 73 74 49 | nction.(event,.requestId,.guestI |
20060 | 6e 73 74 61 6e 63 65 49 64 2c 20 6d 65 74 68 6f 64 2c 20 61 72 67 73 2c 20 68 61 73 43 61 6c 6c | nstanceId,.method,.args,.hasCall |
20080 | 62 61 63 6b 29 20 7b 0a 20 20 6e 65 77 20 50 72 6f 6d 69 73 65 28 72 65 73 6f 6c 76 65 20 3d 3e | back).{...new.Promise(resolve.=> |
200a0 | 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 67 75 65 73 74 20 3d 20 67 65 74 47 75 65 73 74 46 6f 72 | .{.....const.guest.=.getGuestFor |
200c0 | 57 65 62 43 6f 6e 74 65 6e 74 73 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 65 76 65 | WebContents(guestInstanceId,.eve |
200e0 | 6e 74 2e 73 65 6e 64 65 72 29 0a 20 20 20 20 69 66 20 28 21 61 73 79 6e 63 43 61 6c 6c 62 61 63 | nt.sender).....if.(!asyncCallbac |
20100 | 6b 4d 65 74 68 6f 64 73 2e 68 61 73 28 6d 65 74 68 6f 64 29 20 26 26 20 21 61 73 79 6e 63 50 72 | kMethods.has(method).&&.!asyncPr |
20120 | 6f 6d 69 73 65 4d 65 74 68 6f 64 73 2e 68 61 73 28 6d 65 74 68 6f 64 29 29 20 7b 0a 20 20 20 20 | omiseMethods.has(method)).{..... |
20140 | 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 60 49 6e 76 61 6c 69 64 20 6d 65 74 68 6f | ..throw.new.Error(`Invalid.metho |
20160 | 64 3a 20 24 7b 6d 65 74 68 6f 64 7d 60 29 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 28 68 61 73 | d:.${method}`).....}.....if.(has |
20180 | 43 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 67 75 65 73 74 5b 6d 65 74 68 6f 64 5d 28 | Callback).{.......guest[method]( |
201a0 | 2e 2e 2e 61 72 67 73 2c 20 72 65 73 6f 6c 76 65 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 | ...args,.resolve).....}.else.{.. |
201c0 | 20 20 20 20 20 72 65 73 6f 6c 76 65 28 67 75 65 73 74 5b 6d 65 74 68 6f 64 5d 28 2e 2e 2e 61 72 | .....resolve(guest[method](...ar |
201e0 | 67 73 29 29 0a 20 20 20 20 7d 0a 20 20 7d 29 2e 74 68 65 6e 28 72 65 73 75 6c 74 20 3d 3e 20 7b | gs)).....}...}).then(result.=>.{ |
20200 | 0a 20 20 20 20 72 65 74 75 72 6e 20 5b 6e 75 6c 6c 2c 20 72 65 73 75 6c 74 5d 0a 20 20 7d 2c 20 | .....return.[null,.result]...},. |
20220 | 65 72 72 6f 72 20 3d 3e 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 5b 65 72 72 6f 72 55 74 69 6c | error.=>.{.....return.[errorUtil |
20240 | 73 2e 73 65 72 69 61 6c 69 7a 65 28 65 72 72 6f 72 29 5d 0a 20 20 7d 29 2e 74 68 65 6e 28 72 65 | s.serialize(error)]...}).then(re |
20260 | 73 70 6f 6e 73 65 41 72 67 73 20 3d 3e 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 | sponseArgs.=>.{.....event.sender |
20280 | 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 | ._sendInternal(`ELECTRON_GUEST_V |
202a0 | 49 45 57 5f 4d 41 4e 41 47 45 52 5f 41 53 59 4e 43 5f 43 41 4c 4c 5f 52 45 53 50 4f 4e 53 45 5f | IEW_MANAGER_ASYNC_CALL_RESPONSE_ |
202c0 | 24 7b 72 65 71 75 65 73 74 49 64 7d 60 2c 20 2e 2e 2e 72 65 73 70 6f 6e 73 65 41 72 67 73 29 0a | ${requestId}`,....responseArgs). |
202e0 | 20 20 7d 29 0a 7d 29 0a 0a 68 61 6e 64 6c 65 4d 65 73 73 61 67 65 28 27 45 4c 45 43 54 52 4f 4e | ..}).})..handleMessage('ELECTRON |
20300 | 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 53 59 4e 43 5f 43 41 4c 4c 27 2c 20 | _GUEST_VIEW_MANAGER_SYNC_CALL',. |
20320 | 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 | function.(event,.guestInstanceId |
20340 | 2c 20 6d 65 74 68 6f 64 2c 20 61 72 67 73 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 63 6f | ,.method,.args).{...try.{.....co |
20360 | 6e 73 74 20 67 75 65 73 74 20 3d 20 67 65 74 47 75 65 73 74 46 6f 72 57 65 62 43 6f 6e 74 65 6e | nst.guest.=.getGuestForWebConten |
20380 | 74 73 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 | ts(guestInstanceId,.event.sender |
203a0 | 29 0a 20 20 20 20 69 66 20 28 21 73 79 6e 63 4d 65 74 68 6f 64 73 2e 68 61 73 28 6d 65 74 68 6f | ).....if.(!syncMethods.has(metho |
203c0 | 64 29 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 60 49 6e 76 | d)).{.......throw.new.Error(`Inv |
203e0 | 61 6c 69 64 20 6d 65 74 68 6f 64 3a 20 24 7b 6d 65 74 68 6f 64 7d 60 29 0a 20 20 20 20 7d 0a 20 | alid.method:.${method}`).....}.. |
20400 | 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 5b 6e 75 6c 6c 2c 20 67 75 | ...event.returnValue.=.[null,.gu |
20420 | 65 73 74 5b 6d 65 74 68 6f 64 5d 28 2e 2e 2e 61 72 67 73 29 5d 0a 20 20 7d 20 63 61 74 63 68 20 | est[method](...args)]...}.catch. |
20440 | 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 | (error).{.....event.returnValue. |
20460 | 3d 20 5b 65 72 72 6f 72 55 74 69 6c 73 2e 73 65 72 69 61 6c 69 7a 65 28 65 72 72 6f 72 29 5d 0a | =.[errorUtils.serialize(error)]. |
20480 | 20 20 7d 0a 7d 29 0a 0a 2f 2f 20 52 65 74 75 72 6e 73 20 57 65 62 43 6f 6e 74 65 6e 74 73 20 66 | ..}.})..//.Returns.WebContents.f |
204a0 | 72 6f 6d 20 69 74 73 20 67 75 65 73 74 20 69 64 20 68 6f 73 74 65 64 20 69 6e 20 67 69 76 65 6e | rom.its.guest.id.hosted.in.given |
204c0 | 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 0a 63 6f 6e 73 74 20 67 65 74 47 75 65 73 74 46 6f 72 57 | .webContents..const.getGuestForW |
204e0 | 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 67 75 65 73 74 49 6e 73 74 | ebContents.=.function.(guestInst |
20500 | 61 6e 63 65 49 64 2c 20 63 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 | anceId,.contents).{...const.gues |
20520 | 74 20 3d 20 67 65 74 47 75 65 73 74 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 | t.=.getGuest(guestInstanceId)... |
20540 | 69 66 20 28 21 67 75 65 73 74 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f | if.(!guest).{.....throw.new.Erro |
20560 | 72 28 60 49 6e 76 61 6c 69 64 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 3a 20 24 7b 67 75 | r(`Invalid.guestInstanceId:.${gu |
20580 | 65 73 74 49 6e 73 74 61 6e 63 65 49 64 7d 60 29 0a 20 20 7d 0a 20 20 69 66 20 28 67 75 65 73 74 | estInstanceId}`)...}...if.(guest |
205a0 | 2e 68 6f 73 74 57 65 62 43 6f 6e 74 65 6e 74 73 20 21 3d 3d 20 63 6f 6e 74 65 6e 74 73 29 20 7b | .hostWebContents.!==.contents).{ |
205c0 | 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 60 41 63 63 65 73 73 20 64 65 6e | .....throw.new.Error(`Access.den |
205e0 | 69 65 64 20 74 6f 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 3a 20 24 7b 67 75 65 73 74 49 | ied.to.guestInstanceId:.${guestI |
20600 | 6e 73 74 61 6e 63 65 49 64 7d 60 29 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 67 75 65 73 74 0a | nstanceId}`)...}...return.guest. |
20620 | 7d 0a 0a 2f 2f 20 52 65 74 75 72 6e 73 20 57 65 62 43 6f 6e 74 65 6e 74 73 20 66 72 6f 6d 20 69 | }..//.Returns.WebContents.from.i |
20640 | 74 73 20 67 75 65 73 74 20 69 64 2e 0a 63 6f 6e 73 74 20 67 65 74 47 75 65 73 74 20 3d 20 66 75 | ts.guest.id..const.getGuest.=.fu |
20660 | 6e 63 74 69 6f 6e 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 63 6f 6e | nction.(guestInstanceId).{...con |
20680 | 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 20 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 | st.guestInstance.=.guestInstance |
206a0 | 73 5b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 5d 0a 20 20 69 66 20 28 67 75 65 73 74 49 6e | s[guestInstanceId]...if.(guestIn |
206c0 | 73 74 61 6e 63 65 20 21 3d 20 6e 75 6c 6c 29 20 72 65 74 75 72 6e 20 67 75 65 73 74 49 6e 73 74 | stance.!=.null).return.guestInst |
206e0 | 61 6e 63 65 2e 67 75 65 73 74 0a 7d 0a 0a 2f 2f 20 52 65 74 75 72 6e 73 20 74 68 65 20 65 6d 62 | ance.guest.}..//.Returns.the.emb |
20700 | 65 64 64 65 72 20 6f 66 20 74 68 65 20 67 75 65 73 74 2e 0a 63 6f 6e 73 74 20 67 65 74 45 6d 62 | edder.of.the.guest..const.getEmb |
20720 | 65 64 64 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 | edder.=.function.(guestInstanceI |
20740 | 64 29 20 7b 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 20 3d 20 67 75 65 | d).{...const.guestInstance.=.gue |
20760 | 73 74 49 6e 73 74 61 6e 63 65 73 5b 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 5d 0a 20 20 69 | stInstances[guestInstanceId]...i |
20780 | 66 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 20 21 3d 20 6e 75 6c 6c 29 20 72 65 74 75 72 6e | f.(guestInstance.!=.null).return |
207a0 | 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 2e 65 6d 62 65 64 64 65 72 0a 7d 0a 0a 65 78 70 6f 72 | .guestInstance.embedder.}..expor |
207c0 | 74 73 2e 67 65 74 47 75 65 73 74 46 6f 72 57 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 67 65 74 47 | ts.getGuestForWebContents.=.getG |
207e0 | 75 65 73 74 46 6f 72 57 65 62 43 6f 6e 74 65 6e 74 73 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a | uestForWebContents.'use.strict'. |
20800 | 0a 63 6f 6e 73 74 20 7b 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2c 20 77 65 62 43 6f 6e 74 65 | .const.{.BrowserWindow,.webConte |
20820 | 6e 74 73 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 | nts.}.=.require('electron').cons |
20840 | 74 20 7b 20 69 73 53 61 6d 65 4f 72 69 67 69 6e 20 7d 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f | t.{.isSameOrigin.}.=.process.ato |
20860 | 6d 42 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 29 0a 63 6f 6e 73 74 20 69 70 63 4d 61 69 | mBinding('v8_util').const.ipcMai |
20880 | 6e 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f | n.=.require('@electron/internal/ |
208a0 | 62 72 6f 77 73 65 72 2f 69 70 63 2d 6d 61 69 6e 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 63 6f 6e 73 | browser/ipc-main-internal').cons |
208c0 | 74 20 70 61 72 73 65 46 65 61 74 75 72 65 73 53 74 72 69 6e 67 20 3d 20 72 65 71 75 69 72 65 28 | t.parseFeaturesString.=.require( |
208e0 | 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 70 61 72 73 65 | '@electron/internal/common/parse |
20900 | 2d 66 65 61 74 75 72 65 73 2d 73 74 72 69 6e 67 27 29 0a 0a 63 6f 6e 73 74 20 68 61 73 50 72 6f | -features-string')..const.hasPro |
20920 | 70 20 3d 20 7b 7d 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 0a 63 6f 6e 73 74 20 66 72 61 6d | p.=.{}.hasOwnProperty.const.fram |
20940 | 65 54 6f 47 75 65 73 74 20 3d 20 6e 65 77 20 4d 61 70 28 29 0a 0a 2f 2f 20 53 65 63 75 72 69 74 | eToGuest.=.new.Map()..//.Securit |
20960 | 79 20 6f 70 74 69 6f 6e 73 20 74 68 61 74 20 63 68 69 6c 64 20 77 69 6e 64 6f 77 73 20 77 69 6c | y.options.that.child.windows.wil |
20980 | 6c 20 61 6c 77 61 79 73 20 69 6e 68 65 72 69 74 20 66 72 6f 6d 20 70 61 72 65 6e 74 20 77 69 6e | l.always.inherit.from.parent.win |
209a0 | 64 6f 77 73 0a 63 6f 6e 73 74 20 69 6e 68 65 72 69 74 65 64 57 65 62 50 72 65 66 65 72 65 6e 63 | dows.const.inheritedWebPreferenc |
209c0 | 65 73 20 3d 20 6e 65 77 20 4d 61 70 28 5b 0a 20 20 5b 27 63 6f 6e 74 65 78 74 49 73 6f 6c 61 74 | es.=.new.Map([...['contextIsolat |
209e0 | 69 6f 6e 27 2c 20 74 72 75 65 5d 2c 0a 20 20 5b 27 6a 61 76 61 73 63 72 69 70 74 27 2c 20 66 61 | ion',.true],...['javascript',.fa |
20a00 | 6c 73 65 5d 2c 0a 20 20 5b 27 6e 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 27 2c 20 74 72 75 | lse],...['nativeWindowOpen',.tru |
20a20 | 65 5d 2c 0a 20 20 5b 27 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 27 2c 20 66 61 6c 73 65 5d | e],...['nodeIntegration',.false] |
20a40 | 2c 0a 20 20 5b 27 65 6e 61 62 6c 65 52 65 6d 6f 74 65 4d 6f 64 75 6c 65 27 2c 20 66 61 6c 73 65 | ,...['enableRemoteModule',.false |
20a60 | 5d 2c 0a 20 20 5b 27 73 61 6e 64 62 6f 78 27 2c 20 74 72 75 65 5d 2c 0a 20 20 5b 27 77 65 62 76 | ],...['sandbox',.true],...['webv |
20a80 | 69 65 77 54 61 67 27 2c 20 66 61 6c 73 65 5d 0a 5d 29 0a 0a 2f 2f 20 43 6f 70 79 20 61 74 74 72 | iewTag',.false].])..//.Copy.attr |
20aa0 | 69 62 75 74 65 20 6f 66 20 7c 70 61 72 65 6e 74 7c 20 74 6f 20 7c 63 68 69 6c 64 7c 20 69 66 20 | ibute.of.|parent|.to.|child|.if. |
20ac0 | 69 74 20 69 73 20 6e 6f 74 20 64 65 66 69 6e 65 64 20 69 6e 20 7c 63 68 69 6c 64 7c 2e 0a 63 6f | it.is.not.defined.in.|child|..co |
20ae0 | 6e 73 74 20 6d 65 72 67 65 4f 70 74 69 6f 6e 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 68 69 | nst.mergeOptions.=.function.(chi |
20b00 | 6c 64 2c 20 70 61 72 65 6e 74 2c 20 76 69 73 69 74 65 64 29 20 7b 0a 20 20 2f 2f 20 43 68 65 63 | ld,.parent,.visited).{...//.Chec |
20b20 | 6b 20 66 6f 72 20 63 69 72 63 75 6c 61 72 20 72 65 66 65 72 65 6e 63 65 2e 0a 20 20 69 66 20 28 | k.for.circular.reference....if.( |
20b40 | 76 69 73 69 74 65 64 20 3d 3d 20 6e 75 6c 6c 29 20 76 69 73 69 74 65 64 20 3d 20 6e 65 77 20 53 | visited.==.null).visited.=.new.S |
20b60 | 65 74 28 29 0a 20 20 69 66 20 28 76 69 73 69 74 65 64 2e 68 61 73 28 70 61 72 65 6e 74 29 29 20 | et()...if.(visited.has(parent)). |
20b80 | 72 65 74 75 72 6e 0a 0a 20 20 76 69 73 69 74 65 64 2e 61 64 64 28 70 61 72 65 6e 74 29 0a 20 20 | return....visited.add(parent)... |
20ba0 | 66 6f 72 20 28 63 6f 6e 73 74 20 6b 65 79 20 69 6e 20 70 61 72 65 6e 74 29 20 7b 0a 20 20 20 20 | for.(const.key.in.parent).{..... |
20bc0 | 69 66 20 28 6b 65 79 20 3d 3d 3d 20 27 69 73 42 72 6f 77 73 65 72 56 69 65 77 27 29 20 63 6f 6e | if.(key.===.'isBrowserView').con |
20be0 | 74 69 6e 75 65 0a 20 20 20 20 69 66 20 28 21 68 61 73 50 72 6f 70 2e 63 61 6c 6c 28 70 61 72 65 | tinue.....if.(!hasProp.call(pare |
20c00 | 6e 74 2c 20 6b 65 79 29 29 20 63 6f 6e 74 69 6e 75 65 0a 20 20 20 20 69 66 20 28 6b 65 79 20 69 | nt,.key)).continue.....if.(key.i |
20c20 | 6e 20 63 68 69 6c 64 20 26 26 20 6b 65 79 20 21 3d 3d 20 27 77 65 62 50 72 65 66 65 72 65 6e 63 | n.child.&&.key.!==.'webPreferenc |
20c40 | 65 73 27 29 20 63 6f 6e 74 69 6e 75 65 0a 0a 20 20 20 20 63 6f 6e 73 74 20 76 61 6c 75 65 20 3d | es').continue......const.value.= |
20c60 | 20 70 61 72 65 6e 74 5b 6b 65 79 5d 0a 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 76 61 6c 75 | .parent[key].....if.(typeof.valu |
20c80 | 65 20 3d 3d 3d 20 27 6f 62 6a 65 63 74 27 29 20 7b 0a 20 20 20 20 20 20 63 68 69 6c 64 5b 6b 65 | e.===.'object').{.......child[ke |
20ca0 | 79 5d 20 3d 20 6d 65 72 67 65 4f 70 74 69 6f 6e 73 28 63 68 69 6c 64 5b 6b 65 79 5d 20 7c 7c 20 | y].=.mergeOptions(child[key].||. |
20cc0 | 7b 7d 2c 20 76 61 6c 75 65 2c 20 76 69 73 69 74 65 64 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b | {},.value,.visited).....}.else.{ |
20ce0 | 0a 20 20 20 20 20 20 63 68 69 6c 64 5b 6b 65 79 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 7d 0a | .......child[key].=.value.....}. |
20d00 | 20 20 7d 0a 20 20 76 69 73 69 74 65 64 2e 64 65 6c 65 74 65 28 70 61 72 65 6e 74 29 0a 0a 20 20 | ..}...visited.delete(parent).... |
20d20 | 72 65 74 75 72 6e 20 63 68 69 6c 64 0a 7d 0a 0a 2f 2f 20 4d 65 72 67 65 20 7c 6f 70 74 69 6f 6e | return.child.}..//.Merge.|option |
20d40 | 73 7c 20 77 69 74 68 20 74 68 65 20 7c 65 6d 62 65 64 64 65 72 7c 27 73 20 77 69 6e 64 6f 77 27 | s|.with.the.|embedder|'s.window' |
20d60 | 73 20 6f 70 74 69 6f 6e 73 2e 0a 63 6f 6e 73 74 20 6d 65 72 67 65 42 72 6f 77 73 65 72 57 69 6e | s.options..const.mergeBrowserWin |
20d80 | 64 6f 77 4f 70 74 69 6f 6e 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 6d 62 65 64 64 65 72 2c | dowOptions.=.function.(embedder, |
20da0 | 20 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 | .options).{...if.(options.webPre |
20dc0 | 66 65 72 65 6e 63 65 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 6f 70 74 69 6f 6e 73 2e | ferences.==.null).{.....options. |
20de0 | 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d 20 7b 7d 0a 20 20 7d 0a 20 20 69 66 20 28 65 6d | webPreferences.=.{}...}...if.(em |
20e00 | 62 65 64 64 65 72 2e 62 72 6f 77 73 65 72 57 69 6e 64 6f 77 4f 70 74 69 6f 6e 73 20 21 3d 20 6e | bedder.browserWindowOptions.!=.n |
20e20 | 75 6c 6c 29 20 7b 0a 20 20 20 20 6c 65 74 20 70 61 72 65 6e 74 4f 70 74 69 6f 6e 73 20 3d 20 65 | ull).{.....let.parentOptions.=.e |
20e40 | 6d 62 65 64 64 65 72 2e 62 72 6f 77 73 65 72 57 69 6e 64 6f 77 4f 70 74 69 6f 6e 73 0a 0a 20 20 | mbedder.browserWindowOptions.... |
20e60 | 20 20 2f 2f 20 69 66 20 70 61 72 65 6e 74 27 73 20 76 69 73 69 62 69 6c 69 74 79 20 69 73 20 61 | ..//.if.parent's.visibility.is.a |
20e80 | 76 61 69 6c 61 62 6c 65 2c 20 74 68 61 74 20 6f 76 65 72 72 69 64 65 73 20 27 73 68 6f 77 27 20 | vailable,.that.overrides.'show'. |
20ea0 | 66 6c 61 67 20 28 23 31 32 31 32 35 29 0a 20 20 20 20 63 6f 6e 73 74 20 77 69 6e 20 3d 20 42 72 | flag.(#12125).....const.win.=.Br |
20ec0 | 6f 77 73 65 72 57 69 6e 64 6f 77 2e 66 72 6f 6d 57 65 62 43 6f 6e 74 65 6e 74 73 28 65 6d 62 65 | owserWindow.fromWebContents(embe |
20ee0 | 64 64 65 72 2e 77 65 62 43 6f 6e 74 65 6e 74 73 29 0a 20 20 20 20 69 66 20 28 77 69 6e 20 21 3d | dder.webContents).....if.(win.!= |
20f00 | 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 70 61 72 65 6e 74 4f 70 74 69 6f 6e 73 20 3d 20 7b | .null).{.......parentOptions.=.{ |
20f20 | 20 2e 2e 2e 65 6d 62 65 64 64 65 72 2e 62 72 6f 77 73 65 72 57 69 6e 64 6f 77 4f 70 74 69 6f 6e | ....embedder.browserWindowOption |
20f40 | 73 2c 20 73 68 6f 77 3a 20 77 69 6e 2e 69 73 56 69 73 69 62 6c 65 28 29 20 7d 0a 20 20 20 20 7d | s,.show:.win.isVisible().}.....} |
20f60 | 0a 0a 20 20 20 20 2f 2f 20 49 6e 68 65 72 69 74 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 6f 70 | ......//.Inherit.the.original.op |
20f80 | 74 69 6f 6e 73 20 69 66 20 69 74 20 69 73 20 61 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 0a | tions.if.it.is.a.BrowserWindow.. |
20fa0 | 20 20 20 20 6d 65 72 67 65 4f 70 74 69 6f 6e 73 28 6f 70 74 69 6f 6e 73 2c 20 70 61 72 65 6e 74 | ....mergeOptions(options,.parent |
20fc0 | 4f 70 74 69 6f 6e 73 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 2f 2f 20 4f 72 20 6f 6e | Options)...}.else.{.....//.Or.on |
20fe0 | 6c 79 20 69 6e 68 65 72 69 74 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 69 66 20 69 74 20 | ly.inherit.webPreferences.if.it. |
21000 | 69 73 20 61 20 77 65 62 76 69 65 77 2e 0a 20 20 20 20 6d 65 72 67 65 4f 70 74 69 6f 6e 73 28 6f | is.a.webview......mergeOptions(o |
21020 | 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2c 20 65 6d 62 65 64 64 65 72 2e | ptions.webPreferences,.embedder. |
21040 | 67 65 74 4c 61 73 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 28 29 29 0a 20 20 7d 0a 0a 20 20 | getLastWebPreferences())...}.... |
21060 | 2f 2f 20 49 6e 68 65 72 69 74 20 63 65 72 74 61 69 6e 20 6f 70 74 69 6f 6e 20 76 61 6c 75 65 73 | //.Inherit.certain.option.values |
21080 | 20 66 72 6f 6d 20 70 61 72 65 6e 74 20 77 69 6e 64 6f 77 0a 20 20 63 6f 6e 73 74 20 77 65 62 50 | .from.parent.window...const.webP |
210a0 | 72 65 66 65 72 65 6e 63 65 73 20 3d 20 65 6d 62 65 64 64 65 72 2e 67 65 74 4c 61 73 74 57 65 62 | references.=.embedder.getLastWeb |
210c0 | 50 72 65 66 65 72 65 6e 63 65 73 28 29 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 5b 6e 61 6d 65 | Preferences()...for.(const.[name |
210e0 | 2c 20 76 61 6c 75 65 5d 20 6f 66 20 69 6e 68 65 72 69 74 65 64 57 65 62 50 72 65 66 65 72 65 6e | ,.value].of.inheritedWebPreferen |
21100 | 63 65 73 29 20 7b 0a 20 20 20 20 69 66 20 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 5b 6e 61 | ces).{.....if.(webPreferences[na |
21120 | 6d 65 5d 20 3d 3d 3d 20 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 2e 77 | me].===.value).{.......options.w |
21140 | 65 62 50 72 65 66 65 72 65 6e 63 65 73 5b 6e 61 6d 65 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 | ebPreferences[name].=.value..... |
21160 | 7d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 53 65 74 73 20 63 6f 72 72 65 63 74 20 6f 70 65 6e 65 72 49 | }...}....//.Sets.correct.openerI |
21180 | 64 20 68 65 72 65 20 74 6f 20 67 69 76 65 20 63 6f 72 72 65 63 74 20 6f 70 74 69 6f 6e 73 20 74 | d.here.to.give.correct.options.t |
211a0 | 6f 20 27 6e 65 77 2d 77 69 6e 64 6f 77 27 20 65 76 65 6e 74 20 68 61 6e 64 6c 65 72 0a 20 20 6f | o.'new-window'.event.handler...o |
211c0 | 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2e 6f 70 65 6e 65 72 49 64 20 3d | ptions.webPreferences.openerId.= |
211e0 | 20 65 6d 62 65 64 64 65 72 2e 69 64 0a 0a 20 20 72 65 74 75 72 6e 20 6f 70 74 69 6f 6e 73 0a 7d | .embedder.id....return.options.} |
21200 | 0a 0a 2f 2f 20 53 65 74 75 70 20 61 20 6e 65 77 20 67 75 65 73 74 20 77 69 74 68 20 7c 65 6d 62 | ..//.Setup.a.new.guest.with.|emb |
21220 | 65 64 64 65 72 7c 0a 63 6f 6e 73 74 20 73 65 74 75 70 47 75 65 73 74 20 3d 20 66 75 6e 63 74 69 | edder|.const.setupGuest.=.functi |
21240 | 6f 6e 20 28 65 6d 62 65 64 64 65 72 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 67 75 65 73 74 2c 20 | on.(embedder,.frameName,.guest,. |
21260 | 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 2f 2f 20 57 68 65 6e 20 7c 65 6d 62 65 64 64 65 72 7c 20 | options).{...//.When.|embedder|. |
21280 | 69 73 20 64 65 73 74 72 6f 79 65 64 20 77 65 20 73 68 6f 75 6c 64 20 61 6c 73 6f 20 64 65 73 74 | is.destroyed.we.should.also.dest |
212a0 | 72 6f 79 20 61 74 74 61 63 68 65 64 20 67 75 65 73 74 2c 20 61 6e 64 20 69 66 0a 20 20 2f 2f 20 | roy.attached.guest,.and.if...//. |
212c0 | 67 75 65 73 74 20 69 73 20 63 6c 6f 73 65 64 20 62 79 20 75 73 65 72 20 74 68 65 6e 20 77 65 20 | guest.is.closed.by.user.then.we. |
212e0 | 73 68 6f 75 6c 64 20 70 72 65 76 65 6e 74 20 7c 65 6d 62 65 64 64 65 72 7c 20 66 72 6f 6d 20 64 | should.prevent.|embedder|.from.d |
21300 | 6f 75 62 6c 65 0a 20 20 2f 2f 20 63 6c 6f 73 69 6e 67 20 67 75 65 73 74 2e 0a 20 20 63 6f 6e 73 | ouble...//.closing.guest....cons |
21320 | 74 20 67 75 65 73 74 49 64 20 3d 20 67 75 65 73 74 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 64 | t.guestId.=.guest.webContents.id |
21340 | 0a 20 20 63 6f 6e 73 74 20 63 6c 6f 73 65 64 42 79 45 6d 62 65 64 64 65 72 20 3d 20 66 75 6e 63 | ...const.closedByEmbedder.=.func |
21360 | 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 67 75 65 73 74 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e | tion.().{.....guest.removeListen |
21380 | 65 72 28 27 63 6c 6f 73 65 64 27 2c 20 63 6c 6f 73 65 64 42 79 55 73 65 72 29 0a 20 20 20 20 67 | er('closed',.closedByUser).....g |
213a0 | 75 65 73 74 2e 64 65 73 74 72 6f 79 28 29 0a 20 20 7d 0a 20 20 63 6f 6e 73 74 20 63 6c 6f 73 65 | uest.destroy()...}...const.close |
213c0 | 64 42 79 55 73 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 65 6d 62 65 | dByUser.=.function.().{.....embe |
213e0 | 64 64 65 72 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 | dder._sendInternal('ELECTRON_GUE |
21400 | 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f 43 4c 4f 53 45 44 5f | ST_WINDOW_MANAGER_WINDOW_CLOSED_ |
21420 | 27 20 2b 20 67 75 65 73 74 49 64 29 0a 20 20 20 20 65 6d 62 65 64 64 65 72 2e 72 65 6d 6f 76 65 | '.+.guestId).....embedder.remove |
21440 | 4c 69 73 74 65 6e 65 72 28 27 72 65 6e 64 65 72 2d 76 69 65 77 2d 64 65 6c 65 74 65 64 27 2c 20 | Listener('render-view-deleted',. |
21460 | 63 6c 6f 73 65 64 42 79 45 6d 62 65 64 64 65 72 29 0a 20 20 7d 0a 20 20 65 6d 62 65 64 64 65 72 | closedByEmbedder)...}...embedder |
21480 | 2e 6f 6e 63 65 28 27 72 65 6e 64 65 72 2d 76 69 65 77 2d 64 65 6c 65 74 65 64 27 2c 20 63 6c 6f | .once('render-view-deleted',.clo |
214a0 | 73 65 64 42 79 45 6d 62 65 64 64 65 72 29 0a 20 20 67 75 65 73 74 2e 6f 6e 63 65 28 27 63 6c 6f | sedByEmbedder)...guest.once('clo |
214c0 | 73 65 64 27 2c 20 63 6c 6f 73 65 64 42 79 55 73 65 72 29 0a 20 20 69 66 20 28 66 72 61 6d 65 4e | sed',.closedByUser)...if.(frameN |
214e0 | 61 6d 65 29 20 7b 0a 20 20 20 20 66 72 61 6d 65 54 6f 47 75 65 73 74 2e 73 65 74 28 66 72 61 6d | ame).{.....frameToGuest.set(fram |
21500 | 65 4e 61 6d 65 2c 20 67 75 65 73 74 29 0a 20 20 20 20 67 75 65 73 74 2e 66 72 61 6d 65 4e 61 6d | eName,.guest).....guest.frameNam |
21520 | 65 20 3d 20 66 72 61 6d 65 4e 61 6d 65 0a 20 20 20 20 67 75 65 73 74 2e 6f 6e 63 65 28 27 63 6c | e.=.frameName.....guest.once('cl |
21540 | 6f 73 65 64 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 66 72 61 6d 65 | osed',.function.().{.......frame |
21560 | 54 6f 47 75 65 73 74 2e 64 65 6c 65 74 65 28 66 72 61 6d 65 4e 61 6d 65 29 0a 20 20 20 20 7d 29 | ToGuest.delete(frameName).....}) |
21580 | 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 67 75 65 73 74 49 64 0a 7d 0a 0a 2f 2f 20 43 72 65 61 | ...}...return.guestId.}..//.Crea |
215a0 | 74 65 20 61 20 6e 65 77 20 67 75 65 73 74 20 63 72 65 61 74 65 64 20 62 79 20 7c 65 6d 62 65 64 | te.a.new.guest.created.by.|embed |
215c0 | 64 65 72 7c 20 77 69 74 68 20 7c 6f 70 74 69 6f 6e 73 7c 2e 0a 63 6f 6e 73 74 20 63 72 65 61 74 | der|.with.|options|..const.creat |
215e0 | 65 47 75 65 73 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 6d 62 65 64 64 65 72 2c 20 75 72 6c | eGuest.=.function.(embedder,.url |
21600 | 2c 20 72 65 66 65 72 72 65 72 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 6f 70 74 69 6f 6e 73 2c 20 | ,.referrer,.frameName,.options,. |
21620 | 70 6f 73 74 44 61 74 61 29 20 7b 0a 20 20 6c 65 74 20 67 75 65 73 74 20 3d 20 66 72 61 6d 65 54 | postData).{...let.guest.=.frameT |
21640 | 6f 47 75 65 73 74 2e 67 65 74 28 66 72 61 6d 65 4e 61 6d 65 29 0a 20 20 69 66 20 28 66 72 61 6d | oGuest.get(frameName)...if.(fram |
21660 | 65 4e 61 6d 65 20 26 26 20 28 67 75 65 73 74 20 21 3d 20 6e 75 6c 6c 29 29 20 7b 0a 20 20 20 20 | eName.&&.(guest.!=.null)).{..... |
21680 | 67 75 65 73 74 2e 6c 6f 61 64 55 52 4c 28 75 72 6c 29 0a 20 20 20 20 72 65 74 75 72 6e 20 67 75 | guest.loadURL(url).....return.gu |
216a0 | 65 73 74 2e 77 65 62 43 6f 6e 74 65 6e 74 73 2e 69 64 0a 20 20 7d 0a 0a 20 20 2f 2f 20 52 65 6d | est.webContents.id...}....//.Rem |
216c0 | 65 6d 62 65 72 20 74 68 65 20 65 6d 62 65 64 64 65 72 20 77 69 6e 64 6f 77 27 73 20 69 64 2e 0a | ember.the.embedder.window's.id.. |
216e0 | 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d 3d 20 | ..if.(options.webPreferences.==. |
21700 | 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 6f 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 66 65 72 65 6e 63 | null).{.....options.webPreferenc |
21720 | 65 73 20 3d 20 7b 7d 0a 20 20 7d 0a 0a 20 20 67 75 65 73 74 20 3d 20 6e 65 77 20 42 72 6f 77 73 | es.=.{}...}....guest.=.new.Brows |
21740 | 65 72 57 69 6e 64 6f 77 28 6f 70 74 69 6f 6e 73 29 0a 20 20 69 66 20 28 21 6f 70 74 69 6f 6e 73 | erWindow(options)...if.(!options |
21760 | 2e 77 65 62 43 6f 6e 74 65 6e 74 73 20 7c 7c 20 75 72 6c 20 21 3d 3d 20 27 61 62 6f 75 74 3a 62 | .webContents.||.url.!==.'about:b |
21780 | 6c 61 6e 6b 27 29 20 7b 0a 20 20 20 20 2f 2f 20 57 65 20 73 68 6f 75 6c 64 20 6e 6f 74 20 63 61 | lank').{.....//.We.should.not.ca |
217a0 | 6c 6c 20 60 6c 6f 61 64 55 52 4c 60 20 69 66 20 74 68 65 20 77 69 6e 64 6f 77 20 77 61 73 20 63 | ll.`loadURL`.if.the.window.was.c |
217c0 | 6f 6e 73 74 72 75 63 74 65 64 20 66 72 6f 6d 20 61 6e 0a 20 20 20 20 2f 2f 20 65 78 69 73 74 69 | onstructed.from.an.....//.existi |
217e0 | 6e 67 20 77 65 62 43 6f 6e 74 65 6e 74 73 28 77 69 6e 64 6f 77 2e 6f 70 65 6e 20 69 6e 20 61 20 | ng.webContents(window.open.in.a. |
21800 | 73 61 6e 64 62 6f 78 65 64 20 72 65 6e 64 65 72 65 72 29 20 61 6e 64 20 69 66 20 74 68 65 20 75 | sandboxed.renderer).and.if.the.u |
21820 | 72 6c 0a 20 20 20 20 2f 2f 20 69 73 20 6e 6f 74 20 27 61 62 6f 75 74 3a 62 6c 61 6e 6b 27 2e 0a | rl.....//.is.not.'about:blank'.. |
21840 | 20 20 20 20 2f 2f 0a 20 20 20 20 2f 2f 20 4e 61 76 69 67 61 74 69 6e 67 20 74 6f 20 74 68 65 20 | ....//.....//.Navigating.to.the. |
21860 | 75 72 6c 20 77 68 65 6e 20 63 72 65 61 74 69 6e 67 20 74 68 65 20 77 69 6e 64 6f 77 20 66 72 6f | url.when.creating.the.window.fro |
21880 | 6d 20 61 6e 20 65 78 69 73 74 69 6e 67 0a 20 20 20 20 2f 2f 20 77 65 62 43 6f 6e 74 65 6e 74 73 | m.an.existing.....//.webContents |
218a0 | 20 77 6f 75 6c 64 20 6e 6f 74 20 62 65 20 6e 65 63 65 73 73 61 72 79 28 69 74 20 77 69 6c 6c 20 | .would.not.be.necessary(it.will. |
218c0 | 6e 61 76 69 67 61 74 65 20 74 68 65 72 65 20 61 6e 79 77 61 79 29 2c 20 62 75 74 0a 20 20 20 20 | navigate.there.anyway),.but..... |
218e0 | 2f 2f 20 61 70 70 61 72 65 6e 74 6c 79 20 74 68 65 72 65 27 73 20 61 20 62 75 67 20 74 68 61 74 | //.apparently.there's.a.bug.that |
21900 | 20 61 6c 6c 6f 77 73 20 74 68 65 20 63 68 69 6c 64 20 77 69 6e 64 6f 77 20 74 6f 20 62 65 20 73 | .allows.the.child.window.to.be.s |
21920 | 63 72 69 70 74 65 64 20 62 79 0a 20 20 20 20 2f 2f 20 74 68 65 20 6f 70 65 6e 65 72 2c 20 65 76 | cripted.by.....//.the.opener,.ev |
21940 | 65 6e 20 77 68 65 6e 20 74 68 65 20 63 68 69 6c 64 20 77 69 6e 64 6f 77 20 69 73 20 66 72 6f 6d | en.when.the.child.window.is.from |
21960 | 20 61 6e 6f 74 68 65 72 20 6f 72 69 67 69 6e 2e 0a 20 20 20 20 2f 2f 0a 20 20 20 20 2f 2f 20 54 | .another.origin......//.....//.T |
21980 | 68 61 74 27 73 20 77 68 79 20 74 68 65 20 73 65 63 6f 6e 64 20 63 6f 6e 64 69 74 69 6f 6e 28 75 | hat's.why.the.second.condition(u |
219a0 | 72 6c 20 21 3d 3d 20 22 61 62 6f 75 74 3a 62 6c 61 6e 6b 22 29 20 69 73 20 72 65 71 75 69 72 65 | rl.!==."about:blank").is.require |
219c0 | 64 3a 20 74 6f 0a 20 20 20 20 2f 2f 20 66 6f 72 63 65 20 60 4f 76 65 72 72 69 64 65 53 69 74 65 | d:.to.....//.force.`OverrideSite |
219e0 | 49 6e 73 74 61 6e 63 65 46 6f 72 4e 61 76 69 67 61 74 69 6f 6e 60 20 74 6f 20 62 65 20 63 61 6c | InstanceForNavigation`.to.be.cal |
21a00 | 6c 65 64 20 61 6e 64 20 63 6f 6e 73 65 71 75 65 6e 74 6c 79 0a 20 20 20 20 2f 2f 20 73 70 61 77 | led.and.consequently.....//.spaw |
21a20 | 6e 20 61 20 6e 65 77 20 72 65 6e 64 65 72 65 72 20 69 66 20 74 68 65 20 6e 65 77 20 77 69 6e 64 | n.a.new.renderer.if.the.new.wind |
21a40 | 6f 77 20 69 73 20 74 61 72 67 65 74 69 6e 67 20 61 20 64 69 66 66 65 72 65 6e 74 20 6f 72 69 67 | ow.is.targeting.a.different.orig |
21a60 | 69 6e 2e 0a 20 20 20 20 2f 2f 0a 20 20 20 20 2f 2f 20 49 66 20 74 68 65 20 55 52 4c 20 69 73 20 | in......//.....//.If.the.URL.is. |
21a80 | 22 61 62 6f 75 74 3a 62 6c 61 6e 6b 22 2c 20 74 68 65 6e 20 69 74 20 69 73 20 76 65 72 79 20 6c | "about:blank",.then.it.is.very.l |
21aa0 | 69 6b 65 6c 79 20 74 68 61 74 20 74 68 65 20 6f 70 65 6e 65 72 20 6a 75 73 74 0a 20 20 20 20 2f | ikely.that.the.opener.just...../ |
21ac0 | 2f 20 77 61 6e 74 73 20 74 6f 20 73 79 6e 63 68 72 6f 6e 6f 75 73 6c 79 20 73 63 72 69 70 74 20 | /.wants.to.synchronously.script. |
21ae0 | 74 68 65 20 70 6f 70 75 70 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 3a 0a 20 20 20 20 2f 2f 0a 20 | the.popup,.for.example:.....//.. |
21b00 | 20 20 20 2f 2f 20 20 20 20 20 6c 65 74 20 70 6f 70 75 70 20 3d 20 77 69 6e 64 6f 77 2e 6f 70 65 | ...//.....let.popup.=.window.ope |
21b20 | 6e 28 29 0a 20 20 20 20 2f 2f 20 20 20 20 20 70 6f 70 75 70 2e 64 6f 63 75 6d 65 6e 74 2e 62 6f | n().....//.....popup.document.bo |
21b40 | 64 79 2e 77 72 69 74 65 28 27 3c 68 31 3e 68 65 6c 6c 6f 3c 2f 68 31 3e 27 29 0a 20 20 20 20 2f | dy.write('<h1>hello</h1>')...../ |
21b60 | 2f 0a 20 20 20 20 2f 2f 20 54 68 65 20 61 62 6f 76 65 20 63 6f 64 65 20 77 6f 75 6c 64 20 6e 6f | /.....//.The.above.code.would.no |
21b80 | 74 20 77 6f 72 6b 20 69 66 20 61 20 6e 61 76 69 67 61 74 69 6f 6e 20 74 6f 20 22 61 62 6f 75 74 | t.work.if.a.navigation.to."about |
21ba0 | 3a 62 6c 61 6e 6b 22 20 69 73 20 64 6f 6e 65 0a 20 20 20 20 2f 2f 20 68 65 72 65 2c 20 73 69 6e | :blank".is.done.....//.here,.sin |
21bc0 | 63 65 20 74 68 65 20 77 69 6e 64 6f 77 20 77 6f 75 6c 64 20 62 65 20 63 6c 65 61 72 65 64 20 6f | ce.the.window.would.be.cleared.o |
21be0 | 66 20 61 6c 6c 20 63 68 61 6e 67 65 73 20 69 6e 20 74 68 65 20 6e 65 78 74 20 74 69 63 6b 2e 0a | f.all.changes.in.the.next.tick.. |
21c00 | 20 20 20 20 63 6f 6e 73 74 20 6c 6f 61 64 4f 70 74 69 6f 6e 73 20 3d 20 7b 0a 20 20 20 20 20 20 | ....const.loadOptions.=.{....... |
21c20 | 68 74 74 70 52 65 66 65 72 72 65 72 3a 20 72 65 66 65 72 72 65 72 0a 20 20 20 20 7d 0a 20 20 20 | httpReferrer:.referrer.....}.... |
21c40 | 20 69 66 20 28 70 6f 73 74 44 61 74 61 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 6c | .if.(postData.!=.null).{.......l |
21c60 | 6f 61 64 4f 70 74 69 6f 6e 73 2e 70 6f 73 74 44 61 74 61 20 3d 20 70 6f 73 74 44 61 74 61 0a 20 | oadOptions.postData.=.postData.. |
21c80 | 20 20 20 20 20 6c 6f 61 64 4f 70 74 69 6f 6e 73 2e 65 78 74 72 61 48 65 61 64 65 72 73 20 3d 20 | .....loadOptions.extraHeaders.=. |
21ca0 | 27 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3a 20 61 70 70 6c 69 63 61 74 69 6f 6e 2f 78 2d 77 77 77 | 'content-type:.application/x-www |
21cc0 | 2d 66 6f 72 6d 2d 75 72 6c 65 6e 63 6f 64 65 64 27 0a 20 20 20 20 20 20 69 66 20 28 70 6f 73 74 | -form-urlencoded'.......if.(post |
21ce0 | 44 61 74 61 2e 6c 65 6e 67 74 68 20 3e 20 30 29 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 | Data.length.>.0).{.........const |
21d00 | 20 70 6f 73 74 44 61 74 61 46 72 6f 6e 74 20 3d 20 70 6f 73 74 44 61 74 61 5b 30 5d 2e 62 79 74 | .postDataFront.=.postData[0].byt |
21d20 | 65 73 2e 74 6f 53 74 72 69 6e 67 28 29 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 62 6f 75 6e | es.toString().........const.boun |
21d40 | 64 61 72 79 20 3d 20 2f 5e 2d 2d 2e 2a 5b 5e 2d 5c 72 5c 6e 5d 2f 2e 65 78 65 63 28 70 6f 73 74 | dary.=./^--.*[^-\r\n]/.exec(post |
21d60 | 44 61 74 61 46 72 6f 6e 74 29 0a 20 20 20 20 20 20 20 20 69 66 20 28 62 6f 75 6e 64 61 72 79 20 | DataFront).........if.(boundary. |
21d80 | 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 6c 6f 61 64 4f 70 74 69 6f 6e 73 | !=.null).{...........loadOptions |
21da0 | 2e 65 78 74 72 61 48 65 61 64 65 72 73 20 3d 20 60 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3a 20 6d | .extraHeaders.=.`content-type:.m |
21dc0 | 75 6c 74 69 70 61 72 74 2f 66 6f 72 6d 2d 64 61 74 61 3b 20 62 6f 75 6e 64 61 72 79 3d 24 7b 62 | ultipart/form-data;.boundary=${b |
21de0 | 6f 75 6e 64 61 72 79 5b 30 5d 2e 73 75 62 73 74 72 28 32 29 7d 60 0a 20 20 20 20 20 20 20 20 7d | oundary[0].substr(2)}`.........} |
21e00 | 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 20 20 67 75 65 73 74 2e 6c 6f 61 64 55 52 4c | .......}.....}.....guest.loadURL |
21e20 | 28 75 72 6c 2c 20 6c 6f 61 64 4f 70 74 69 6f 6e 73 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e | (url,.loadOptions)...}....return |
21e40 | 20 73 65 74 75 70 47 75 65 73 74 28 65 6d 62 65 64 64 65 72 2c 20 66 72 61 6d 65 4e 61 6d 65 2c | .setupGuest(embedder,.frameName, |
21e60 | 20 67 75 65 73 74 2c 20 6f 70 74 69 6f 6e 73 29 0a 7d 0a 0a 63 6f 6e 73 74 20 67 65 74 47 75 65 | .guest,.options).}..const.getGue |
21e80 | 73 74 57 69 6e 64 6f 77 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 67 75 65 73 74 43 6f 6e 74 65 6e | stWindow.=.function.(guestConten |
21ea0 | 74 73 29 20 7b 0a 20 20 6c 65 74 20 67 75 65 73 74 57 69 6e 64 6f 77 20 3d 20 42 72 6f 77 73 65 | ts).{...let.guestWindow.=.Browse |
21ec0 | 72 57 69 6e 64 6f 77 2e 66 72 6f 6d 57 65 62 43 6f 6e 74 65 6e 74 73 28 67 75 65 73 74 43 6f 6e | rWindow.fromWebContents(guestCon |
21ee0 | 74 65 6e 74 73 29 0a 20 20 69 66 20 28 67 75 65 73 74 57 69 6e 64 6f 77 20 3d 3d 20 6e 75 6c 6c | tents)...if.(guestWindow.==.null |
21f00 | 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 68 6f 73 74 43 6f 6e 74 65 6e 74 73 20 3d 20 67 75 65 | ).{.....const.hostContents.=.gue |
21f20 | 73 74 43 6f 6e 74 65 6e 74 73 2e 68 6f 73 74 57 65 62 43 6f 6e 74 65 6e 74 73 0a 20 20 20 20 69 | stContents.hostWebContents.....i |
21f40 | 66 20 28 68 6f 73 74 43 6f 6e 74 65 6e 74 73 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 | f.(hostContents.!=.null).{...... |
21f60 | 20 67 75 65 73 74 57 69 6e 64 6f 77 20 3d 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 2e 66 72 6f | .guestWindow.=.BrowserWindow.fro |
21f80 | 6d 57 65 62 43 6f 6e 74 65 6e 74 73 28 68 6f 73 74 43 6f 6e 74 65 6e 74 73 29 0a 20 20 20 20 7d | mWebContents(hostContents).....} |
21fa0 | 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 67 75 65 73 74 57 69 6e 64 6f 77 0a 7d 0a 0a 63 6f 6e | ...}...return.guestWindow.}..con |
21fc0 | 73 74 20 69 73 43 68 69 6c 64 57 69 6e 64 6f 77 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 65 6e | st.isChildWindow.=.function.(sen |
21fe0 | 64 65 72 2c 20 74 61 72 67 65 74 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 74 61 72 67 65 74 2e 67 | der,.target).{...return.target.g |
22000 | 65 74 4c 61 73 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 28 29 2e 6f 70 65 6e 65 72 49 64 20 | etLastWebPreferences().openerId. |
22020 | 3d 3d 3d 20 73 65 6e 64 65 72 2e 69 64 0a 7d 0a 0a 63 6f 6e 73 74 20 69 73 52 65 6c 61 74 65 64 | ===.sender.id.}..const.isRelated |
22040 | 57 69 6e 64 6f 77 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 65 6e 64 65 72 2c 20 74 61 72 67 65 | Window.=.function.(sender,.targe |
22060 | 74 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 69 73 43 68 69 6c 64 57 69 6e 64 6f 77 28 73 65 6e 64 | t).{...return.isChildWindow(send |
22080 | 65 72 2c 20 74 61 72 67 65 74 29 20 7c 7c 20 69 73 43 68 69 6c 64 57 69 6e 64 6f 77 28 74 61 72 | er,.target).||.isChildWindow(tar |
220a0 | 67 65 74 2c 20 73 65 6e 64 65 72 29 0a 7d 0a 0a 63 6f 6e 73 74 20 69 73 53 63 72 69 70 74 61 62 | get,.sender).}..const.isScriptab |
220c0 | 6c 65 57 69 6e 64 6f 77 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 65 6e 64 65 72 2c 20 74 61 72 | leWindow.=.function.(sender,.tar |
220e0 | 67 65 74 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 69 73 52 65 6c 61 74 65 64 57 69 6e 64 6f 77 28 | get).{...return.isRelatedWindow( |
22100 | 73 65 6e 64 65 72 2c 20 74 61 72 67 65 74 29 20 26 26 20 69 73 53 61 6d 65 4f 72 69 67 69 6e 28 | sender,.target).&&.isSameOrigin( |
22120 | 73 65 6e 64 65 72 2e 67 65 74 55 52 4c 28 29 2c 20 74 61 72 67 65 74 2e 67 65 74 55 52 4c 28 29 | sender.getURL(),.target.getURL() |
22140 | 29 0a 7d 0a 0a 63 6f 6e 73 74 20 69 73 4e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 45 6e 61 62 | ).}..const.isNodeIntegrationEnab |
22160 | 6c 65 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 65 6e 64 65 72 29 20 7b 0a 20 20 72 65 74 75 | led.=.function.(sender).{...retu |
22180 | 72 6e 20 73 65 6e 64 65 72 2e 67 65 74 4c 61 73 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 28 | rn.sender.getLastWebPreferences( |
221a0 | 29 2e 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 20 3d 3d 3d 20 74 72 75 65 0a 7d 0a 0a 2f 2f | ).nodeIntegration.===.true.}..// |
221c0 | 20 43 68 65 63 6b 73 20 77 68 65 74 68 65 72 20 7c 73 65 6e 64 65 72 7c 20 63 61 6e 20 61 63 63 | .Checks.whether.|sender|.can.acc |
221e0 | 65 73 73 20 74 68 65 20 7c 74 61 72 67 65 74 7c 3a 0a 63 6f 6e 73 74 20 63 61 6e 41 63 63 65 73 | ess.the.|target|:.const.canAcces |
22200 | 73 57 69 6e 64 6f 77 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 65 6e 64 65 72 2c 20 74 61 72 67 | sWindow.=.function.(sender,.targ |
22220 | 65 74 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 69 73 43 68 69 6c 64 57 69 6e 64 6f 77 28 73 65 6e | et).{...return.isChildWindow(sen |
22240 | 64 65 72 2c 20 74 61 72 67 65 74 29 20 7c 7c 0a 20 20 20 20 20 20 20 20 20 69 73 53 63 72 69 70 | der,.target).||..........isScrip |
22260 | 74 61 62 6c 65 57 69 6e 64 6f 77 28 73 65 6e 64 65 72 2c 20 74 61 72 67 65 74 29 20 7c 7c 0a 20 | tableWindow(sender,.target).||.. |
22280 | 20 20 20 20 20 20 20 20 69 73 4e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 45 6e 61 62 6c 65 64 | ........isNodeIntegrationEnabled |
222a0 | 28 73 65 6e 64 65 72 29 0a 7d 0a 0a 2f 2f 20 52 6f 75 74 65 64 20 77 69 6e 64 6f 77 2e 6f 70 65 | (sender).}..//.Routed.window.ope |
222c0 | 6e 20 6d 65 73 73 61 67 65 73 20 77 69 74 68 20 72 61 77 20 6f 70 74 69 6f 6e 73 0a 69 70 63 4d | n.messages.with.raw.options.ipcM |
222e0 | 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 | ain.on('ELECTRON_GUEST_WINDOW_MA |
22300 | 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f 4f 50 45 4e 27 2c 20 28 65 76 65 6e 74 2c 20 75 72 6c 2c | NAGER_WINDOW_OPEN',.(event,.url, |
22320 | 20 66 72 61 6d 65 4e 61 6d 65 2c 20 66 65 61 74 75 72 65 73 29 20 3d 3e 20 7b 0a 20 20 69 66 20 | .frameName,.features).=>.{...if. |
22340 | 28 75 72 6c 20 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 75 72 6c 20 3d 3d 3d 20 27 27 29 20 75 72 6c 20 | (url.==.null.||.url.===.'').url. |
22360 | 3d 20 27 61 62 6f 75 74 3a 62 6c 61 6e 6b 27 0a 20 20 69 66 20 28 66 72 61 6d 65 4e 61 6d 65 20 | =.'about:blank'...if.(frameName. |
22380 | 3d 3d 20 6e 75 6c 6c 29 20 66 72 61 6d 65 4e 61 6d 65 20 3d 20 27 27 0a 20 20 69 66 20 28 66 65 | ==.null).frameName.=.''...if.(fe |
223a0 | 61 74 75 72 65 73 20 3d 3d 20 6e 75 6c 6c 29 20 66 65 61 74 75 72 65 73 20 3d 20 27 27 0a 0a 20 | atures.==.null).features.=.''... |
223c0 | 20 63 6f 6e 73 74 20 6f 70 74 69 6f 6e 73 20 3d 20 7b 7d 0a 0a 20 20 63 6f 6e 73 74 20 69 6e 74 | .const.options.=.{}....const.int |
223e0 | 73 20 3d 20 5b 27 78 27 2c 20 27 79 27 2c 20 27 77 69 64 74 68 27 2c 20 27 68 65 69 67 68 74 27 | s.=.['x',.'y',.'width',.'height' |
22400 | 2c 20 27 6d 69 6e 57 69 64 74 68 27 2c 20 27 6d 61 78 57 69 64 74 68 27 2c 20 27 6d 69 6e 48 65 | ,.'minWidth',.'maxWidth',.'minHe |
22420 | 69 67 68 74 27 2c 20 27 6d 61 78 48 65 69 67 68 74 27 2c 20 27 7a 6f 6f 6d 46 61 63 74 6f 72 27 | ight',.'maxHeight',.'zoomFactor' |
22440 | 5d 0a 20 20 63 6f 6e 73 74 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d 20 5b 27 7a 6f 6f | ]...const.webPreferences.=.['zoo |
22460 | 6d 46 61 63 74 6f 72 27 2c 20 27 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 27 2c 20 27 65 6e | mFactor',.'nodeIntegration',.'en |
22480 | 61 62 6c 65 52 65 6d 6f 74 65 4d 6f 64 75 6c 65 27 2c 20 27 70 72 65 6c 6f 61 64 27 2c 20 27 6a | ableRemoteModule',.'preload',.'j |
224a0 | 61 76 61 73 63 72 69 70 74 27 2c 20 27 63 6f 6e 74 65 78 74 49 73 6f 6c 61 74 69 6f 6e 27 2c 20 | avascript',.'contextIsolation',. |
224c0 | 27 77 65 62 76 69 65 77 54 61 67 27 5d 0a 20 20 63 6f 6e 73 74 20 64 69 73 70 6f 73 69 74 69 6f | 'webviewTag']...const.dispositio |
224e0 | 6e 20 3d 20 27 6e 65 77 2d 77 69 6e 64 6f 77 27 0a 0a 20 20 2f 2f 20 55 73 65 64 20 74 6f 20 73 | n.=.'new-window'....//.Used.to.s |
22500 | 74 6f 72 65 20 61 64 64 69 74 69 6f 6e 61 6c 20 66 65 61 74 75 72 65 73 0a 20 20 63 6f 6e 73 74 | tore.additional.features...const |
22520 | 20 61 64 64 69 74 69 6f 6e 61 6c 46 65 61 74 75 72 65 73 20 3d 20 5b 5d 0a 0a 20 20 2f 2f 20 50 | .additionalFeatures.=.[]....//.P |
22540 | 61 72 73 65 20 74 68 65 20 66 65 61 74 75 72 65 73 0a 20 20 70 61 72 73 65 46 65 61 74 75 72 65 | arse.the.features...parseFeature |
22560 | 73 53 74 72 69 6e 67 28 66 65 61 74 75 72 65 73 2c 20 66 75 6e 63 74 69 6f 6e 20 28 6b 65 79 2c | sString(features,.function.(key, |
22580 | 20 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 69 66 20 28 76 61 6c 75 65 20 3d 3d 3d 20 75 6e 64 65 | .value).{.....if.(value.===.unde |
225a0 | 66 69 6e 65 64 29 20 7b 0a 20 20 20 20 20 20 61 64 64 69 74 69 6f 6e 61 6c 46 65 61 74 75 72 65 | fined).{.......additionalFeature |
225c0 | 73 2e 70 75 73 68 28 6b 65 79 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 2f | s.push(key).....}.else.{......./ |
225e0 | 2f 20 44 6f 6e 27 74 20 61 6c 6c 6f 77 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 74 6f 20 | /.Don't.allow.webPreferences.to. |
22600 | 62 65 20 73 65 74 20 73 69 6e 63 65 20 69 74 20 6d 75 73 74 20 62 65 20 61 6e 20 6f 62 6a 65 63 | be.set.since.it.must.be.an.objec |
22620 | 74 0a 20 20 20 20 20 20 2f 2f 20 74 68 61 74 20 63 61 6e 6e 6f 74 20 62 65 20 64 69 72 65 63 74 | t.......//.that.cannot.be.direct |
22640 | 6c 79 20 6f 76 65 72 72 69 64 64 65 6e 0a 20 20 20 20 20 20 69 66 20 28 6b 65 79 20 3d 3d 3d 20 | ly.overridden.......if.(key.===. |
22660 | 27 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 27 29 20 72 65 74 75 72 6e 0a 0a 20 20 20 20 20 20 | 'webPreferences').return........ |
22680 | 69 66 20 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2e 69 6e 63 6c 75 64 65 73 28 6b 65 79 29 | if.(webPreferences.includes(key) |
226a0 | 29 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 66 65 | ).{.........if.(options.webPrefe |
226c0 | 72 65 6e 63 65 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 6f 70 74 69 | rences.==.null).{...........opti |
226e0 | 6f 6e 73 2e 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d 20 7b 7d 0a 20 20 20 20 20 20 20 20 | ons.webPreferences.=.{}......... |
22700 | 7d 0a 20 20 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 2e 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 | }.........options.webPreferences |
22720 | 5b 6b 65 79 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 | [key].=.value.......}.else.{.... |
22740 | 20 20 20 20 20 6f 70 74 69 6f 6e 73 5b 6b 65 79 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 20 20 | .....options[key].=.value....... |
22760 | 7d 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 6c 65 66 74 29 | }.....}...})...if.(options.left) |
22780 | 20 7b 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 78 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a | .{.....if.(options.x.==.null).{. |
227a0 | 20 20 20 20 20 20 6f 70 74 69 6f 6e 73 2e 78 20 3d 20 6f 70 74 69 6f 6e 73 2e 6c 65 66 74 0a 20 | ......options.x.=.options.left.. |
227c0 | 20 20 20 7d 0a 20 20 7d 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 74 6f 70 29 20 7b 0a 20 20 | ...}...}...if.(options.top).{... |
227e0 | 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 79 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 | ..if.(options.y.==.null).{...... |
22800 | 20 6f 70 74 69 6f 6e 73 2e 79 20 3d 20 6f 70 74 69 6f 6e 73 2e 74 6f 70 0a 20 20 20 20 7d 0a 20 | .options.y.=.options.top.....}.. |
22820 | 20 7d 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 74 69 74 6c 65 20 3d 3d 20 6e 75 6c 6c 29 20 | .}...if.(options.title.==.null). |
22840 | 7b 0a 20 20 20 20 6f 70 74 69 6f 6e 73 2e 74 69 74 6c 65 20 3d 20 66 72 61 6d 65 4e 61 6d 65 0a | {.....options.title.=.frameName. |
22860 | 20 20 7d 0a 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 77 69 64 74 68 20 3d 3d 20 6e 75 6c 6c 29 | ..}...if.(options.width.==.null) |
22880 | 20 7b 0a 20 20 20 20 6f 70 74 69 6f 6e 73 2e 77 69 64 74 68 20 3d 20 38 30 30 0a 20 20 7d 0a 20 | .{.....options.width.=.800...}.. |
228a0 | 20 69 66 20 28 6f 70 74 69 6f 6e 73 2e 68 65 69 67 68 74 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 | .if.(options.height.==.null).{.. |
228c0 | 20 20 20 6f 70 74 69 6f 6e 73 2e 68 65 69 67 68 74 20 3d 20 36 30 30 0a 20 20 7d 0a 0a 20 20 66 | ...options.height.=.600...}....f |
228e0 | 6f 72 20 28 63 6f 6e 73 74 20 6e 61 6d 65 20 6f 66 20 69 6e 74 73 29 20 7b 0a 20 20 20 20 69 66 | or.(const.name.of.ints).{.....if |
22900 | 20 28 6f 70 74 69 6f 6e 73 5b 6e 61 6d 65 5d 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 | .(options[name].!=.null).{...... |
22920 | 20 6f 70 74 69 6f 6e 73 5b 6e 61 6d 65 5d 20 3d 20 70 61 72 73 65 49 6e 74 28 6f 70 74 69 6f 6e | .options[name].=.parseInt(option |
22940 | 73 5b 6e 61 6d 65 5d 2c 20 31 30 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 | s[name],.10).....}...}....const. |
22960 | 72 65 66 65 72 72 65 72 20 3d 20 7b 20 75 72 6c 3a 20 27 27 2c 20 70 6f 6c 69 63 79 3a 20 27 64 | referrer.=.{.url:.'',.policy:.'d |
22980 | 65 66 61 75 6c 74 27 20 7d 0a 20 20 69 70 63 4d 61 69 6e 2e 65 6d 69 74 28 27 45 4c 45 43 54 52 | efault'.}...ipcMain.emit('ELECTR |
229a0 | 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 49 4e 54 45 52 4e 41 4c | ON_GUEST_WINDOW_MANAGER_INTERNAL |
229c0 | 5f 57 49 4e 44 4f 57 5f 4f 50 45 4e 27 2c 20 65 76 65 6e 74 2c 0a 20 20 20 20 75 72 6c 2c 20 72 | _WINDOW_OPEN',.event,.....url,.r |
229e0 | 65 66 65 72 72 65 72 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 64 69 73 70 6f 73 69 74 69 6f 6e 2c | eferrer,.frameName,.disposition, |
22a00 | 20 6f 70 74 69 6f 6e 73 2c 20 61 64 64 69 74 69 6f 6e 61 6c 46 65 61 74 75 72 65 73 29 0a 7d 29 | .options,.additionalFeatures).}) |
22a20 | 0a 0a 2f 2f 20 52 6f 75 74 65 64 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 20 6d 65 73 73 61 67 65 73 | ..//.Routed.window.open.messages |
22a40 | 20 77 69 74 68 20 66 75 6c 6c 79 20 70 61 72 73 65 64 20 6f 70 74 69 6f 6e 73 0a 69 70 63 4d 61 | .with.fully.parsed.options.ipcMa |
22a60 | 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e | in.on('ELECTRON_GUEST_WINDOW_MAN |
22a80 | 41 47 45 52 5f 49 4e 54 45 52 4e 41 4c 5f 57 49 4e 44 4f 57 5f 4f 50 45 4e 27 2c 20 66 75 6e 63 | AGER_INTERNAL_WINDOW_OPEN',.func |
22aa0 | 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 75 72 6c 2c 20 72 65 66 65 72 72 65 72 2c 0a 20 20 66 72 | tion.(event,.url,.referrer,...fr |
22ac0 | 61 6d 65 4e 61 6d 65 2c 20 64 69 73 70 6f 73 69 74 69 6f 6e 2c 20 6f 70 74 69 6f 6e 73 2c 0a 20 | ameName,.disposition,.options,.. |
22ae0 | 20 61 64 64 69 74 69 6f 6e 61 6c 46 65 61 74 75 72 65 73 2c 20 70 6f 73 74 44 61 74 61 29 20 7b | .additionalFeatures,.postData).{ |
22b00 | 0a 20 20 6f 70 74 69 6f 6e 73 20 3d 20 6d 65 72 67 65 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 4f | ...options.=.mergeBrowserWindowO |
22b20 | 70 74 69 6f 6e 73 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 6f 70 74 69 6f 6e 73 29 0a 20 20 | ptions(event.sender,.options)... |
22b40 | 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 65 6d 69 74 28 27 6e 65 77 2d 77 69 6e 64 6f 77 27 2c 20 | event.sender.emit('new-window',. |
22b60 | 65 76 65 6e 74 2c 20 75 72 6c 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 64 69 73 70 6f 73 69 74 69 | event,.url,.frameName,.dispositi |
22b80 | 6f 6e 2c 20 6f 70 74 69 6f 6e 73 2c 20 61 64 64 69 74 69 6f 6e 61 6c 46 65 61 74 75 72 65 73 2c | on,.options,.additionalFeatures, |
22ba0 | 20 72 65 66 65 72 72 65 72 29 0a 20 20 63 6f 6e 73 74 20 7b 20 6e 65 77 47 75 65 73 74 20 7d 20 | .referrer)...const.{.newGuest.}. |
22bc0 | 3d 20 65 76 65 6e 74 0a 20 20 69 66 20 28 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 69 73 47 75 | =.event...if.((event.sender.isGu |
22be0 | 65 73 74 28 29 20 26 26 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 65 74 4c 61 73 74 57 65 62 | est().&&.event.sender.getLastWeb |
22c00 | 50 72 65 66 65 72 65 6e 63 65 73 28 29 2e 64 69 73 61 62 6c 65 50 6f 70 75 70 73 29 20 7c 7c 20 | Preferences().disablePopups).||. |
22c20 | 65 76 65 6e 74 2e 64 65 66 61 75 6c 74 50 72 65 76 65 6e 74 65 64 29 20 7b 0a 20 20 20 20 69 66 | event.defaultPrevented).{.....if |
22c40 | 20 28 6e 65 77 47 75 65 73 74 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 | .(newGuest.!=.null).{.......if.( |
22c60 | 6f 70 74 69 6f 6e 73 2e 77 65 62 43 6f 6e 74 65 6e 74 73 20 3d 3d 3d 20 6e 65 77 47 75 65 73 74 | options.webContents.===.newGuest |
22c80 | 2e 77 65 62 43 6f 6e 74 65 6e 74 73 29 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 74 68 65 20 77 | .webContents).{.........//.the.w |
22ca0 | 65 62 43 6f 6e 74 65 6e 74 73 20 69 73 20 6e 6f 74 20 63 68 61 6e 67 65 64 2c 20 73 6f 20 73 65 | ebContents.is.not.changed,.so.se |
22cc0 | 74 20 64 65 66 61 75 6c 74 50 72 65 76 65 6e 74 65 64 20 74 6f 20 66 61 6c 73 65 20 74 6f 0a 20 | t.defaultPrevented.to.false.to.. |
22ce0 | 20 20 20 20 20 20 20 2f 2f 20 73 74 6f 70 20 74 68 65 20 63 61 6c 6c 65 72 73 20 6f 66 20 74 68 | .......//.stop.the.callers.of.th |
22d00 | 69 73 20 65 76 65 6e 74 20 66 72 6f 6d 20 64 65 73 74 72 6f 79 69 6e 67 20 74 68 65 20 77 65 62 | is.event.from.destroying.the.web |
22d20 | 43 6f 6e 74 65 6e 74 73 2e 0a 20 20 20 20 20 20 20 20 65 76 65 6e 74 2e 64 65 66 61 75 6c 74 50 | Contents..........event.defaultP |
22d40 | 72 65 76 65 6e 74 65 64 20 3d 20 66 61 6c 73 65 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 65 | revented.=.false.......}.......e |
22d60 | 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 73 65 74 75 70 47 75 65 73 74 28 65 76 | vent.returnValue.=.setupGuest(ev |
22d80 | 65 6e 74 2e 73 65 6e 64 65 72 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 6e 65 77 47 75 65 73 74 2c | ent.sender,.frameName,.newGuest, |
22da0 | 20 6f 70 74 69 6f 6e 73 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 65 76 65 | .options).....}.else.{.......eve |
22dc0 | 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 7d 0a 20 20 7d 20 | nt.returnValue.=.null.....}...}. |
22de0 | 65 6c 73 65 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 63 | else.{.....event.returnValue.=.c |
22e00 | 72 65 61 74 65 47 75 65 73 74 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 75 72 6c 2c 20 72 65 | reateGuest(event.sender,.url,.re |
22e20 | 66 65 72 72 65 72 2c 20 66 72 61 6d 65 4e 61 6d 65 2c 20 6f 70 74 69 6f 6e 73 2c 20 70 6f 73 74 | ferrer,.frameName,.options,.post |
22e40 | 44 61 74 61 29 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 | Data)...}.})..ipcMain.on('ELECTR |
22e60 | 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f 43 | ON_GUEST_WINDOW_MANAGER_WINDOW_C |
22e80 | 4c 4f 53 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 67 75 65 73 74 49 64 29 | LOSE',.function.(event,.guestId) |
22ea0 | 20 7b 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f | .{...const.guestContents.=.webCo |
22ec0 | 6e 74 65 6e 74 73 2e 66 72 6f 6d 49 64 28 67 75 65 73 74 49 64 29 0a 20 20 69 66 20 28 67 75 65 | ntents.fromId(guestId)...if.(gue |
22ee0 | 73 74 43 6f 6e 74 65 6e 74 73 20 3d 3d 20 6e 75 6c 6c 29 20 72 65 74 75 72 6e 0a 0a 20 20 69 66 | stContents.==.null).return....if |
22f00 | 20 28 21 63 61 6e 41 63 63 65 73 73 57 69 6e 64 6f 77 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c | .(!canAccessWindow(event.sender, |
22f20 | 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 29 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 | .guestContents)).{.....console.e |
22f40 | 72 72 6f 72 28 60 42 6c 6f 63 6b 65 64 20 24 7b 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 65 74 | rror(`Blocked.${event.sender.get |
22f60 | 55 52 4c 28 29 7d 20 66 72 6f 6d 20 63 6c 6f 73 69 6e 67 20 69 74 73 20 6f 70 65 6e 65 72 2e 60 | URL()}.from.closing.its.opener.` |
22f80 | 29 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 57 | ).....return...}....const.guestW |
22fa0 | 69 6e 64 6f 77 20 3d 20 67 65 74 47 75 65 73 74 57 69 6e 64 6f 77 28 67 75 65 73 74 43 6f 6e 74 | indow.=.getGuestWindow(guestCont |
22fc0 | 65 6e 74 73 29 0a 20 20 69 66 20 28 67 75 65 73 74 57 69 6e 64 6f 77 20 21 3d 20 6e 75 6c 6c 29 | ents)...if.(guestWindow.!=.null) |
22fe0 | 20 67 75 65 73 74 57 69 6e 64 6f 77 2e 64 65 73 74 72 6f 79 28 29 0a 7d 29 0a 0a 63 6f 6e 73 74 | .guestWindow.destroy().})..const |
23000 | 20 77 69 6e 64 6f 77 4d 65 74 68 6f 64 73 20 3d 20 6e 65 77 20 53 65 74 28 5b 0a 20 20 27 66 6f | .windowMethods.=.new.Set([...'fo |
23020 | 63 75 73 27 2c 0a 20 20 27 62 6c 75 72 27 0a 5d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 | cus',...'blur'.])..ipcMain.on('E |
23040 | 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e | LECTRON_GUEST_WINDOW_MANAGER_WIN |
23060 | 44 4f 57 5f 4d 45 54 48 4f 44 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 67 75 | DOW_METHOD',.function.(event,.gu |
23080 | 65 73 74 49 64 2c 20 6d 65 74 68 6f 64 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 63 6f 6e 73 | estId,.method,....args).{...cons |
230a0 | 74 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 66 72 | t.guestContents.=.webContents.fr |
230c0 | 6f 6d 49 64 28 67 75 65 73 74 49 64 29 0a 20 20 69 66 20 28 67 75 65 73 74 43 6f 6e 74 65 6e 74 | omId(guestId)...if.(guestContent |
230e0 | 73 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c | s.==.null).{.....event.returnVal |
23100 | 75 65 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 69 66 20 28 | ue.=.null.....return...}....if.( |
23120 | 21 63 61 6e 41 63 63 65 73 73 57 69 6e 64 6f 77 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 67 | !canAccessWindow(event.sender,.g |
23140 | 75 65 73 74 43 6f 6e 74 65 6e 74 73 29 20 7c 7c 20 21 77 69 6e 64 6f 77 4d 65 74 68 6f 64 73 2e | uestContents).||.!windowMethods. |
23160 | 68 61 73 28 6d 65 74 68 6f 64 29 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 | has(method)).{.....console.error |
23180 | 28 60 42 6c 6f 63 6b 65 64 20 24 7b 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 65 74 55 52 4c 28 | (`Blocked.${event.sender.getURL( |
231a0 | 29 7d 20 66 72 6f 6d 20 63 61 6c 6c 69 6e 67 20 24 7b 6d 65 74 68 6f 64 7d 20 6f 6e 20 69 74 73 | )}.from.calling.${method}.on.its |
231c0 | 20 6f 70 65 6e 65 72 2e 60 29 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 | .opener.`).....event.returnValue |
231e0 | 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 | .=.null.....return...}....const. |
23200 | 67 75 65 73 74 57 69 6e 64 6f 77 20 3d 20 67 65 74 47 75 65 73 74 57 69 6e 64 6f 77 28 67 75 65 | guestWindow.=.getGuestWindow(gue |
23220 | 73 74 43 6f 6e 74 65 6e 74 73 29 0a 20 20 69 66 20 28 67 75 65 73 74 57 69 6e 64 6f 77 20 21 3d | stContents)...if.(guestWindow.!= |
23240 | 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d | .null).{.....event.returnValue.= |
23260 | 20 67 75 65 73 74 57 69 6e 64 6f 77 5b 6d 65 74 68 6f 64 5d 28 2e 2e 2e 61 72 67 73 29 0a 20 20 | .guestWindow[method](...args)... |
23280 | 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d | }.else.{.....event.returnValue.= |
232a0 | 20 6e 75 6c 6c 0a 20 20 7d 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 | .null...}.})..ipcMain.on('ELECTR |
232c0 | 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f 50 | ON_GUEST_WINDOW_MANAGER_WINDOW_P |
232e0 | 4f 53 54 4d 45 53 53 41 47 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 67 75 | OSTMESSAGE',.function.(event,.gu |
23300 | 65 73 74 49 64 2c 20 6d 65 73 73 61 67 65 2c 20 74 61 72 67 65 74 4f 72 69 67 69 6e 2c 20 73 6f | estId,.message,.targetOrigin,.so |
23320 | 75 72 63 65 4f 72 69 67 69 6e 29 20 7b 0a 20 20 69 66 20 28 74 61 72 67 65 74 4f 72 69 67 69 6e | urceOrigin).{...if.(targetOrigin |
23340 | 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 74 61 72 67 65 74 4f 72 69 67 69 6e 20 3d 20 27 | .==.null).{.....targetOrigin.=.' |
23360 | 2a 27 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 20 3d 20 | *'...}....const.guestContents.=. |
23380 | 77 65 62 43 6f 6e 74 65 6e 74 73 2e 66 72 6f 6d 49 64 28 67 75 65 73 74 49 64 29 0a 20 20 69 66 | webContents.fromId(guestId)...if |
233a0 | 20 28 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 20 3d 3d 20 6e 75 6c 6c 29 20 72 65 74 75 72 6e 0a | .(guestContents.==.null).return. |
233c0 | 0a 20 20 2f 2f 20 54 68 65 20 57 33 43 20 64 6f 65 73 20 6e 6f 74 20 73 65 65 6d 20 74 6f 20 68 | ...//.The.W3C.does.not.seem.to.h |
233e0 | 61 76 65 20 77 6f 72 64 20 6f 6e 20 68 6f 77 20 70 6f 73 74 4d 65 73 73 61 67 65 20 73 68 6f 75 | ave.word.on.how.postMessage.shou |
23400 | 6c 64 20 77 6f 72 6b 20 77 68 65 6e 20 74 68 65 0a 20 20 2f 2f 20 6f 72 69 67 69 6e 73 20 64 6f | ld.work.when.the...//.origins.do |
23420 | 20 6e 6f 74 20 6d 61 74 63 68 2c 20 73 6f 20 77 65 20 64 6f 20 6e 6f 74 20 64 6f 20 7c 63 61 6e | .not.match,.so.we.do.not.do.|can |
23440 | 41 63 63 65 73 73 57 69 6e 64 6f 77 7c 20 63 68 65 63 6b 20 68 65 72 65 20 73 69 6e 63 65 0a 20 | AccessWindow|.check.here.since.. |
23460 | 20 2f 2f 20 70 6f 73 74 4d 65 73 73 61 67 65 20 61 63 72 6f 73 73 20 6f 72 69 67 69 6e 73 20 69 | .//.postMessage.across.origins.i |
23480 | 73 20 75 73 65 66 75 6c 20 61 6e 64 20 6e 6f 74 20 68 61 72 6d 66 75 6c 2e 0a 20 20 69 66 20 28 | s.useful.and.not.harmful....if.( |
234a0 | 74 61 72 67 65 74 4f 72 69 67 69 6e 20 3d 3d 3d 20 27 2a 27 20 7c 7c 20 69 73 53 61 6d 65 4f 72 | targetOrigin.===.'*'.||.isSameOr |
234c0 | 69 67 69 6e 28 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 2e 67 65 74 55 52 4c 28 29 2c 20 74 61 72 | igin(guestContents.getURL(),.tar |
234e0 | 67 65 74 4f 72 69 67 69 6e 29 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 73 6f 75 72 63 65 49 64 | getOrigin)).{.....const.sourceId |
23500 | 20 3d 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 69 64 0a 20 20 20 20 67 75 65 73 74 43 6f 6e 74 | .=.event.sender.id.....guestCont |
23520 | 65 6e 74 73 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 | ents._sendInternal('ELECTRON_GUE |
23540 | 53 54 5f 57 49 4e 44 4f 57 5f 50 4f 53 54 4d 45 53 53 41 47 45 27 2c 20 73 6f 75 72 63 65 49 64 | ST_WINDOW_POSTMESSAGE',.sourceId |
23560 | 2c 20 6d 65 73 73 61 67 65 2c 20 73 6f 75 72 63 65 4f 72 69 67 69 6e 29 0a 20 20 7d 0a 7d 29 0a | ,.message,.sourceOrigin)...}.}). |
23580 | 0a 63 6f 6e 73 74 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 73 20 3d 20 6e 65 77 20 | .const.webContentsMethods.=.new. |
235a0 | 53 65 74 28 5b 0a 20 20 27 70 72 69 6e 74 27 2c 0a 20 20 27 65 78 65 63 75 74 65 4a 61 76 61 53 | Set([...'print',...'executeJavaS |
235c0 | 63 72 69 70 74 27 0a 5d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f | cript'.])..ipcMain.on('ELECTRON_ |
235e0 | 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 45 42 5f 43 4f 4e 54 45 4e 54 | GUEST_WINDOW_MANAGER_WEB_CONTENT |
23600 | 53 5f 4d 45 54 48 4f 44 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 67 75 65 73 | S_METHOD',.function.(event,.gues |
23620 | 74 49 64 2c 20 6d 65 74 68 6f 64 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 | tId,.method,....args).{...const. |
23640 | 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 66 72 6f 6d | guestContents.=.webContents.from |
23660 | 49 64 28 67 75 65 73 74 49 64 29 0a 20 20 69 66 20 28 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 20 | Id(guestId)...if.(guestContents. |
23680 | 3d 3d 20 6e 75 6c 6c 29 20 72 65 74 75 72 6e 0a 0a 20 20 69 66 20 28 63 61 6e 41 63 63 65 73 73 | ==.null).return....if.(canAccess |
236a0 | 57 69 6e 64 6f 77 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 67 75 65 73 74 43 6f 6e 74 65 6e | Window(event.sender,.guestConten |
236c0 | 74 73 29 20 26 26 20 77 65 62 43 6f 6e 74 65 6e 74 73 4d 65 74 68 6f 64 73 2e 68 61 73 28 6d 65 | ts).&&.webContentsMethods.has(me |
236e0 | 74 68 6f 64 29 29 20 7b 0a 20 20 20 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 5b 6d 65 74 68 6f | thod)).{.....guestContents[metho |
23700 | 64 5d 28 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 63 6f 6e 73 6f | d](...args)...}.else.{.....conso |
23720 | 6c 65 2e 65 72 72 6f 72 28 60 42 6c 6f 63 6b 65 64 20 24 7b 65 76 65 6e 74 2e 73 65 6e 64 65 72 | le.error(`Blocked.${event.sender |
23740 | 2e 67 65 74 55 52 4c 28 29 7d 20 66 72 6f 6d 20 63 61 6c 6c 69 6e 67 20 24 7b 6d 65 74 68 6f 64 | .getURL()}.from.calling.${method |
23760 | 7d 20 6f 6e 20 69 74 73 20 6f 70 65 6e 65 72 2e 60 29 0a 20 20 7d 0a 7d 29 0a 0a 63 6f 6e 73 74 | }.on.its.opener.`)...}.})..const |
23780 | 20 77 65 62 43 6f 6e 74 65 6e 74 73 53 79 6e 63 4d 65 74 68 6f 64 73 20 3d 20 6e 65 77 20 53 65 | .webContentsSyncMethods.=.new.Se |
237a0 | 74 28 5b 0a 20 20 27 67 65 74 55 52 4c 27 2c 0a 20 20 27 6c 6f 61 64 55 52 4c 27 0a 5d 29 0a 0a | t([...'getURL',...'loadURL'.]).. |
237c0 | 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f | ipcMain.on('ELECTRON_GUEST_WINDO |
237e0 | 57 5f 4d 41 4e 41 47 45 52 5f 57 45 42 5f 43 4f 4e 54 45 4e 54 53 5f 4d 45 54 48 4f 44 5f 53 59 | W_MANAGER_WEB_CONTENTS_METHOD_SY |
23800 | 4e 43 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 67 75 65 73 74 49 64 2c 20 6d | NC',.function.(event,.guestId,.m |
23820 | 65 74 68 6f 64 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 67 75 65 73 74 43 | ethod,....args).{...const.guestC |
23840 | 6f 6e 74 65 6e 74 73 20 3d 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 66 72 6f 6d 49 64 28 67 75 65 | ontents.=.webContents.fromId(gue |
23860 | 73 74 49 64 29 0a 20 20 69 66 20 28 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 20 3d 3d 20 6e 75 6c | stId)...if.(guestContents.==.nul |
23880 | 6c 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 6e 75 6c | l).{.....event.returnValue.=.nul |
238a0 | 6c 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 69 66 20 28 63 61 6e 41 63 63 65 73 | l.....return...}....if.(canAcces |
238c0 | 73 57 69 6e 64 6f 77 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 67 75 65 73 74 43 6f 6e 74 65 | sWindow(event.sender,.guestConte |
238e0 | 6e 74 73 29 20 26 26 20 77 65 62 43 6f 6e 74 65 6e 74 73 53 79 6e 63 4d 65 74 68 6f 64 73 2e 68 | nts).&&.webContentsSyncMethods.h |
23900 | 61 73 28 6d 65 74 68 6f 64 29 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 | as(method)).{.....event.returnVa |
23920 | 6c 75 65 20 3d 20 67 75 65 73 74 43 6f 6e 74 65 6e 74 73 5b 6d 65 74 68 6f 64 5d 28 2e 2e 2e 61 | lue.=.guestContents[method](...a |
23940 | 72 67 73 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f | rgs)...}.else.{.....console.erro |
23960 | 72 28 60 42 6c 6f 63 6b 65 64 20 24 7b 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 65 74 55 52 4c | r(`Blocked.${event.sender.getURL |
23980 | 28 29 7d 20 66 72 6f 6d 20 63 61 6c 6c 69 6e 67 20 24 7b 6d 65 74 68 6f 64 7d 20 6f 6e 20 69 74 | ()}.from.calling.${method}.on.it |
239a0 | 73 20 6f 70 65 6e 65 72 2e 60 29 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 | s.opener.`).....event.returnValu |
239c0 | 65 20 3d 20 6e 75 6c 6c 0a 20 20 7d 0a 7d 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f | e.=.null...}.}).'use.strict'..co |
239e0 | 6e 73 74 20 7b 20 42 75 66 66 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 62 75 66 66 65 72 | nst.{.Buffer.}.=.require('buffer |
23a00 | 27 29 0a 63 6f 6e 73 74 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 29 0a 63 6f 6e 73 | ').const.fs.=.require('fs').cons |
23a20 | 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 74 68 27 29 0a 63 6f 6e 73 74 20 75 | t.path.=.require('path').const.u |
23a40 | 74 69 6c 20 3d 20 72 65 71 75 69 72 65 28 27 75 74 69 6c 27 29 0a 63 6f 6e 73 74 20 4d 6f 64 75 | til.=.require('util').const.Modu |
23a60 | 6c 65 20 3d 20 72 65 71 75 69 72 65 28 27 6d 6f 64 75 6c 65 27 29 0a 63 6f 6e 73 74 20 76 38 20 | le.=.require('module').const.v8. |
23a80 | 3d 20 72 65 71 75 69 72 65 28 27 76 38 27 29 0a 0a 2f 2f 20 57 65 20 6d 6f 64 69 66 69 65 64 20 | =.require('v8')..//.We.modified. |
23aa0 | 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 70 72 6f 63 65 73 73 2e 61 72 67 76 20 74 6f 20 6c 65 74 | the.original.process.argv.to.let |
23ac0 | 20 6e 6f 64 65 2e 6a 73 20 6c 6f 61 64 20 74 68 65 20 69 6e 69 74 2e 6a 73 2c 0a 2f 2f 20 77 65 | .node.js.load.the.init.js,.//.we |
23ae0 | 20 6e 65 65 64 20 74 6f 20 72 65 73 74 6f 72 65 20 69 74 20 68 65 72 65 2e 0a 70 72 6f 63 65 73 | .need.to.restore.it.here..proces |
23b00 | 73 2e 61 72 67 76 2e 73 70 6c 69 63 65 28 31 2c 20 31 29 0a 0a 2f 2f 20 43 6c 65 61 72 20 73 65 | s.argv.splice(1,.1)..//.Clear.se |
23b20 | 61 72 63 68 20 70 61 74 68 73 2e 0a 72 65 71 75 69 72 65 28 27 2e 2e 2f 63 6f 6d 6d 6f 6e 2f 72 | arch.paths..require('../common/r |
23b40 | 65 73 65 74 2d 73 65 61 72 63 68 2d 70 61 74 68 73 27 29 0a 0a 2f 2f 20 49 6d 70 6f 72 74 20 63 | eset-search-paths')..//.Import.c |
23b60 | 6f 6d 6d 6f 6e 20 73 65 74 74 69 6e 67 73 2e 0a 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 | ommon.settings..require('@electr |
23b80 | 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 69 6e 69 74 27 29 0a 0a 63 6f 6e 73 74 | on/internal/common/init')..const |
23ba0 | 20 67 6c 6f 62 61 6c 50 61 74 68 73 20 3d 20 4d 6f 64 75 6c 65 2e 67 6c 6f 62 61 6c 50 61 74 68 | .globalPaths.=.Module.globalPath |
23bc0 | 73 0a 0a 2f 2f 20 45 78 70 6f 73 65 20 70 75 62 6c 69 63 20 41 50 49 73 2e 0a 67 6c 6f 62 61 6c | s..//.Expose.public.APIs..global |
23be0 | 50 61 74 68 73 2e 70 75 73 68 28 70 61 74 68 2e 6a 6f 69 6e 28 5f 5f 64 69 72 6e 61 6d 65 2c 20 | Paths.push(path.join(__dirname,. |
23c00 | 27 61 70 69 27 2c 20 27 65 78 70 6f 72 74 73 27 29 29 0a 0a 69 66 20 28 70 72 6f 63 65 73 73 2e | 'api',.'exports'))..if.(process. |
23c20 | 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 29 20 7b 0a 20 20 2f 2f 20 52 65 64 | platform.===.'win32').{...//.Red |
23c40 | 69 72 65 63 74 20 6e 6f 64 65 27 73 20 63 6f 6e 73 6f 6c 65 20 74 6f 20 75 73 65 20 6f 75 72 20 | irect.node's.console.to.use.our. |
23c60 | 6f 77 6e 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2c 20 73 69 6e 63 65 20 6e 6f 64 65 20 | own.implementations,.since.node. |
23c80 | 63 61 6e 20 6e 6f 74 0a 20 20 2f 2f 20 68 61 6e 64 6c 65 20 63 6f 6e 73 6f 6c 65 20 6f 75 74 70 | can.not...//.handle.console.outp |
23ca0 | 75 74 20 77 68 65 6e 20 72 75 6e 6e 69 6e 67 20 61 73 20 47 55 49 20 70 72 6f 67 72 61 6d 2e 0a | ut.when.running.as.GUI.program.. |
23cc0 | 20 20 63 6f 6e 73 74 20 63 6f 6e 73 6f 6c 65 4c 6f 67 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e | ..const.consoleLog.=.function.(. |
23ce0 | 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 70 72 6f 63 65 73 73 2e 6c 6f 67 | ..args).{.....return.process.log |
23d00 | 28 75 74 69 6c 2e 66 6f 72 6d 61 74 28 2e 2e 2e 61 72 67 73 29 20 2b 20 27 5c 6e 27 29 0a 20 20 | (util.format(...args).+.'\n')... |
23d20 | 7d 0a 20 20 63 6f 6e 73 74 20 73 74 72 65 61 6d 57 72 69 74 65 20 3d 20 66 75 6e 63 74 69 6f 6e | }...const.streamWrite.=.function |
23d40 | 20 28 63 68 75 6e 6b 2c 20 65 6e 63 6f 64 69 6e 67 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 | .(chunk,.encoding,.callback).{.. |
23d60 | 20 20 20 69 66 20 28 42 75 66 66 65 72 2e 69 73 42 75 66 66 65 72 28 63 68 75 6e 6b 29 29 20 7b | ...if.(Buffer.isBuffer(chunk)).{ |
23d80 | 0a 20 20 20 20 20 20 63 68 75 6e 6b 20 3d 20 63 68 75 6e 6b 2e 74 6f 53 74 72 69 6e 67 28 65 6e | .......chunk.=.chunk.toString(en |
23da0 | 63 6f 64 69 6e 67 29 0a 20 20 20 20 7d 0a 20 20 20 20 70 72 6f 63 65 73 73 2e 6c 6f 67 28 63 68 | coding).....}.....process.log(ch |
23dc0 | 75 6e 6b 29 0a 20 20 20 20 69 66 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 63 | unk).....if.(callback).{.......c |
23de0 | 61 6c 6c 62 61 63 6b 28 29 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 65 0a | allback().....}.....return.true. |
23e00 | 20 20 7d 0a 20 20 63 6f 6e 73 6f 6c 65 2e 6c 6f 67 20 3d 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f | ..}...console.log.=.console.erro |
23e20 | 72 20 3d 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 20 3d 20 63 6f 6e 73 6f 6c 65 4c 6f 67 0a 20 20 | r.=.console.warn.=.consoleLog... |
23e40 | 70 72 6f 63 65 73 73 2e 73 74 64 6f 75 74 2e 77 72 69 74 65 20 3d 20 70 72 6f 63 65 73 73 2e 73 | process.stdout.write.=.process.s |
23e60 | 74 64 65 72 72 2e 77 72 69 74 65 20 3d 20 73 74 72 65 61 6d 57 72 69 74 65 0a 7d 0a 0a 2f 2f 20 | tderr.write.=.streamWrite.}..//. |
23e80 | 44 6f 6e 27 74 20 71 75 69 74 20 6f 6e 20 66 61 74 61 6c 20 65 72 72 6f 72 2e 0a 70 72 6f 63 65 | Don't.quit.on.fatal.error..proce |
23ea0 | 73 73 2e 6f 6e 28 27 75 6e 63 61 75 67 68 74 45 78 63 65 70 74 69 6f 6e 27 2c 20 66 75 6e 63 74 | ss.on('uncaughtException',.funct |
23ec0 | 69 6f 6e 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 2f 2f 20 44 6f 20 6e 6f 74 68 69 6e 67 20 69 66 | ion.(error).{...//.Do.nothing.if |
23ee0 | 20 74 68 65 20 75 73 65 72 20 68 61 73 20 61 20 63 75 73 74 6f 6d 20 75 6e 63 61 75 67 68 74 20 | .the.user.has.a.custom.uncaught. |
23f00 | 65 78 63 65 70 74 69 6f 6e 20 68 61 6e 64 6c 65 72 2e 0a 20 20 69 66 20 28 70 72 6f 63 65 73 73 | exception.handler....if.(process |
23f20 | 2e 6c 69 73 74 65 6e 65 72 73 28 27 75 6e 63 61 75 67 68 74 45 78 63 65 70 74 69 6f 6e 27 29 2e | .listeners('uncaughtException'). |
23f40 | 6c 65 6e 67 74 68 20 3e 20 31 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 0a 20 20 | length.>.1).{.....return...}.... |
23f60 | 2f 2f 20 53 68 6f 77 20 65 72 72 6f 72 20 69 6e 20 47 55 49 2e 0a 20 20 63 6f 6e 73 74 20 64 69 | //.Show.error.in.GUI....const.di |
23f80 | 61 6c 6f 67 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 2e 64 69 61 6c 6f | alog.=.require('electron').dialo |
23fa0 | 67 0a 20 20 63 6f 6e 73 74 20 73 74 61 63 6b 20 3d 20 65 72 72 6f 72 2e 73 74 61 63 6b 20 3f 20 | g...const.stack.=.error.stack.?. |
23fc0 | 65 72 72 6f 72 2e 73 74 61 63 6b 20 3a 20 60 24 7b 65 72 72 6f 72 2e 6e 61 6d 65 7d 3a 20 24 7b | error.stack.:.`${error.name}:.${ |
23fe0 | 65 72 72 6f 72 2e 6d 65 73 73 61 67 65 7d 60 0a 20 20 63 6f 6e 73 74 20 6d 65 73 73 61 67 65 20 | error.message}`...const.message. |
24000 | 3d 20 27 55 6e 63 61 75 67 68 74 20 45 78 63 65 70 74 69 6f 6e 3a 5c 6e 27 20 2b 20 73 74 61 63 | =.'Uncaught.Exception:\n'.+.stac |
24020 | 6b 0a 20 20 64 69 61 6c 6f 67 2e 73 68 6f 77 45 72 72 6f 72 42 6f 78 28 27 41 20 4a 61 76 61 53 | k...dialog.showErrorBox('A.JavaS |
24040 | 63 72 69 70 74 20 65 72 72 6f 72 20 6f 63 63 75 72 72 65 64 20 69 6e 20 74 68 65 20 6d 61 69 6e | cript.error.occurred.in.the.main |
24060 | 20 70 72 6f 63 65 73 73 27 2c 20 6d 65 73 73 61 67 65 29 0a 7d 29 0a 0a 2f 2f 20 45 6d 69 74 20 | .process',.message).})..//.Emit. |
24080 | 27 65 78 69 74 27 20 65 76 65 6e 74 20 6f 6e 20 71 75 69 74 2e 0a 63 6f 6e 73 74 20 7b 20 61 70 | 'exit'.event.on.quit..const.{.ap |
240a0 | 70 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 61 70 70 2e 6f | p.}.=.require('electron')..app.o |
240c0 | 6e 28 27 71 75 69 74 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 65 78 69 74 43 | n('quit',.function.(event,.exitC |
240e0 | 6f 64 65 29 20 7b 0a 20 20 70 72 6f 63 65 73 73 2e 65 6d 69 74 28 27 65 78 69 74 27 2c 20 65 78 | ode).{...process.emit('exit',.ex |
24100 | 69 74 43 6f 64 65 29 0a 7d 29 0a 0a 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d | itCode).})..if.(process.platform |
24120 | 20 3d 3d 3d 20 27 77 69 6e 33 32 27 29 20 7b 0a 20 20 2f 2f 20 49 66 20 77 65 20 61 72 65 20 61 | .===.'win32').{...//.If.we.are.a |
24140 | 20 53 71 75 69 72 72 65 6c 2e 57 69 6e 64 6f 77 73 2d 69 6e 73 74 61 6c 6c 65 64 20 61 70 70 2c | .Squirrel.Windows-installed.app, |
24160 | 20 73 65 74 20 61 70 70 20 75 73 65 72 20 6d 6f 64 65 6c 20 49 44 0a 20 20 2f 2f 20 73 6f 20 74 | .set.app.user.model.ID...//.so.t |
24180 | 68 61 74 20 75 73 65 72 73 20 64 6f 6e 27 74 20 68 61 76 65 20 74 6f 20 64 6f 20 74 68 69 73 2e | hat.users.don't.have.to.do.this. |
241a0 | 0a 20 20 2f 2f 0a 20 20 2f 2f 20 53 71 75 69 72 72 65 6c 20 70 61 63 6b 61 67 65 73 20 61 72 65 | ...//...//.Squirrel.packages.are |
241c0 | 20 61 6c 77 61 79 73 20 6f 66 20 74 68 65 20 66 6f 72 6d 3a 0a 20 20 2f 2f 0a 20 20 2f 2f 20 50 | .always.of.the.form:...//...//.P |
241e0 | 41 43 4b 41 47 45 2d 4e 41 4d 45 0a 20 20 2f 2f 20 2d 20 55 70 64 61 74 65 2e 65 78 65 0a 20 20 | ACKAGE-NAME...//.-.Update.exe... |
24200 | 2f 2f 20 2d 20 61 70 70 2d 56 45 52 53 49 4f 4e 0a 20 20 2f 2f 20 20 20 2d 20 4f 55 52 45 58 45 | //.-.app-VERSION...//...-.OUREXE |
24220 | 2e 65 78 65 0a 20 20 2f 2f 0a 20 20 2f 2f 20 53 71 75 69 72 72 65 6c 20 69 74 73 65 6c 66 20 77 | .exe...//...//.Squirrel.itself.w |
24240 | 69 6c 6c 20 61 6c 77 61 79 73 20 73 65 74 20 74 68 65 20 73 68 6f 72 74 63 75 74 27 73 20 41 70 | ill.always.set.the.shortcut's.Ap |
24260 | 70 20 55 73 65 72 20 4d 6f 64 65 6c 20 49 44 20 74 6f 20 74 68 65 0a 20 20 2f 2f 20 66 6f 72 6d | p.User.Model.ID.to.the...//.form |
24280 | 20 60 63 6f 6d 2e 73 71 75 69 72 72 65 6c 2e 50 41 43 4b 41 47 45 2d 4e 41 4d 45 2e 4f 55 52 45 | .`com.squirrel.PACKAGE-NAME.OURE |
242a0 | 58 45 60 2e 20 57 65 20 6e 65 65 64 20 74 6f 20 63 61 6c 6c 0a 20 20 2f 2f 20 61 70 70 2e 73 65 | XE`..We.need.to.call...//.app.se |
242c0 | 74 41 70 70 55 73 65 72 4d 6f 64 65 6c 49 64 20 77 69 74 68 20 61 20 6d 61 74 63 68 69 6e 67 20 | tAppUserModelId.with.a.matching. |
242e0 | 69 64 65 6e 74 69 66 69 65 72 20 73 6f 20 74 68 61 74 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 | identifier.so.that.renderer.proc |
24300 | 65 73 73 65 73 0a 20 20 2f 2f 20 77 69 6c 6c 20 69 6e 68 65 72 69 74 20 74 68 69 73 20 76 61 6c | esses...//.will.inherit.this.val |
24320 | 75 65 2e 0a 20 20 63 6f 6e 73 74 20 75 70 64 61 74 65 44 6f 74 45 78 65 20 3d 20 70 61 74 68 2e | ue....const.updateDotExe.=.path. |
24340 | 6a 6f 69 6e 28 70 61 74 68 2e 64 69 72 6e 61 6d 65 28 70 72 6f 63 65 73 73 2e 65 78 65 63 50 61 | join(path.dirname(process.execPa |
24360 | 74 68 29 2c 20 27 2e 2e 27 2c 20 27 75 70 64 61 74 65 2e 65 78 65 27 29 0a 0a 20 20 69 66 20 28 | th),.'..',.'update.exe')....if.( |
24380 | 66 73 2e 65 78 69 73 74 73 53 79 6e 63 28 75 70 64 61 74 65 44 6f 74 45 78 65 29 29 20 7b 0a 20 | fs.existsSync(updateDotExe)).{.. |
243a0 | 20 20 20 63 6f 6e 73 74 20 70 61 63 6b 61 67 65 44 69 72 20 3d 20 70 61 74 68 2e 64 69 72 6e 61 | ...const.packageDir.=.path.dirna |
243c0 | 6d 65 28 70 61 74 68 2e 72 65 73 6f 6c 76 65 28 75 70 64 61 74 65 44 6f 74 45 78 65 29 29 0a 20 | me(path.resolve(updateDotExe)).. |
243e0 | 20 20 20 63 6f 6e 73 74 20 70 61 63 6b 61 67 65 4e 61 6d 65 20 3d 20 70 61 74 68 2e 62 61 73 65 | ...const.packageName.=.path.base |
24400 | 6e 61 6d 65 28 70 61 63 6b 61 67 65 44 69 72 29 2e 72 65 70 6c 61 63 65 28 2f 5c 73 2f 67 2c 20 | name(packageDir).replace(/\s/g,. |
24420 | 27 27 29 0a 20 20 20 20 63 6f 6e 73 74 20 65 78 65 4e 61 6d 65 20 3d 20 70 61 74 68 2e 62 61 73 | '').....const.exeName.=.path.bas |
24440 | 65 6e 61 6d 65 28 70 72 6f 63 65 73 73 2e 65 78 65 63 50 61 74 68 29 2e 72 65 70 6c 61 63 65 28 | ename(process.execPath).replace( |
24460 | 2f 5c 2e 65 78 65 24 2f 69 2c 20 27 27 29 2e 72 65 70 6c 61 63 65 28 2f 5c 73 2f 67 2c 20 27 27 | /\.exe$/i,.'').replace(/\s/g,.'' |
24480 | 29 0a 0a 20 20 20 20 61 70 70 2e 73 65 74 41 70 70 55 73 65 72 4d 6f 64 65 6c 49 64 28 60 63 6f | )......app.setAppUserModelId(`co |
244a0 | 6d 2e 73 71 75 69 72 72 65 6c 2e 24 7b 70 61 63 6b 61 67 65 4e 61 6d 65 7d 2e 24 7b 65 78 65 4e | m.squirrel.${packageName}.${exeN |
244c0 | 61 6d 65 7d 60 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 4d 61 70 20 70 72 6f 63 65 73 73 2e 65 78 69 | ame}`)...}.}..//.Map.process.exi |
244e0 | 74 20 74 6f 20 61 70 70 2e 65 78 69 74 2c 20 77 68 69 63 68 20 71 75 69 74 73 20 67 72 61 63 65 | t.to.app.exit,.which.quits.grace |
24500 | 66 75 6c 6c 79 2e 0a 70 72 6f 63 65 73 73 2e 65 78 69 74 20 3d 20 61 70 70 2e 65 78 69 74 0a 0a | fully..process.exit.=.app.exit.. |
24520 | 2f 2f 20 4c 6f 61 64 20 74 68 65 20 52 50 43 20 73 65 72 76 65 72 2e 0a 72 65 71 75 69 72 65 28 | //.Load.the.RPC.server..require( |
24540 | 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 72 70 63 2d | '@electron/internal/browser/rpc- |
24560 | 73 65 72 76 65 72 27 29 0a 0a 2f 2f 20 4c 6f 61 64 20 74 68 65 20 67 75 65 73 74 20 76 69 65 77 | server')..//.Load.the.guest.view |
24580 | 20 6d 61 6e 61 67 65 72 2e 0a 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 | .manager..require('@electron/int |
245a0 | 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 67 75 65 73 74 2d 76 69 65 77 2d 6d 61 6e 61 67 65 72 | ernal/browser/guest-view-manager |
245c0 | 27 29 0a 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 | ').require('@electron/internal/b |
245e0 | 72 6f 77 73 65 72 2f 67 75 65 73 74 2d 77 69 6e 64 6f 77 2d 6d 61 6e 61 67 65 72 27 29 0a 0a 2f | rowser/guest-window-manager')../ |
24600 | 2f 20 4e 6f 77 20 77 65 20 74 72 79 20 74 6f 20 6c 6f 61 64 20 61 70 70 27 73 20 70 61 63 6b 61 | /.Now.we.try.to.load.app's.packa |
24620 | 67 65 2e 6a 73 6f 6e 2e 0a 6c 65 74 20 70 61 63 6b 61 67 65 50 61 74 68 20 3d 20 6e 75 6c 6c 0a | ge.json..let.packagePath.=.null. |
24640 | 6c 65 74 20 70 61 63 6b 61 67 65 4a 73 6f 6e 20 3d 20 6e 75 6c 6c 0a 63 6f 6e 73 74 20 73 65 61 | let.packageJson.=.null.const.sea |
24660 | 72 63 68 50 61 74 68 73 20 3d 20 5b 27 61 70 70 27 2c 20 27 61 70 70 2e 61 73 61 72 27 2c 20 27 | rchPaths.=.['app',.'app.asar',.' |
24680 | 64 65 66 61 75 6c 74 5f 61 70 70 2e 61 73 61 72 27 5d 0a 66 6f 72 20 28 70 61 63 6b 61 67 65 50 | default_app.asar'].for.(packageP |
246a0 | 61 74 68 20 6f 66 20 73 65 61 72 63 68 50 61 74 68 73 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 | ath.of.searchPaths).{...try.{... |
246c0 | 20 20 70 61 63 6b 61 67 65 50 61 74 68 20 3d 20 70 61 74 68 2e 6a 6f 69 6e 28 70 72 6f 63 65 73 | ..packagePath.=.path.join(proces |
246e0 | 73 2e 72 65 73 6f 75 72 63 65 73 50 61 74 68 2c 20 70 61 63 6b 61 67 65 50 61 74 68 29 0a 20 20 | s.resourcesPath,.packagePath)... |
24700 | 20 20 70 61 63 6b 61 67 65 4a 73 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 70 61 74 68 2e 6a 6f 69 | ..packageJson.=.require(path.joi |
24720 | 6e 28 70 61 63 6b 61 67 65 50 61 74 68 2c 20 27 70 61 63 6b 61 67 65 2e 6a 73 6f 6e 27 29 29 0a | n(packagePath,.'package.json')). |
24740 | 20 20 20 20 62 72 65 61 6b 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 | ....break...}.catch.(error).{... |
24760 | 20 20 63 6f 6e 74 69 6e 75 65 0a 20 20 7d 0a 7d 0a 0a 69 66 20 28 70 61 63 6b 61 67 65 4a 73 6f | ..continue...}.}..if.(packageJso |
24780 | 6e 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 28 | n.==.null).{...process.nextTick( |
247a0 | 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 70 72 6f 63 65 73 73 | function.().{.....return.process |
247c0 | 2e 65 78 69 74 28 31 29 0a 20 20 7d 29 0a 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 | .exit(1)...})...throw.new.Error( |
247e0 | 27 55 6e 61 62 6c 65 20 74 6f 20 66 69 6e 64 20 61 20 76 61 6c 69 64 20 61 70 70 27 29 0a 7d 0a | 'Unable.to.find.a.valid.app').}. |
24800 | 0a 2f 2f 20 53 65 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 27 73 20 76 65 72 73 69 6f 6e 2e 0a 69 | .//.Set.application's.version..i |
24820 | 66 20 28 70 61 63 6b 61 67 65 4a 73 6f 6e 2e 76 65 72 73 69 6f 6e 20 21 3d 20 6e 75 6c 6c 29 20 | f.(packageJson.version.!=.null). |
24840 | 7b 0a 20 20 61 70 70 2e 73 65 74 56 65 72 73 69 6f 6e 28 70 61 63 6b 61 67 65 4a 73 6f 6e 2e 76 | {...app.setVersion(packageJson.v |
24860 | 65 72 73 69 6f 6e 29 0a 7d 0a 0a 2f 2f 20 53 65 74 20 61 70 70 6c 69 63 61 74 69 6f 6e 27 73 20 | ersion).}..//.Set.application's. |
24880 | 6e 61 6d 65 2e 0a 69 66 20 28 70 61 63 6b 61 67 65 4a 73 6f 6e 2e 70 72 6f 64 75 63 74 4e 61 6d | name..if.(packageJson.productNam |
248a0 | 65 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 61 70 70 2e 73 65 74 4e 61 6d 65 28 60 24 7b 70 61 | e.!=.null).{...app.setName(`${pa |
248c0 | 63 6b 61 67 65 4a 73 6f 6e 2e 70 72 6f 64 75 63 74 4e 61 6d 65 7d 60 2e 74 72 69 6d 28 29 29 0a | ckageJson.productName}`.trim()). |
248e0 | 7d 20 65 6c 73 65 20 69 66 20 28 70 61 63 6b 61 67 65 4a 73 6f 6e 2e 6e 61 6d 65 20 21 3d 20 6e | }.else.if.(packageJson.name.!=.n |
24900 | 75 6c 6c 29 20 7b 0a 20 20 61 70 70 2e 73 65 74 4e 61 6d 65 28 60 24 7b 70 61 63 6b 61 67 65 4a | ull).{...app.setName(`${packageJ |
24920 | 73 6f 6e 2e 6e 61 6d 65 7d 60 2e 74 72 69 6d 28 29 29 0a 7d 0a 0a 2f 2f 20 53 65 74 20 61 70 70 | son.name}`.trim()).}..//.Set.app |
24940 | 6c 69 63 61 74 69 6f 6e 27 73 20 64 65 73 6b 74 6f 70 20 6e 61 6d 65 2e 0a 69 66 20 28 70 61 63 | lication's.desktop.name..if.(pac |
24960 | 6b 61 67 65 4a 73 6f 6e 2e 64 65 73 6b 74 6f 70 4e 61 6d 65 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a | kageJson.desktopName.!=.null).{. |
24980 | 20 20 61 70 70 2e 73 65 74 44 65 73 6b 74 6f 70 4e 61 6d 65 28 70 61 63 6b 61 67 65 4a 73 6f 6e | ..app.setDesktopName(packageJson |
249a0 | 2e 64 65 73 6b 74 6f 70 4e 61 6d 65 29 0a 7d 20 65 6c 73 65 20 7b 0a 20 20 61 70 70 2e 73 65 74 | .desktopName).}.else.{...app.set |
249c0 | 44 65 73 6b 74 6f 70 4e 61 6d 65 28 28 61 70 70 2e 67 65 74 4e 61 6d 65 28 29 29 20 2b 20 27 2e | DesktopName((app.getName()).+.'. |
249e0 | 64 65 73 6b 74 6f 70 27 29 0a 7d 0a 0a 2f 2f 20 53 65 74 20 76 38 20 66 6c 61 67 73 0a 69 66 20 | desktop').}..//.Set.v8.flags.if. |
24a00 | 28 70 61 63 6b 61 67 65 4a 73 6f 6e 2e 76 38 46 6c 61 67 73 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a | (packageJson.v8Flags.!=.null).{. |
24a20 | 20 20 76 38 2e 73 65 74 46 6c 61 67 73 46 72 6f 6d 53 74 72 69 6e 67 28 70 61 63 6b 61 67 65 4a | ..v8.setFlagsFromString(packageJ |
24a40 | 73 6f 6e 2e 76 38 46 6c 61 67 73 29 0a 7d 0a 0a 2f 2f 20 53 65 74 20 74 68 65 20 75 73 65 72 20 | son.v8Flags).}..//.Set.the.user. |
24a60 | 70 61 74 68 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 61 70 70 6c 69 63 61 74 69 6f 6e 27 73 20 | path.according.to.application's. |
24a80 | 6e 61 6d 65 2e 0a 61 70 70 2e 73 65 74 50 61 74 68 28 27 75 73 65 72 44 61 74 61 27 2c 20 70 61 | name..app.setPath('userData',.pa |
24aa0 | 74 68 2e 6a 6f 69 6e 28 61 70 70 2e 67 65 74 50 61 74 68 28 27 61 70 70 44 61 74 61 27 29 2c 20 | th.join(app.getPath('appData'),. |
24ac0 | 61 70 70 2e 67 65 74 4e 61 6d 65 28 29 29 29 0a 61 70 70 2e 73 65 74 50 61 74 68 28 27 75 73 65 | app.getName())).app.setPath('use |
24ae0 | 72 43 61 63 68 65 27 2c 20 70 61 74 68 2e 6a 6f 69 6e 28 61 70 70 2e 67 65 74 50 61 74 68 28 27 | rCache',.path.join(app.getPath(' |
24b00 | 63 61 63 68 65 27 29 2c 20 61 70 70 2e 67 65 74 4e 61 6d 65 28 29 29 29 0a 61 70 70 2e 73 65 74 | cache'),.app.getName())).app.set |
24b20 | 41 70 70 50 61 74 68 28 70 61 63 6b 61 67 65 50 61 74 68 29 0a 0a 2f 2f 20 4c 6f 61 64 20 74 68 | AppPath(packagePath)..//.Load.th |
24b40 | 65 20 63 68 72 6f 6d 65 20 65 78 74 65 6e 73 69 6f 6e 20 73 75 70 70 6f 72 74 2e 0a 72 65 71 75 | e.chrome.extension.support..requ |
24b60 | 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f | ire('@electron/internal/browser/ |
24b80 | 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 27 29 0a 0a 63 6f 6e 73 74 20 66 65 61 74 75 72 | chrome-extension')..const.featur |
24ba0 | 65 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 66 65 61 74 75 72 | es.=.process.atomBinding('featur |
24bc0 | 65 73 27 29 0a 69 66 20 28 66 65 61 74 75 72 65 73 2e 69 73 44 65 73 6b 74 6f 70 43 61 70 74 75 | es').if.(features.isDesktopCaptu |
24be0 | 72 65 72 45 6e 61 62 6c 65 64 28 29 29 20 7b 0a 20 20 2f 2f 20 4c 6f 61 64 20 69 6e 74 65 72 6e | rerEnabled()).{...//.Load.intern |
24c00 | 61 6c 20 64 65 73 6b 74 6f 70 2d 63 61 70 74 75 72 65 72 20 6d 6f 64 75 6c 65 2e 0a 20 20 72 65 | al.desktop-capturer.module....re |
24c20 | 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 | quire('@electron/internal/browse |
24c40 | 72 2f 64 65 73 6b 74 6f 70 2d 63 61 70 74 75 72 65 72 27 29 0a 7d 0a 0a 2f 2f 20 4c 6f 61 64 20 | r/desktop-capturer').}..//.Load. |
24c60 | 70 72 6f 74 6f 63 6f 6c 20 6d 6f 64 75 6c 65 20 74 6f 20 65 6e 73 75 72 65 20 69 74 20 69 73 20 | protocol.module.to.ensure.it.is. |
24c80 | 70 6f 70 75 6c 61 74 65 64 20 6f 6e 20 61 70 70 20 72 65 61 64 79 0a 72 65 71 75 69 72 65 28 27 | populated.on.app.ready.require(' |
24ca0 | 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 61 70 69 2f 70 | @electron/internal/browser/api/p |
24cc0 | 72 6f 74 6f 63 6f 6c 27 29 0a 0a 2f 2f 20 53 65 74 20 6d 61 69 6e 20 73 74 61 72 74 75 70 20 73 | rotocol')..//.Set.main.startup.s |
24ce0 | 63 72 69 70 74 20 6f 66 20 74 68 65 20 61 70 70 2e 0a 63 6f 6e 73 74 20 6d 61 69 6e 53 74 61 72 | cript.of.the.app..const.mainStar |
24d00 | 74 75 70 53 63 72 69 70 74 20 3d 20 70 61 63 6b 61 67 65 4a 73 6f 6e 2e 6d 61 69 6e 20 7c 7c 20 | tupScript.=.packageJson.main.||. |
24d20 | 27 69 6e 64 65 78 2e 6a 73 27 0a 0a 63 6f 6e 73 74 20 4b 4e 4f 57 4e 5f 58 44 47 5f 44 45 53 4b | 'index.js'..const.KNOWN_XDG_DESK |
24d40 | 54 4f 50 5f 56 41 4c 55 45 53 20 3d 20 5b 27 50 61 6e 74 68 65 6f 6e 27 2c 20 27 55 6e 69 74 79 | TOP_VALUES.=.['Pantheon',.'Unity |
24d60 | 3a 55 6e 69 74 79 37 27 2c 20 27 70 6f 70 3a 47 4e 4f 4d 45 27 5d 0a 0a 66 75 6e 63 74 69 6f 6e | :Unity7',.'pop:GNOME']..function |
24d80 | 20 63 75 72 72 65 6e 74 50 6c 61 74 66 6f 72 6d 53 75 70 70 6f 72 74 73 41 70 70 49 6e 64 69 63 | .currentPlatformSupportsAppIndic |
24da0 | 61 74 6f 72 20 28 29 20 7b 0a 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d | ator.().{...if.(process.platform |
24dc0 | 20 21 3d 3d 20 27 6c 69 6e 75 78 27 29 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0a 20 20 63 6f 6e | .!==.'linux').return.false...con |
24de0 | 73 74 20 63 75 72 72 65 6e 74 44 65 73 6b 74 6f 70 20 3d 20 70 72 6f 63 65 73 73 2e 65 6e 76 2e | st.currentDesktop.=.process.env. |
24e00 | 58 44 47 5f 43 55 52 52 45 4e 54 5f 44 45 53 4b 54 4f 50 0a 0a 20 20 69 66 20 28 21 63 75 72 72 | XDG_CURRENT_DESKTOP....if.(!curr |
24e20 | 65 6e 74 44 65 73 6b 74 6f 70 29 20 72 65 74 75 72 6e 20 66 61 6c 73 65 0a 20 20 69 66 20 28 4b | entDesktop).return.false...if.(K |
24e40 | 4e 4f 57 4e 5f 58 44 47 5f 44 45 53 4b 54 4f 50 5f 56 41 4c 55 45 53 2e 69 6e 63 6c 75 64 65 73 | NOWN_XDG_DESKTOP_VALUES.includes |
24e60 | 28 63 75 72 72 65 6e 74 44 65 73 6b 74 6f 70 29 29 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 | (currentDesktop)).return.true... |
24e80 | 2f 2f 20 75 62 75 6e 74 75 20 62 61 73 65 64 20 6f 72 20 64 65 72 69 76 65 64 20 73 65 73 73 69 | //.ubuntu.based.or.derived.sessi |
24ea0 | 6f 6e 20 28 64 65 66 61 75 6c 74 20 75 62 75 6e 74 75 20 6f 6e 65 2c 20 63 6f 6d 6d 75 6e 69 74 | on.(default.ubuntu.one,.communit |
24ec0 | 68 65 6d 65 e2 80 a6 29 20 73 75 70 70 6f 72 74 73 0a 20 20 2f 2f 20 69 6e 64 69 63 61 74 6f 72 | heme...).supports...//.indicator |
24ee0 | 20 74 6f 6f 2e 0a 20 20 69 66 20 28 2f 75 62 75 6e 74 75 2f 69 67 2e 74 65 73 74 28 63 75 72 72 | .too....if.(/ubuntu/ig.test(curr |
24f00 | 65 6e 74 44 65 73 6b 74 6f 70 29 29 20 72 65 74 75 72 6e 20 74 72 75 65 0a 0a 20 20 72 65 74 75 | entDesktop)).return.true....retu |
24f20 | 72 6e 20 66 61 6c 73 65 0a 7d 0a 0a 2f 2f 20 57 6f 72 6b 61 72 6f 75 6e 64 20 66 6f 72 20 65 6c | rn.false.}..//.Workaround.for.el |
24f40 | 65 63 74 72 6f 6e 2f 65 6c 65 63 74 72 6f 6e 23 35 30 35 30 20 61 6e 64 20 65 6c 65 63 74 72 6f | ectron/electron#5050.and.electro |
24f60 | 6e 2f 65 6c 65 63 74 72 6f 6e 23 39 30 34 36 0a 69 66 20 28 63 75 72 72 65 6e 74 50 6c 61 74 66 | n/electron#9046.if.(currentPlatf |
24f80 | 6f 72 6d 53 75 70 70 6f 72 74 73 41 70 70 49 6e 64 69 63 61 74 6f 72 28 29 29 20 7b 0a 20 20 70 | ormSupportsAppIndicator()).{...p |
24fa0 | 72 6f 63 65 73 73 2e 65 6e 76 2e 58 44 47 5f 43 55 52 52 45 4e 54 5f 44 45 53 4b 54 4f 50 20 3d | rocess.env.XDG_CURRENT_DESKTOP.= |
24fc0 | 20 27 55 6e 69 74 79 27 0a 7d 0a 0a 2f 2f 20 46 69 6e 61 6c 6c 79 20 6c 6f 61 64 20 61 70 70 27 | .'Unity'.}..//.Finally.load.app' |
24fe0 | 73 20 6d 61 69 6e 2e 6a 73 20 61 6e 64 20 74 72 61 6e 73 66 65 72 20 63 6f 6e 74 72 6f 6c 20 74 | s.main.js.and.transfer.control.t |
25000 | 6f 20 43 2b 2b 2e 0a 4d 6f 64 75 6c 65 2e 5f 6c 6f 61 64 28 70 61 74 68 2e 6a 6f 69 6e 28 70 61 | o.C++..Module._load(path.join(pa |
25020 | 63 6b 61 67 65 50 61 74 68 2c 20 6d 61 69 6e 53 74 61 72 74 75 70 53 63 72 69 70 74 29 2c 20 4d | ckagePath,.mainStartupScript),.M |
25040 | 6f 64 75 6c 65 2c 20 74 72 75 65 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 | odule,.true).'use.strict'..const |
25060 | 20 7b 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 | .{.EventEmitter.}.=.require('eve |
25080 | 6e 74 73 27 29 0a 0a 63 6f 6e 73 74 20 65 6d 69 74 74 65 72 20 3d 20 6e 65 77 20 45 76 65 6e 74 | nts')..const.emitter.=.new.Event |
250a0 | 45 6d 69 74 74 65 72 28 29 0a 0a 2f 2f 20 44 6f 20 6e 6f 74 20 74 68 72 6f 77 20 65 78 63 65 70 | Emitter()..//.Do.not.throw.excep |
250c0 | 74 69 6f 6e 20 77 68 65 6e 20 63 68 61 6e 6e 65 6c 20 6e 61 6d 65 20 69 73 20 22 65 72 72 6f 72 | tion.when.channel.name.is."error |
250e0 | 22 2e 0a 65 6d 69 74 74 65 72 2e 6f 6e 28 27 65 72 72 6f 72 27 2c 20 28 29 20 3d 3e 20 7b 7d 29 | "..emitter.on('error',.().=>.{}) |
25100 | 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 65 6d 69 74 74 65 72 0a 27 75 73 65 20 | ..module.exports.=.emitter.'use. |
25120 | 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e | strict'..const.v8Util.=.process. |
25140 | 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 29 0a 0a 63 6f 6e 73 74 20 67 65 | atomBinding('v8_util')..const.ge |
25160 | 74 4f 77 6e 65 72 4b 65 79 20 3d 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 63 6f 6e 74 65 78 | tOwnerKey.=.(webContents,.contex |
25180 | 74 49 64 29 20 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e 20 60 24 7b 77 65 62 43 6f 6e 74 65 6e 74 | tId).=>.{...return.`${webContent |
251a0 | 73 2e 69 64 7d 2d 24 7b 63 6f 6e 74 65 78 74 49 64 7d 60 0a 7d 0a 0a 63 6c 61 73 73 20 4f 62 6a | s.id}-${contextId}`.}..class.Obj |
251c0 | 65 63 74 73 52 65 67 69 73 74 72 79 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 29 20 | ectsRegistry.{...constructor.(). |
251e0 | 7b 0a 20 20 20 20 74 68 69 73 2e 6e 65 78 74 49 64 20 3d 20 30 0a 0a 20 20 20 20 2f 2f 20 53 74 | {.....this.nextId.=.0......//.St |
25200 | 6f 72 65 73 20 61 6c 6c 20 6f 62 6a 65 63 74 73 20 62 79 20 72 65 66 2d 63 6f 75 6e 74 69 6e 67 | ores.all.objects.by.ref-counting |
25220 | 2e 0a 20 20 20 20 2f 2f 20 28 69 64 29 20 3d 3e 20 7b 6f 62 6a 65 63 74 2c 20 63 6f 75 6e 74 7d | ......//.(id).=>.{object,.count} |
25240 | 0a 20 20 20 20 74 68 69 73 2e 73 74 6f 72 61 67 65 20 3d 20 7b 7d 0a 0a 20 20 20 20 2f 2f 20 53 | .....this.storage.=.{}......//.S |
25260 | 74 6f 72 65 73 20 74 68 65 20 49 44 73 20 6f 66 20 6f 62 6a 65 63 74 73 20 72 65 66 65 72 65 6e | tores.the.IDs.of.objects.referen |
25280 | 63 65 64 20 62 79 20 57 65 62 43 6f 6e 74 65 6e 74 73 2e 0a 20 20 20 20 2f 2f 20 28 6f 77 6e 65 | ced.by.WebContents......//.(owne |
252a0 | 72 4b 65 79 29 20 3d 3e 20 5b 69 64 5d 0a 20 20 20 20 74 68 69 73 2e 6f 77 6e 65 72 73 20 3d 20 | rKey).=>.[id].....this.owners.=. |
252c0 | 7b 7d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 52 65 67 69 73 74 65 72 20 61 20 6e 65 77 20 6f 62 6a 65 | {}...}....//.Register.a.new.obje |
252e0 | 63 74 20 61 6e 64 20 72 65 74 75 72 6e 20 69 74 73 20 61 73 73 69 67 6e 65 64 20 49 44 2e 20 49 | ct.and.return.its.assigned.ID..I |
25300 | 66 20 74 68 65 20 6f 62 6a 65 63 74 20 69 73 20 61 6c 72 65 61 64 79 0a 20 20 2f 2f 20 72 65 67 | f.the.object.is.already...//.reg |
25320 | 69 73 74 65 72 65 64 20 74 68 65 6e 20 74 68 65 20 61 6c 72 65 61 64 79 20 61 73 73 69 67 6e 65 | istered.then.the.already.assigne |
25340 | 64 20 49 44 20 77 6f 75 6c 64 20 62 65 20 72 65 74 75 72 6e 65 64 2e 0a 20 20 61 64 64 20 28 77 | d.ID.would.be.returned....add.(w |
25360 | 65 62 43 6f 6e 74 65 6e 74 73 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 6f 62 6a 29 20 7b 0a 20 20 | ebContents,.contextId,.obj).{... |
25380 | 20 20 2f 2f 20 47 65 74 20 6f 72 20 61 73 73 69 67 6e 20 61 6e 20 49 44 20 74 6f 20 74 68 65 20 | ..//.Get.or.assign.an.ID.to.the. |
253a0 | 6f 62 6a 65 63 74 2e 0a 20 20 20 20 63 6f 6e 73 74 20 69 64 20 3d 20 74 68 69 73 2e 73 61 76 65 | object......const.id.=.this.save |
253c0 | 54 6f 53 74 6f 72 61 67 65 28 6f 62 6a 29 0a 0a 20 20 20 20 2f 2f 20 41 64 64 20 6f 62 6a 65 63 | ToStorage(obj)......//.Add.objec |
253e0 | 74 20 74 6f 20 74 68 65 20 73 65 74 20 6f 66 20 72 65 66 65 72 65 6e 63 65 64 20 6f 62 6a 65 63 | t.to.the.set.of.referenced.objec |
25400 | 74 73 2e 0a 20 20 20 20 63 6f 6e 73 74 20 6f 77 6e 65 72 4b 65 79 20 3d 20 67 65 74 4f 77 6e 65 | ts......const.ownerKey.=.getOwne |
25420 | 72 4b 65 79 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 63 6f 6e 74 65 78 74 49 64 29 0a 20 20 20 | rKey(webContents,.contextId).... |
25440 | 20 6c 65 74 20 6f 77 6e 65 72 20 3d 20 74 68 69 73 2e 6f 77 6e 65 72 73 5b 6f 77 6e 65 72 4b 65 | .let.owner.=.this.owners[ownerKe |
25460 | 79 5d 0a 20 20 20 20 69 66 20 28 21 6f 77 6e 65 72 29 20 7b 0a 20 20 20 20 20 20 6f 77 6e 65 72 | y].....if.(!owner).{.......owner |
25480 | 20 3d 20 74 68 69 73 2e 6f 77 6e 65 72 73 5b 6f 77 6e 65 72 4b 65 79 5d 20 3d 20 6e 65 77 20 53 | .=.this.owners[ownerKey].=.new.S |
254a0 | 65 74 28 29 0a 20 20 20 20 20 20 74 68 69 73 2e 72 65 67 69 73 74 65 72 44 65 6c 65 74 65 4c 69 | et().......this.registerDeleteLi |
254c0 | 73 74 65 6e 65 72 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 63 6f 6e 74 65 78 74 49 64 29 0a 20 | stener(webContents,.contextId).. |
254e0 | 20 20 20 7d 0a 20 20 20 20 69 66 20 28 21 6f 77 6e 65 72 2e 68 61 73 28 69 64 29 29 20 7b 0a 20 | ...}.....if.(!owner.has(id)).{.. |
25500 | 20 20 20 20 20 6f 77 6e 65 72 2e 61 64 64 28 69 64 29 0a 20 20 20 20 20 20 2f 2f 20 49 6e 63 72 | .....owner.add(id).......//.Incr |
25520 | 65 61 73 65 20 72 65 66 65 72 65 6e 63 65 20 63 6f 75 6e 74 20 69 66 20 6e 6f 74 20 72 65 66 65 | ease.reference.count.if.not.refe |
25540 | 72 65 6e 63 65 64 20 62 65 66 6f 72 65 2e 0a 20 20 20 20 20 20 74 68 69 73 2e 73 74 6f 72 61 67 | renced.before........this.storag |
25560 | 65 5b 69 64 5d 2e 63 6f 75 6e 74 2b 2b 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 69 | e[id].count++.....}.....return.i |
25580 | 64 0a 20 20 7d 0a 0a 20 20 2f 2f 20 47 65 74 20 61 6e 20 6f 62 6a 65 63 74 20 61 63 63 6f 72 64 | d...}....//.Get.an.object.accord |
255a0 | 69 6e 67 20 74 6f 20 69 74 73 20 49 44 2e 0a 20 20 67 65 74 20 28 69 64 29 20 7b 0a 20 20 20 20 | ing.to.its.ID....get.(id).{..... |
255c0 | 63 6f 6e 73 74 20 70 6f 69 6e 74 65 72 20 3d 20 74 68 69 73 2e 73 74 6f 72 61 67 65 5b 69 64 5d | const.pointer.=.this.storage[id] |
255e0 | 0a 20 20 20 20 69 66 20 28 70 6f 69 6e 74 65 72 20 21 3d 20 6e 75 6c 6c 29 20 72 65 74 75 72 6e | .....if.(pointer.!=.null).return |
25600 | 20 70 6f 69 6e 74 65 72 2e 6f 62 6a 65 63 74 0a 20 20 7d 0a 0a 20 20 2f 2f 20 44 65 72 65 66 65 | .pointer.object...}....//.Derefe |
25620 | 72 65 6e 63 65 20 61 6e 20 6f 62 6a 65 63 74 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 69 74 73 | rence.an.object.according.to.its |
25640 | 20 49 44 2e 0a 20 20 2f 2f 20 4e 6f 74 65 20 74 68 61 74 20 61 6e 20 6f 62 6a 65 63 74 20 6d 61 | .ID....//.Note.that.an.object.ma |
25660 | 79 20 62 65 20 64 6f 75 62 6c 65 2d 66 72 65 65 64 20 28 63 6c 65 61 72 65 64 20 77 68 65 6e 20 | y.be.double-freed.(cleared.when. |
25680 | 70 61 67 65 20 69 73 20 72 65 6c 6f 61 64 65 64 2c 20 61 6e 64 0a 20 20 2f 2f 20 74 68 65 6e 20 | page.is.reloaded,.and...//.then. |
256a0 | 67 61 72 62 61 67 65 20 63 6f 6c 6c 65 63 74 65 64 20 69 6e 20 6f 6c 64 20 70 61 67 65 29 2e 0a | garbage.collected.in.old.page).. |
256c0 | 20 20 72 65 6d 6f 76 65 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 63 6f 6e 74 65 78 74 49 64 | ..remove.(webContents,.contextId |
256e0 | 2c 20 69 64 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6f 77 6e 65 72 4b 65 79 20 3d 20 67 65 74 | ,.id).{.....const.ownerKey.=.get |
25700 | 4f 77 6e 65 72 4b 65 79 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 63 6f 6e 74 65 78 74 49 64 29 | OwnerKey(webContents,.contextId) |
25720 | 0a 20 20 20 20 63 6f 6e 73 74 20 6f 77 6e 65 72 20 3d 20 74 68 69 73 2e 6f 77 6e 65 72 73 5b 6f | .....const.owner.=.this.owners[o |
25740 | 77 6e 65 72 4b 65 79 5d 0a 20 20 20 20 69 66 20 28 6f 77 6e 65 72 29 20 7b 0a 20 20 20 20 20 20 | wnerKey].....if.(owner).{....... |
25760 | 2f 2f 20 52 65 6d 6f 76 65 20 74 68 65 20 72 65 66 65 72 65 6e 63 65 20 69 6e 20 6f 77 6e 65 72 | //.Remove.the.reference.in.owner |
25780 | 2e 0a 20 20 20 20 20 20 6f 77 6e 65 72 2e 64 65 6c 65 74 65 28 69 64 29 0a 20 20 20 20 20 20 2f | ........owner.delete(id)......./ |
257a0 | 2f 20 44 65 72 65 66 65 72 65 6e 63 65 20 66 72 6f 6d 20 74 68 65 20 73 74 6f 72 61 67 65 2e 0a | /.Dereference.from.the.storage.. |
257c0 | 20 20 20 20 20 20 74 68 69 73 2e 64 65 72 65 66 65 72 65 6e 63 65 28 69 64 29 0a 20 20 20 20 7d | ......this.dereference(id).....} |
257e0 | 0a 20 20 7d 0a 0a 20 20 2f 2f 20 43 6c 65 61 72 20 61 6c 6c 20 72 65 66 65 72 65 6e 63 65 73 20 | ...}....//.Clear.all.references. |
25800 | 74 6f 20 6f 62 6a 65 63 74 73 20 72 65 66 72 65 6e 63 65 64 20 62 79 20 74 68 65 20 57 65 62 43 | to.objects.refrenced.by.the.WebC |
25820 | 6f 6e 74 65 6e 74 73 2e 0a 20 20 63 6c 65 61 72 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 63 | ontents....clear.(webContents,.c |
25840 | 6f 6e 74 65 78 74 49 64 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6f 77 6e 65 72 4b 65 79 20 3d | ontextId).{.....const.ownerKey.= |
25860 | 20 67 65 74 4f 77 6e 65 72 4b 65 79 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 63 6f 6e 74 65 78 | .getOwnerKey(webContents,.contex |
25880 | 74 49 64 29 0a 20 20 20 20 63 6f 6e 73 74 20 6f 77 6e 65 72 20 3d 20 74 68 69 73 2e 6f 77 6e 65 | tId).....const.owner.=.this.owne |
258a0 | 72 73 5b 6f 77 6e 65 72 4b 65 79 5d 0a 20 20 20 20 69 66 20 28 21 6f 77 6e 65 72 29 20 72 65 74 | rs[ownerKey].....if.(!owner).ret |
258c0 | 75 72 6e 0a 0a 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 69 64 20 6f 66 20 6f 77 6e 65 72 29 | urn......for.(const.id.of.owner) |
258e0 | 20 74 68 69 73 2e 64 65 72 65 66 65 72 65 6e 63 65 28 69 64 29 0a 0a 20 20 20 20 64 65 6c 65 74 | .this.dereference(id)......delet |
25900 | 65 20 74 68 69 73 2e 6f 77 6e 65 72 73 5b 6f 77 6e 65 72 4b 65 79 5d 0a 20 20 7d 0a 0a 20 20 2f | e.this.owners[ownerKey]...}..../ |
25920 | 2f 20 50 72 69 76 61 74 65 3a 20 53 61 76 65 73 20 74 68 65 20 6f 62 6a 65 63 74 20 69 6e 74 6f | /.Private:.Saves.the.object.into |
25940 | 20 73 74 6f 72 61 67 65 20 61 6e 64 20 61 73 73 69 67 6e 73 20 61 6e 20 49 44 20 66 6f 72 20 69 | .storage.and.assigns.an.ID.for.i |
25960 | 74 2e 0a 20 20 73 61 76 65 54 6f 53 74 6f 72 61 67 65 20 28 6f 62 6a 65 63 74 29 20 7b 0a 20 20 | t....saveToStorage.(object).{... |
25980 | 20 20 6c 65 74 20 69 64 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 | ..let.id.=.v8Util.getHiddenValue |
259a0 | 28 6f 62 6a 65 63 74 2c 20 27 61 74 6f 6d 49 64 27 29 0a 20 20 20 20 69 66 20 28 21 69 64 29 20 | (object,.'atomId').....if.(!id). |
259c0 | 7b 0a 20 20 20 20 20 20 69 64 20 3d 20 2b 2b 74 68 69 73 2e 6e 65 78 74 49 64 0a 20 20 20 20 20 | {.......id.=.++this.nextId...... |
259e0 | 20 74 68 69 73 2e 73 74 6f 72 61 67 65 5b 69 64 5d 20 3d 20 7b 0a 20 20 20 20 20 20 20 20 63 6f | .this.storage[id].=.{.........co |
25a00 | 75 6e 74 3a 20 30 2c 0a 20 20 20 20 20 20 20 20 6f 62 6a 65 63 74 3a 20 6f 62 6a 65 63 74 0a 20 | unt:.0,.........object:.object.. |
25a20 | 20 20 20 20 20 7d 0a 20 20 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c | .....}.......v8Util.setHiddenVal |
25a40 | 75 65 28 6f 62 6a 65 63 74 2c 20 27 61 74 6f 6d 49 64 27 2c 20 69 64 29 0a 20 20 20 20 7d 0a 20 | ue(object,.'atomId',.id).....}.. |
25a60 | 20 20 20 72 65 74 75 72 6e 20 69 64 0a 20 20 7d 0a 0a 20 20 2f 2f 20 50 72 69 76 61 74 65 3a 20 | ...return.id...}....//.Private:. |
25a80 | 44 65 72 65 66 65 72 65 6e 63 65 20 74 68 65 20 6f 62 6a 65 63 74 20 66 72 6f 6d 20 73 74 6f 72 | Dereference.the.object.from.stor |
25aa0 | 65 2e 0a 20 20 64 65 72 65 66 65 72 65 6e 63 65 20 28 69 64 29 20 7b 0a 20 20 20 20 63 6f 6e 73 | e....dereference.(id).{.....cons |
25ac0 | 74 20 70 6f 69 6e 74 65 72 20 3d 20 74 68 69 73 2e 73 74 6f 72 61 67 65 5b 69 64 5d 0a 20 20 20 | t.pointer.=.this.storage[id].... |
25ae0 | 20 69 66 20 28 70 6f 69 6e 74 65 72 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 72 65 | .if.(pointer.==.null).{.......re |
25b00 | 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 70 6f 69 6e 74 65 72 2e 63 6f 75 6e 74 20 2d 3d 20 | turn.....}.....pointer.count.-=. |
25b20 | 31 0a 20 20 20 20 69 66 20 28 70 6f 69 6e 74 65 72 2e 63 6f 75 6e 74 20 3d 3d 3d 20 30 29 20 7b | 1.....if.(pointer.count.===.0).{ |
25b40 | 0a 20 20 20 20 20 20 76 38 55 74 69 6c 2e 64 65 6c 65 74 65 48 69 64 64 65 6e 56 61 6c 75 65 28 | .......v8Util.deleteHiddenValue( |
25b60 | 70 6f 69 6e 74 65 72 2e 6f 62 6a 65 63 74 2c 20 27 61 74 6f 6d 49 64 27 29 0a 20 20 20 20 20 20 | pointer.object,.'atomId')....... |
25b80 | 64 65 6c 65 74 65 20 74 68 69 73 2e 73 74 6f 72 61 67 65 5b 69 64 5d 0a 20 20 20 20 7d 0a 20 20 | delete.this.storage[id].....}... |
25ba0 | 7d 0a 0a 20 20 2f 2f 20 50 72 69 76 61 74 65 3a 20 43 6c 65 61 72 20 74 68 65 20 73 74 6f 72 61 | }....//.Private:.Clear.the.stora |
25bc0 | 67 65 20 77 68 65 6e 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 73 20 69 73 20 64 65 73 74 | ge.when.renderer.process.is.dest |
25be0 | 72 6f 79 65 64 2e 0a 20 20 72 65 67 69 73 74 65 72 44 65 6c 65 74 65 4c 69 73 74 65 6e 65 72 20 | royed....registerDeleteListener. |
25c00 | 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 63 6f 6e 74 65 78 74 49 64 29 20 7b 0a 20 20 20 20 2f | (webContents,.contextId).{...../ |
25c20 | 2f 20 63 6f 6e 74 65 78 74 49 64 20 3d 3e 20 24 7b 70 72 6f 63 65 73 73 48 6f 73 74 49 64 7d 2d | /.contextId.=>.${processHostId}- |
25c40 | 24 7b 63 6f 6e 74 65 78 74 43 6f 75 6e 74 7d 0a 20 20 20 20 63 6f 6e 73 74 20 70 72 6f 63 65 73 | ${contextCount}.....const.proces |
25c60 | 73 48 6f 73 74 49 64 20 3d 20 63 6f 6e 74 65 78 74 49 64 2e 73 70 6c 69 74 28 27 2d 27 29 5b 30 | sHostId.=.contextId.split('-')[0 |
25c80 | 5d 0a 20 20 20 20 63 6f 6e 73 74 20 6c 69 73 74 65 6e 65 72 20 3d 20 28 65 76 65 6e 74 2c 20 64 | ].....const.listener.=.(event,.d |
25ca0 | 65 6c 65 74 65 64 50 72 6f 63 65 73 73 48 6f 73 74 49 64 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 | eletedProcessHostId).=>.{....... |
25cc0 | 69 66 20 28 64 65 6c 65 74 65 64 50 72 6f 63 65 73 73 48 6f 73 74 49 64 20 26 26 0a 20 20 20 20 | if.(deletedProcessHostId.&&..... |
25ce0 | 20 20 20 20 20 20 64 65 6c 65 74 65 64 50 72 6f 63 65 73 73 48 6f 73 74 49 64 2e 74 6f 53 74 72 | ......deletedProcessHostId.toStr |
25d00 | 69 6e 67 28 29 20 3d 3d 3d 20 70 72 6f 63 65 73 73 48 6f 73 74 49 64 29 20 7b 0a 20 20 20 20 20 | ing().===.processHostId).{...... |
25d20 | 20 20 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 27 72 | ...webContents.removeListener('r |
25d40 | 65 6e 64 65 72 2d 76 69 65 77 2d 64 65 6c 65 74 65 64 27 2c 20 6c 69 73 74 65 6e 65 72 29 0a 20 | ender-view-deleted',.listener).. |
25d60 | 20 20 20 20 20 20 20 74 68 69 73 2e 63 6c 65 61 72 28 77 65 62 43 6f 6e 74 65 6e 74 73 2c 20 63 | .......this.clear(webContents,.c |
25d80 | 6f 6e 74 65 78 74 49 64 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 20 20 77 65 62 43 | ontextId).......}.....}.....webC |
25da0 | 6f 6e 74 65 6e 74 73 2e 6f 6e 28 27 72 65 6e 64 65 72 2d 76 69 65 77 2d 64 65 6c 65 74 65 64 27 | ontents.on('render-view-deleted' |
25dc0 | 2c 20 6c 69 73 74 65 6e 65 72 29 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 | ,.listener)...}.}..module.export |
25de0 | 73 20 3d 20 6e 65 77 20 4f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 28 29 0a 27 75 73 65 20 73 | s.=.new.ObjectsRegistry().'use.s |
25e00 | 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 65 6c 65 63 74 72 6f 6e 20 3d 20 72 65 71 75 69 72 65 | trict'..const.electron.=.require |
25e20 | 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d 69 74 74 65 | ('electron').const.{.EventEmitte |
25e40 | 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 66 73 | r.}.=.require('events').const.fs |
25e60 | 20 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 29 0a 63 6f 6e 73 74 20 76 38 55 74 69 6c 20 3d 20 | .=.require('fs').const.v8Util.=. |
25e80 | 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 29 0a 63 | process.atomBinding('v8_util').c |
25ea0 | 6f 6e 73 74 20 65 76 65 6e 74 42 69 6e 64 69 6e 67 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d | onst.eventBinding.=.process.atom |
25ec0 | 42 69 6e 64 69 6e 67 28 27 65 76 65 6e 74 27 29 0a 0a 63 6f 6e 73 74 20 7b 20 69 73 50 72 6f 6d | Binding('event')..const.{.isProm |
25ee0 | 69 73 65 20 7d 20 3d 20 65 6c 65 63 74 72 6f 6e 0a 0a 63 6f 6e 73 74 20 7b 20 63 72 61 73 68 52 | ise.}.=.electron..const.{.crashR |
25f00 | 65 70 6f 72 74 65 72 49 6e 69 74 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 | eporterInit.}.=.require('@electr |
25f20 | 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 63 72 61 73 68 2d 72 65 70 6f 72 74 | on/internal/browser/crash-report |
25f40 | 65 72 2d 69 6e 69 74 27 29 0a 63 6f 6e 73 74 20 69 70 63 4d 61 69 6e 20 3d 20 72 65 71 75 69 72 | er-init').const.ipcMain.=.requir |
25f60 | 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 69 70 | e('@electron/internal/browser/ip |
25f80 | 63 2d 6d 61 69 6e 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 63 6f 6e 73 74 20 6f 62 6a 65 63 74 73 52 | c-main-internal').const.objectsR |
25fa0 | 65 67 69 73 74 72 79 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 | egistry.=.require('@electron/int |
25fc0 | 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 6f 62 6a 65 63 74 73 2d 72 65 67 69 73 74 72 79 27 29 | ernal/browser/objects-registry') |
25fe0 | 0a 63 6f 6e 73 74 20 67 75 65 73 74 56 69 65 77 4d 61 6e 61 67 65 72 20 3d 20 72 65 71 75 69 72 | .const.guestViewManager.=.requir |
26000 | 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 67 75 | e('@electron/internal/browser/gu |
26020 | 65 73 74 2d 76 69 65 77 2d 6d 61 6e 61 67 65 72 27 29 0a 63 6f 6e 73 74 20 62 75 66 66 65 72 55 | est-view-manager').const.bufferU |
26040 | 74 69 6c 73 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e | tils.=.require('@electron/intern |
26060 | 61 6c 2f 63 6f 6d 6d 6f 6e 2f 62 75 66 66 65 72 2d 75 74 69 6c 73 27 29 0a 63 6f 6e 73 74 20 65 | al/common/buffer-utils').const.e |
26080 | 72 72 6f 72 55 74 69 6c 73 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 | rrorUtils.=.require('@electron/i |
260a0 | 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 65 72 72 6f 72 2d 75 74 69 6c 73 27 29 0a 0a 63 6f | nternal/common/error-utils')..co |
260c0 | 6e 73 74 20 68 61 73 50 72 6f 70 20 3d 20 7b 7d 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 0a | nst.hasProp.=.{}.hasOwnProperty. |
260e0 | 0a 2f 2f 20 54 68 65 20 69 6e 74 65 72 6e 61 6c 20 70 72 6f 70 65 72 74 69 65 73 20 6f 66 20 46 | .//.The.internal.properties.of.F |
26100 | 75 6e 63 74 69 6f 6e 2e 0a 63 6f 6e 73 74 20 46 55 4e 43 54 49 4f 4e 5f 50 52 4f 50 45 52 54 49 | unction..const.FUNCTION_PROPERTI |
26120 | 45 53 20 3d 20 5b 0a 20 20 27 6c 65 6e 67 74 68 27 2c 20 27 6e 61 6d 65 27 2c 20 27 61 72 67 75 | ES.=.[...'length',.'name',.'argu |
26140 | 6d 65 6e 74 73 27 2c 20 27 63 61 6c 6c 65 72 27 2c 20 27 70 72 6f 74 6f 74 79 70 65 27 0a 5d 0a | ments',.'caller',.'prototype'.]. |
26160 | 0a 2f 2f 20 54 68 65 20 72 65 6d 6f 74 65 20 66 75 6e 63 74 69 6f 6e 73 20 69 6e 20 72 65 6e 64 | .//.The.remote.functions.in.rend |
26180 | 65 72 65 72 20 70 72 6f 63 65 73 73 65 73 2e 0a 2f 2f 20 69 64 20 3d 3e 20 46 75 6e 63 74 69 6f | erer.processes..//.id.=>.Functio |
261a0 | 6e 0a 63 6f 6e 73 74 20 72 65 6e 64 65 72 65 72 46 75 6e 63 74 69 6f 6e 73 20 3d 20 76 38 55 74 | n.const.rendererFunctions.=.v8Ut |
261c0 | 69 6c 2e 63 72 65 61 74 65 44 6f 75 62 6c 65 49 44 57 65 61 6b 4d 61 70 28 29 0a 0a 2f 2f 20 52 | il.createDoubleIDWeakMap()..//.R |
261e0 | 65 74 75 72 6e 20 74 68 65 20 64 65 73 63 72 69 70 74 69 6f 6e 20 6f 66 20 6f 62 6a 65 63 74 27 | eturn.the.description.of.object' |
26200 | 73 20 6d 65 6d 62 65 72 73 3a 0a 63 6f 6e 73 74 20 67 65 74 4f 62 6a 65 63 74 4d 65 6d 62 65 72 | s.members:.const.getObjectMember |
26220 | 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6f 62 6a 65 63 74 29 20 7b 0a 20 20 6c 65 74 20 6e 61 | s.=.function.(object).{...let.na |
26240 | 6d 65 73 20 3d 20 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 4e 61 6d 65 73 | mes.=.Object.getOwnPropertyNames |
26260 | 28 6f 62 6a 65 63 74 29 0a 20 20 2f 2f 20 46 6f 72 20 46 75 6e 63 74 69 6f 6e 2c 20 77 65 20 73 | (object)...//.For.Function,.we.s |
26280 | 68 6f 75 6c 64 20 6e 6f 74 20 6f 76 65 72 72 69 64 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 70 72 6f | hould.not.override.following.pro |
262a0 | 70 65 72 74 69 65 73 20 65 76 65 6e 20 74 68 6f 75 67 68 20 74 68 65 79 0a 20 20 2f 2f 20 61 72 | perties.even.though.they...//.ar |
262c0 | 65 20 22 6f 77 6e 22 20 70 72 6f 70 65 72 74 69 65 73 2e 0a 20 20 69 66 20 28 74 79 70 65 6f 66 | e."own".properties....if.(typeof |
262e0 | 20 6f 62 6a 65 63 74 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 6e 61 | .object.===.'function').{.....na |
26300 | 6d 65 73 20 3d 20 6e 61 6d 65 73 2e 66 69 6c 74 65 72 28 28 6e 61 6d 65 29 20 3d 3e 20 7b 0a 20 | mes.=.names.filter((name).=>.{.. |
26320 | 20 20 20 20 20 72 65 74 75 72 6e 20 21 46 55 4e 43 54 49 4f 4e 5f 50 52 4f 50 45 52 54 49 45 53 | .....return.!FUNCTION_PROPERTIES |
26340 | 2e 69 6e 63 6c 75 64 65 73 28 6e 61 6d 65 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 20 20 2f 2f 20 | .includes(name).....})...}...//. |
26360 | 4d 61 70 20 70 72 6f 70 65 72 74 69 65 73 20 74 6f 20 64 65 73 63 72 69 70 74 6f 72 73 2e 0a 20 | Map.properties.to.descriptors... |
26380 | 20 72 65 74 75 72 6e 20 6e 61 6d 65 73 2e 6d 61 70 28 28 6e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 | .return.names.map((name).=>.{... |
263a0 | 20 20 63 6f 6e 73 74 20 64 65 73 63 72 69 70 74 6f 72 20 3d 20 4f 62 6a 65 63 74 2e 67 65 74 4f | ..const.descriptor.=.Object.getO |
263c0 | 77 6e 50 72 6f 70 65 72 74 79 44 65 73 63 72 69 70 74 6f 72 28 6f 62 6a 65 63 74 2c 20 6e 61 6d | wnPropertyDescriptor(object,.nam |
263e0 | 65 29 0a 20 20 20 20 63 6f 6e 73 74 20 6d 65 6d 62 65 72 20 3d 20 7b 20 6e 61 6d 65 2c 20 65 6e | e).....const.member.=.{.name,.en |
26400 | 75 6d 65 72 61 62 6c 65 3a 20 64 65 73 63 72 69 70 74 6f 72 2e 65 6e 75 6d 65 72 61 62 6c 65 2c | umerable:.descriptor.enumerable, |
26420 | 20 77 72 69 74 61 62 6c 65 3a 20 66 61 6c 73 65 20 7d 0a 20 20 20 20 69 66 20 28 64 65 73 63 72 | .writable:.false.}.....if.(descr |
26440 | 69 70 74 6f 72 2e 67 65 74 20 3d 3d 3d 20 75 6e 64 65 66 69 6e 65 64 20 26 26 20 74 79 70 65 6f | iptor.get.===.undefined.&&.typeo |
26460 | 66 20 6f 62 6a 65 63 74 5b 6e 61 6d 65 5d 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b | f.object[name].===.'function').{ |
26480 | 0a 20 20 20 20 20 20 6d 65 6d 62 65 72 2e 74 79 70 65 20 3d 20 27 6d 65 74 68 6f 64 27 0a 20 20 | .......member.type.=.'method'... |
264a0 | 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 69 66 20 28 64 65 73 63 72 69 70 74 6f 72 2e | ..}.else.{.......if.(descriptor. |
264c0 | 73 65 74 20 7c 7c 20 64 65 73 63 72 69 70 74 6f 72 2e 77 72 69 74 61 62 6c 65 29 20 6d 65 6d 62 | set.||.descriptor.writable).memb |
264e0 | 65 72 2e 77 72 69 74 61 62 6c 65 20 3d 20 74 72 75 65 0a 20 20 20 20 20 20 6d 65 6d 62 65 72 2e | er.writable.=.true.......member. |
26500 | 74 79 70 65 20 3d 20 27 67 65 74 27 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 6d 65 | type.=.'get'.....}.....return.me |
26520 | 6d 62 65 72 0a 20 20 7d 29 0a 7d 0a 0a 2f 2f 20 52 65 74 75 72 6e 20 74 68 65 20 64 65 73 63 72 | mber...}).}..//.Return.the.descr |
26540 | 69 70 74 69 6f 6e 20 6f 66 20 6f 62 6a 65 63 74 27 73 20 70 72 6f 74 6f 74 79 70 65 2e 0a 63 6f | iption.of.object's.prototype..co |
26560 | 6e 73 74 20 67 65 74 4f 62 6a 65 63 74 50 72 6f 74 6f 74 79 70 65 20 3d 20 66 75 6e 63 74 69 6f | nst.getObjectPrototype.=.functio |
26580 | 6e 20 28 6f 62 6a 65 63 74 29 20 7b 0a 20 20 63 6f 6e 73 74 20 70 72 6f 74 6f 20 3d 20 4f 62 6a | n.(object).{...const.proto.=.Obj |
265a0 | 65 63 74 2e 67 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 6f 62 6a 65 63 74 29 0a 20 20 69 66 20 | ect.getPrototypeOf(object)...if. |
265c0 | 28 70 72 6f 74 6f 20 3d 3d 3d 20 6e 75 6c 6c 20 7c 7c 20 70 72 6f 74 6f 20 3d 3d 3d 20 4f 62 6a | (proto.===.null.||.proto.===.Obj |
265e0 | 65 63 74 2e 70 72 6f 74 6f 74 79 70 65 29 20 72 65 74 75 72 6e 20 6e 75 6c 6c 0a 20 20 72 65 74 | ect.prototype).return.null...ret |
26600 | 75 72 6e 20 7b 0a 20 20 20 20 6d 65 6d 62 65 72 73 3a 20 67 65 74 4f 62 6a 65 63 74 4d 65 6d 62 | urn.{.....members:.getObjectMemb |
26620 | 65 72 73 28 70 72 6f 74 6f 29 2c 0a 20 20 20 20 70 72 6f 74 6f 3a 20 67 65 74 4f 62 6a 65 63 74 | ers(proto),.....proto:.getObject |
26640 | 50 72 6f 74 6f 74 79 70 65 28 70 72 6f 74 6f 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 43 6f 6e 76 65 | Prototype(proto)...}.}..//.Conve |
26660 | 72 74 20 61 20 72 65 61 6c 20 76 61 6c 75 65 20 69 6e 74 6f 20 6d 65 74 61 20 64 61 74 61 2e 0a | rt.a.real.value.into.meta.data.. |
26680 | 63 6f 6e 73 74 20 76 61 6c 75 65 54 6f 4d 65 74 61 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 65 | const.valueToMeta.=.function.(se |
266a0 | 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 76 61 6c 75 65 2c 20 6f 70 74 69 6d 69 7a 65 | nder,.contextId,.value,.optimize |
266c0 | 53 69 6d 70 6c 65 4f 62 6a 65 63 74 20 3d 20 66 61 6c 73 65 29 20 7b 0a 20 20 2f 2f 20 44 65 74 | SimpleObject.=.false).{...//.Det |
266e0 | 65 72 6d 69 6e 65 20 74 68 65 20 74 79 70 65 20 6f 66 20 76 61 6c 75 65 2e 0a 20 20 63 6f 6e 73 | ermine.the.type.of.value....cons |
26700 | 74 20 6d 65 74 61 20 3d 20 7b 20 74 79 70 65 3a 20 74 79 70 65 6f 66 20 76 61 6c 75 65 20 7d 0a | t.meta.=.{.type:.typeof.value.}. |
26720 | 20 20 69 66 20 28 6d 65 74 61 2e 74 79 70 65 20 3d 3d 3d 20 27 6f 62 6a 65 63 74 27 29 20 7b 0a | ..if.(meta.type.===.'object').{. |
26740 | 20 20 20 20 2f 2f 20 52 65 63 6f 67 6e 69 7a 65 20 63 65 72 74 61 69 6e 20 74 79 70 65 73 20 6f | ....//.Recognize.certain.types.o |
26760 | 66 20 6f 62 6a 65 63 74 73 2e 0a 20 20 20 20 69 66 20 28 76 61 6c 75 65 20 3d 3d 3d 20 6e 75 6c | f.objects......if.(value.===.nul |
26780 | 6c 29 20 7b 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 79 70 65 20 3d 20 27 76 61 6c 75 65 27 0a 20 | l).{.......meta.type.=.'value'.. |
267a0 | 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 62 75 66 66 65 72 55 74 69 6c 73 2e 69 73 42 75 66 66 | ...}.else.if.(bufferUtils.isBuff |
267c0 | 65 72 28 76 61 6c 75 65 29 29 20 7b 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 79 70 65 20 3d 20 27 | er(value)).{.......meta.type.=.' |
267e0 | 62 75 66 66 65 72 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 41 72 72 61 79 2e 69 73 41 | buffer'.....}.else.if.(Array.isA |
26800 | 72 72 61 79 28 76 61 6c 75 65 29 29 20 7b 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 79 70 65 20 3d | rray(value)).{.......meta.type.= |
26820 | 20 27 61 72 72 61 79 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 76 61 6c 75 65 20 69 6e | .'array'.....}.else.if.(value.in |
26840 | 73 74 61 6e 63 65 6f 66 20 45 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 79 70 | stanceof.Error).{.......meta.typ |
26860 | 65 20 3d 20 27 65 72 72 6f 72 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 76 61 6c 75 65 | e.=.'error'.....}.else.if.(value |
26880 | 20 69 6e 73 74 61 6e 63 65 6f 66 20 44 61 74 65 29 20 7b 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 | .instanceof.Date).{.......meta.t |
268a0 | 79 70 65 20 3d 20 27 64 61 74 65 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 69 73 50 72 | ype.=.'date'.....}.else.if.(isPr |
268c0 | 6f 6d 69 73 65 28 76 61 6c 75 65 29 29 20 7b 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 79 70 65 20 | omise(value)).{.......meta.type. |
268e0 | 3d 20 27 70 72 6f 6d 69 73 65 27 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 68 61 73 50 72 | =.'promise'.....}.else.if.(hasPr |
26900 | 6f 70 2e 63 61 6c 6c 28 76 61 6c 75 65 2c 20 27 63 61 6c 6c 65 65 27 29 20 26 26 20 76 61 6c 75 | op.call(value,.'callee').&&.valu |
26920 | 65 2e 6c 65 6e 67 74 68 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 54 72 65 | e.length.!=.null).{.......//.Tre |
26940 | 61 74 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 6f 62 6a 65 63 74 20 61 73 20 61 72 72 61 79 | at.the.arguments.object.as.array |
26960 | 2e 0a 20 20 20 20 20 20 6d 65 74 61 2e 74 79 70 65 20 3d 20 27 61 72 72 61 79 27 0a 20 20 20 20 | ........meta.type.=.'array'..... |
26980 | 7d 20 65 6c 73 65 20 69 66 20 28 6f 70 74 69 6d 69 7a 65 53 69 6d 70 6c 65 4f 62 6a 65 63 74 20 | }.else.if.(optimizeSimpleObject. |
269a0 | 26 26 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 76 61 6c 75 65 2c 20 | &&.v8Util.getHiddenValue(value,. |
269c0 | 27 73 69 6d 70 6c 65 27 29 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 54 72 65 61 74 20 73 69 6d 70 | 'simple')).{.......//.Treat.simp |
269e0 | 6c 65 20 6f 62 6a 65 63 74 73 20 61 73 20 76 61 6c 75 65 2e 0a 20 20 20 20 20 20 6d 65 74 61 2e | le.objects.as.value........meta. |
26a00 | 74 79 70 65 20 3d 20 27 76 61 6c 75 65 27 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 46 | type.=.'value'.....}...}....//.F |
26a20 | 69 6c 6c 20 74 68 65 20 6d 65 74 61 20 6f 62 6a 65 63 74 20 61 63 63 6f 72 64 69 6e 67 20 74 6f | ill.the.meta.object.according.to |
26a40 | 20 76 61 6c 75 65 27 73 20 74 79 70 65 2e 0a 20 20 69 66 20 28 6d 65 74 61 2e 74 79 70 65 20 3d | .value's.type....if.(meta.type.= |
26a60 | 3d 3d 20 27 61 72 72 61 79 27 29 20 7b 0a 20 20 20 20 6d 65 74 61 2e 6d 65 6d 62 65 72 73 20 3d | ==.'array').{.....meta.members.= |
26a80 | 20 76 61 6c 75 65 2e 6d 61 70 28 28 65 6c 29 20 3d 3e 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 73 | .value.map((el).=>.valueToMeta(s |
26aa0 | 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 65 6c 2c 20 6f 70 74 69 6d 69 7a 65 53 69 | ender,.contextId,.el,.optimizeSi |
26ac0 | 6d 70 6c 65 4f 62 6a 65 63 74 29 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 6d 65 74 61 2e 74 | mpleObject))...}.else.if.(meta.t |
26ae0 | 79 70 65 20 3d 3d 3d 20 27 6f 62 6a 65 63 74 27 20 7c 7c 20 6d 65 74 61 2e 74 79 70 65 20 3d 3d | ype.===.'object'.||.meta.type.== |
26b00 | 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 6d 65 74 61 2e 6e 61 6d 65 20 3d 20 | =.'function').{.....meta.name.=. |
26b20 | 76 61 6c 75 65 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 3f 20 76 61 6c 75 65 2e 63 6f 6e 73 74 72 | value.constructor.?.value.constr |
26b40 | 75 63 74 6f 72 2e 6e 61 6d 65 20 3a 20 27 27 0a 0a 20 20 20 20 2f 2f 20 52 65 66 65 72 65 6e 63 | uctor.name.:.''......//.Referenc |
26b60 | 65 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 76 61 6c 75 65 20 69 66 20 69 74 27 73 20 61 6e 20 | e.the.original.value.if.it's.an. |
26b80 | 6f 62 6a 65 63 74 2c 20 62 65 63 61 75 73 65 20 77 68 65 6e 20 69 74 27 73 0a 20 20 20 20 2f 2f | object,.because.when.it's.....// |
26ba0 | 20 70 61 73 73 65 64 20 74 6f 20 72 65 6e 64 65 72 65 72 20 77 65 20 77 6f 75 6c 64 20 61 73 73 | .passed.to.renderer.we.would.ass |
26bc0 | 75 6d 65 20 74 68 65 20 72 65 6e 64 65 72 65 72 20 6b 65 65 70 73 20 61 20 72 65 66 65 72 65 6e | ume.the.renderer.keeps.a.referen |
26be0 | 63 65 20 6f 66 0a 20 20 20 20 2f 2f 20 69 74 2e 0a 20 20 20 20 6d 65 74 61 2e 69 64 20 3d 20 6f | ce.of.....//.it......meta.id.=.o |
26c00 | 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 61 64 64 28 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 | bjectsRegistry.add(sender,.conte |
26c20 | 78 74 49 64 2c 20 76 61 6c 75 65 29 0a 20 20 20 20 6d 65 74 61 2e 6d 65 6d 62 65 72 73 20 3d 20 | xtId,.value).....meta.members.=. |
26c40 | 67 65 74 4f 62 6a 65 63 74 4d 65 6d 62 65 72 73 28 76 61 6c 75 65 29 0a 20 20 20 20 6d 65 74 61 | getObjectMembers(value).....meta |
26c60 | 2e 70 72 6f 74 6f 20 3d 20 67 65 74 4f 62 6a 65 63 74 50 72 6f 74 6f 74 79 70 65 28 76 61 6c 75 | .proto.=.getObjectPrototype(valu |
26c80 | 65 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 6d 65 74 61 2e 74 79 70 65 20 3d 3d 3d 20 27 62 | e)...}.else.if.(meta.type.===.'b |
26ca0 | 75 66 66 65 72 27 29 20 7b 0a 20 20 20 20 6d 65 74 61 2e 76 61 6c 75 65 20 3d 20 62 75 66 66 65 | uffer').{.....meta.value.=.buffe |
26cc0 | 72 55 74 69 6c 73 2e 62 75 66 66 65 72 54 6f 4d 65 74 61 28 76 61 6c 75 65 29 0a 20 20 7d 20 65 | rUtils.bufferToMeta(value)...}.e |
26ce0 | 6c 73 65 20 69 66 20 28 6d 65 74 61 2e 74 79 70 65 20 3d 3d 3d 20 27 70 72 6f 6d 69 73 65 27 29 | lse.if.(meta.type.===.'promise') |
26d00 | 20 7b 0a 20 20 20 20 2f 2f 20 41 64 64 20 64 65 66 61 75 6c 74 20 68 61 6e 64 6c 65 72 20 74 6f | .{.....//.Add.default.handler.to |
26d20 | 20 70 72 65 76 65 6e 74 20 75 6e 68 61 6e 64 6c 65 64 20 72 65 6a 65 63 74 69 6f 6e 73 20 69 6e | .prevent.unhandled.rejections.in |
26d40 | 20 6d 61 69 6e 20 70 72 6f 63 65 73 73 0a 20 20 20 20 2f 2f 20 49 6e 73 74 65 61 64 20 74 68 65 | .main.process.....//.Instead.the |
26d60 | 79 20 73 68 6f 75 6c 64 20 61 70 70 65 61 72 20 69 6e 20 74 68 65 20 72 65 6e 64 65 72 65 72 20 | y.should.appear.in.the.renderer. |
26d80 | 70 72 6f 63 65 73 73 0a 20 20 20 20 76 61 6c 75 65 2e 74 68 65 6e 28 66 75 6e 63 74 69 6f 6e 20 | process.....value.then(function. |
26da0 | 28 29 20 7b 7d 2c 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 7d 29 0a 0a 20 20 20 20 6d 65 74 61 | ().{},.function.().{})......meta |
26dc0 | 2e 74 68 65 6e 20 3d 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 73 65 6e 64 65 72 2c 20 63 6f 6e 74 | .then.=.valueToMeta(sender,.cont |
26de0 | 65 78 74 49 64 2c 20 66 75 6e 63 74 69 6f 6e 20 28 6f 6e 46 75 6c 66 69 6c 6c 65 64 2c 20 6f 6e | extId,.function.(onFulfilled,.on |
26e00 | 52 65 6a 65 63 74 65 64 29 20 7b 0a 20 20 20 20 20 20 76 61 6c 75 65 2e 74 68 65 6e 28 6f 6e 46 | Rejected).{.......value.then(onF |
26e20 | 75 6c 66 69 6c 6c 65 64 2c 20 6f 6e 52 65 6a 65 63 74 65 64 29 0a 20 20 20 20 7d 29 0a 20 20 7d | ulfilled,.onRejected).....})...} |
26e40 | 20 65 6c 73 65 20 69 66 20 28 6d 65 74 61 2e 74 79 70 65 20 3d 3d 3d 20 27 65 72 72 6f 72 27 29 | .else.if.(meta.type.===.'error') |
26e60 | 20 7b 0a 20 20 20 20 6d 65 74 61 2e 6d 65 6d 62 65 72 73 20 3d 20 70 6c 61 69 6e 4f 62 6a 65 63 | .{.....meta.members.=.plainObjec |
26e80 | 74 54 6f 4d 65 74 61 28 76 61 6c 75 65 29 0a 0a 20 20 20 20 2f 2f 20 45 72 72 6f 72 2e 6e 61 6d | tToMeta(value)......//.Error.nam |
26ea0 | 65 20 69 73 20 6e 6f 74 20 70 61 72 74 20 6f 66 20 6f 77 6e 20 70 72 6f 70 65 72 74 69 65 73 2e | e.is.not.part.of.own.properties. |
26ec0 | 0a 20 20 20 20 6d 65 74 61 2e 6d 65 6d 62 65 72 73 2e 70 75 73 68 28 7b 0a 20 20 20 20 20 20 6e | .....meta.members.push({.......n |
26ee0 | 61 6d 65 3a 20 27 6e 61 6d 65 27 2c 0a 20 20 20 20 20 20 76 61 6c 75 65 3a 20 76 61 6c 75 65 2e | ame:.'name',.......value:.value. |
26f00 | 6e 61 6d 65 0a 20 20 20 20 7d 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 6d 65 74 61 2e 74 79 | name.....})...}.else.if.(meta.ty |
26f20 | 70 65 20 3d 3d 3d 20 27 64 61 74 65 27 29 20 7b 0a 20 20 20 20 6d 65 74 61 2e 76 61 6c 75 65 20 | pe.===.'date').{.....meta.value. |
26f40 | 3d 20 76 61 6c 75 65 2e 67 65 74 54 69 6d 65 28 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 | =.value.getTime()...}.else.{.... |
26f60 | 20 6d 65 74 61 2e 74 79 70 65 20 3d 20 27 76 61 6c 75 65 27 0a 20 20 20 20 6d 65 74 61 2e 76 61 | .meta.type.=.'value'.....meta.va |
26f80 | 6c 75 65 20 3d 20 76 61 6c 75 65 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 6d 65 74 61 0a 7d 0a | lue.=.value...}...return.meta.}. |
26fa0 | 0a 2f 2f 20 43 6f 6e 76 65 72 74 20 6f 62 6a 65 63 74 20 74 6f 20 6d 65 74 61 20 62 79 20 76 61 | .//.Convert.object.to.meta.by.va |
26fc0 | 6c 75 65 2e 0a 63 6f 6e 73 74 20 70 6c 61 69 6e 4f 62 6a 65 63 74 54 6f 4d 65 74 61 20 3d 20 66 | lue..const.plainObjectToMeta.=.f |
26fe0 | 75 6e 63 74 69 6f 6e 20 28 6f 62 6a 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 4f 62 6a 65 63 74 2e | unction.(obj).{...return.Object. |
27000 | 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 4e 61 6d 65 73 28 6f 62 6a 29 2e 6d 61 70 28 66 75 6e | getOwnPropertyNames(obj).map(fun |
27020 | 63 74 69 6f 6e 20 28 6e 61 6d 65 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 | ction.(name).{.....return.{..... |
27040 | 20 20 6e 61 6d 65 3a 20 6e 61 6d 65 2c 0a 20 20 20 20 20 20 76 61 6c 75 65 3a 20 6f 62 6a 5b 6e | ..name:.name,.......value:.obj[n |
27060 | 61 6d 65 5d 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 2f 2f 20 43 6f 6e 76 65 72 74 20 45 72 | ame].....}...}).}..//.Convert.Er |
27080 | 72 6f 72 20 69 6e 74 6f 20 6d 65 74 61 20 64 61 74 61 2e 0a 63 6f 6e 73 74 20 65 78 63 65 70 74 | ror.into.meta.data..const.except |
270a0 | 69 6f 6e 54 6f 4d 65 74 61 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 65 6e 64 65 72 2c 20 63 6f | ionToMeta.=.function.(sender,.co |
270c0 | 6e 74 65 78 74 49 64 2c 20 65 72 72 6f 72 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 | ntextId,.error).{...return.{.... |
270e0 | 20 74 79 70 65 3a 20 27 65 78 63 65 70 74 69 6f 6e 27 2c 0a 20 20 20 20 76 61 6c 75 65 3a 20 65 | .type:.'exception',.....value:.e |
27100 | 72 72 6f 72 55 74 69 6c 73 2e 73 65 72 69 61 6c 69 7a 65 28 65 72 72 6f 72 29 0a 20 20 7d 0a 7d | rrorUtils.serialize(error)...}.} |
27120 | 0a 0a 63 6f 6e 73 74 20 74 68 72 6f 77 52 50 43 45 72 72 6f 72 20 3d 20 66 75 6e 63 74 69 6f 6e | ..const.throwRPCError.=.function |
27140 | 20 28 6d 65 73 73 61 67 65 29 20 7b 0a 20 20 63 6f 6e 73 74 20 65 72 72 6f 72 20 3d 20 6e 65 77 | .(message).{...const.error.=.new |
27160 | 20 45 72 72 6f 72 28 6d 65 73 73 61 67 65 29 0a 20 20 65 72 72 6f 72 2e 63 6f 64 65 20 3d 20 27 | .Error(message)...error.code.=.' |
27180 | 45 42 41 44 52 50 43 27 0a 20 20 65 72 72 6f 72 2e 65 72 72 6e 6f 20 3d 20 2d 37 32 0a 20 20 74 | EBADRPC'...error.errno.=.-72...t |
271a0 | 68 72 6f 77 20 65 72 72 6f 72 0a 7d 0a 0a 63 6f 6e 73 74 20 72 65 6d 6f 76 65 52 65 6d 6f 74 65 | hrow.error.}..const.removeRemote |
271c0 | 4c 69 73 74 65 6e 65 72 73 41 6e 64 4c 6f 67 57 61 72 6e 69 6e 67 20 3d 20 28 73 65 6e 64 65 72 | ListenersAndLogWarning.=.(sender |
271e0 | 2c 20 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 72 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 | ,.callIntoRenderer).=>.{...const |
27200 | 20 6c 6f 63 61 74 69 6f 6e 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 | .location.=.v8Util.getHiddenValu |
27220 | 65 28 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 72 2c 20 27 6c 6f 63 61 74 69 6f 6e 27 29 0a | e(callIntoRenderer,.'location'). |
27240 | 20 20 6c 65 74 20 6d 65 73 73 61 67 65 20 3d 20 60 41 74 74 65 6d 70 74 69 6e 67 20 74 6f 20 63 | ..let.message.=.`Attempting.to.c |
27260 | 61 6c 6c 20 61 20 66 75 6e 63 74 69 6f 6e 20 69 6e 20 61 20 72 65 6e 64 65 72 65 72 20 77 69 6e | all.a.function.in.a.renderer.win |
27280 | 64 6f 77 20 74 68 61 74 20 68 61 73 20 62 65 65 6e 20 63 6c 6f 73 65 64 20 6f 72 20 72 65 6c 65 | dow.that.has.been.closed.or.rele |
272a0 | 61 73 65 64 2e 60 20 2b 0a 20 20 20 20 60 5c 6e 46 75 6e 63 74 69 6f 6e 20 70 72 6f 76 69 64 65 | ased.`.+.....`\nFunction.provide |
272c0 | 64 20 68 65 72 65 3a 20 24 7b 6c 6f 63 61 74 69 6f 6e 7d 60 0a 0a 20 20 69 66 20 28 73 65 6e 64 | d.here:.${location}`....if.(send |
272e0 | 65 72 20 69 6e 73 74 61 6e 63 65 6f 66 20 45 76 65 6e 74 45 6d 69 74 74 65 72 29 20 7b 0a 20 20 | er.instanceof.EventEmitter).{... |
27300 | 20 20 63 6f 6e 73 74 20 72 65 6d 6f 74 65 45 76 65 6e 74 73 20 3d 20 73 65 6e 64 65 72 2e 65 76 | ..const.remoteEvents.=.sender.ev |
27320 | 65 6e 74 4e 61 6d 65 73 28 29 2e 66 69 6c 74 65 72 28 28 65 76 65 6e 74 4e 61 6d 65 29 20 3d 3e | entNames().filter((eventName).=> |
27340 | 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 73 65 6e 64 65 72 2e 6c 69 73 74 65 6e 65 72 73 | .{.......return.sender.listeners |
27360 | 28 65 76 65 6e 74 4e 61 6d 65 29 2e 69 6e 63 6c 75 64 65 73 28 63 61 6c 6c 49 6e 74 6f 52 65 6e | (eventName).includes(callIntoRen |
27380 | 64 65 72 65 72 29 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 69 66 20 28 72 65 6d 6f 74 65 45 76 65 | derer).....})......if.(remoteEve |
273a0 | 6e 74 73 2e 6c 65 6e 67 74 68 20 3e 20 30 29 20 7b 0a 20 20 20 20 20 20 6d 65 73 73 61 67 65 20 | nts.length.>.0).{.......message. |
273c0 | 2b 3d 20 60 5c 6e 52 65 6d 6f 74 65 20 65 76 65 6e 74 20 6e 61 6d 65 73 3a 20 24 7b 72 65 6d 6f | +=.`\nRemote.event.names:.${remo |
273e0 | 74 65 45 76 65 6e 74 73 2e 6a 6f 69 6e 28 27 2c 20 27 29 7d 60 0a 20 20 20 20 20 20 72 65 6d 6f | teEvents.join(',.')}`.......remo |
27400 | 74 65 45 76 65 6e 74 73 2e 66 6f 72 45 61 63 68 28 28 65 76 65 6e 74 4e 61 6d 65 29 20 3d 3e 20 | teEvents.forEach((eventName).=>. |
27420 | 7b 0a 20 20 20 20 20 20 20 20 73 65 6e 64 65 72 2e 72 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 28 | {.........sender.removeListener( |
27440 | 65 76 65 6e 74 4e 61 6d 65 2c 20 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 72 29 0a 20 20 20 | eventName,.callIntoRenderer).... |
27460 | 20 20 20 7d 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 | ...}).....}...}....console.warn( |
27480 | 6d 65 73 73 61 67 65 29 0a 7d 0a 0a 2f 2f 20 43 6f 6e 76 65 72 74 20 61 72 72 61 79 20 6f 66 20 | message).}..//.Convert.array.of. |
274a0 | 6d 65 74 61 20 64 61 74 61 20 66 72 6f 6d 20 72 65 6e 64 65 72 65 72 20 69 6e 74 6f 20 61 72 72 | meta.data.from.renderer.into.arr |
274c0 | 61 79 20 6f 66 20 72 65 61 6c 20 76 61 6c 75 65 73 2e 0a 63 6f 6e 73 74 20 75 6e 77 72 61 70 41 | ay.of.real.values..const.unwrapA |
274e0 | 72 67 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 | rgs.=.function.(sender,.contextI |
27500 | 64 2c 20 61 72 67 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 6d 65 74 61 54 6f 56 61 6c 75 65 20 3d | d,.args).{...const.metaToValue.= |
27520 | 20 66 75 6e 63 74 69 6f 6e 20 28 6d 65 74 61 29 20 7b 0a 20 20 20 20 73 77 69 74 63 68 20 28 6d | .function.(meta).{.....switch.(m |
27540 | 65 74 61 2e 74 79 70 65 29 20 7b 0a 20 20 20 20 20 20 63 61 73 65 20 27 76 61 6c 75 65 27 3a 0a | eta.type).{.......case.'value':. |
27560 | 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6d 65 74 61 2e 76 61 6c 75 65 0a 20 20 20 20 20 20 | ........return.meta.value....... |
27580 | 63 61 73 65 20 27 72 65 6d 6f 74 65 2d 6f 62 6a 65 63 74 27 3a 0a 20 20 20 20 20 20 20 20 72 65 | case.'remote-object':.........re |
275a0 | 74 75 72 6e 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 67 65 74 28 6d 65 74 61 2e 69 64 | turn.objectsRegistry.get(meta.id |
275c0 | 29 0a 20 20 20 20 20 20 63 61 73 65 20 27 61 72 72 61 79 27 3a 0a 20 20 20 20 20 20 20 20 72 65 | ).......case.'array':.........re |
275e0 | 74 75 72 6e 20 75 6e 77 72 61 70 41 72 67 73 28 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 | turn.unwrapArgs(sender,.contextI |
27600 | 64 2c 20 6d 65 74 61 2e 76 61 6c 75 65 29 0a 20 20 20 20 20 20 63 61 73 65 20 27 62 75 66 66 65 | d,.meta.value).......case.'buffe |
27620 | 72 27 3a 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 62 75 66 66 65 72 55 74 69 6c 73 2e 6d | r':.........return.bufferUtils.m |
27640 | 65 74 61 54 6f 42 75 66 66 65 72 28 6d 65 74 61 2e 76 61 6c 75 65 29 0a 20 20 20 20 20 20 63 61 | etaToBuffer(meta.value).......ca |
27660 | 73 65 20 27 64 61 74 65 27 3a 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 65 77 20 44 61 | se.'date':.........return.new.Da |
27680 | 74 65 28 6d 65 74 61 2e 76 61 6c 75 65 29 0a 20 20 20 20 20 20 63 61 73 65 20 27 70 72 6f 6d 69 | te(meta.value).......case.'promi |
276a0 | 73 65 27 3a 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 50 72 6f 6d 69 73 65 2e 72 65 73 6f | se':.........return.Promise.reso |
276c0 | 6c 76 65 28 7b 0a 20 20 20 20 20 20 20 20 20 20 74 68 65 6e 3a 20 6d 65 74 61 54 6f 56 61 6c 75 | lve({...........then:.metaToValu |
276e0 | 65 28 6d 65 74 61 2e 74 68 65 6e 29 0a 20 20 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 63 61 | e(meta.then).........}).......ca |
27700 | 73 65 20 27 6f 62 6a 65 63 74 27 3a 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 74 | se.'object':.{.........const.ret |
27720 | 20 3d 20 7b 7d 0a 20 20 20 20 20 20 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 | .=.{}.........Object.definePrope |
27740 | 72 74 79 28 72 65 74 2e 63 6f 6e 73 74 72 75 63 74 6f 72 2c 20 27 6e 61 6d 65 27 2c 20 7b 20 76 | rty(ret.constructor,.'name',.{.v |
27760 | 61 6c 75 65 3a 20 6d 65 74 61 2e 6e 61 6d 65 20 7d 29 0a 0a 20 20 20 20 20 20 20 20 66 6f 72 20 | alue:.meta.name.})..........for. |
27780 | 28 63 6f 6e 73 74 20 7b 20 6e 61 6d 65 2c 20 76 61 6c 75 65 20 7d 20 6f 66 20 6d 65 74 61 2e 6d | (const.{.name,.value.}.of.meta.m |
277a0 | 65 6d 62 65 72 73 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 5b 6e 61 6d 65 5d 20 3d 20 | embers).{...........ret[name].=. |
277c0 | 6d 65 74 61 54 6f 56 61 6c 75 65 28 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 | metaToValue(value).........}.... |
277e0 | 20 20 20 20 20 72 65 74 75 72 6e 20 72 65 74 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 63 61 | .....return.ret.......}.......ca |
27800 | 73 65 20 27 66 75 6e 63 74 69 6f 6e 2d 77 69 74 68 2d 72 65 74 75 72 6e 2d 76 61 6c 75 65 27 3a | se.'function-with-return-value': |
27820 | 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 6d 65 74 | .........const.returnValue.=.met |
27840 | 61 54 6f 56 61 6c 75 65 28 6d 65 74 61 2e 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 72 65 74 | aToValue(meta.value).........ret |
27860 | 75 72 6e 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 | urn.function.().{...........retu |
27880 | 72 6e 20 72 65 74 75 72 6e 56 61 6c 75 65 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 63 | rn.returnValue.........}.......c |
278a0 | 61 73 65 20 27 66 75 6e 63 74 69 6f 6e 27 3a 20 7b 0a 20 20 20 20 20 20 20 20 2f 2f 20 4d 65 72 | ase.'function':.{.........//.Mer |
278c0 | 67 65 20 63 6f 6e 74 65 78 74 49 64 20 61 6e 64 20 6d 65 74 61 2e 69 64 2c 20 73 69 6e 63 65 20 | ge.contextId.and.meta.id,.since. |
278e0 | 6d 65 74 61 2e 69 64 20 63 61 6e 20 62 65 20 74 68 65 20 73 61 6d 65 20 69 6e 0a 20 20 20 20 20 | meta.id.can.be.the.same.in...... |
27900 | 20 20 20 2f 2f 20 64 69 66 66 65 72 65 6e 74 20 77 65 62 43 6f 6e 74 65 6e 74 73 2e 0a 20 20 20 | ...//.different.webContents..... |
27920 | 20 20 20 20 20 63 6f 6e 73 74 20 6f 62 6a 65 63 74 49 64 20 3d 20 5b 63 6f 6e 74 65 78 74 49 64 | .....const.objectId.=.[contextId |
27940 | 2c 20 6d 65 74 61 2e 69 64 5d 0a 0a 20 20 20 20 20 20 20 20 2f 2f 20 43 61 63 68 65 20 74 68 65 | ,.meta.id]..........//.Cache.the |
27960 | 20 63 61 6c 6c 62 61 63 6b 73 20 69 6e 20 72 65 6e 64 65 72 65 72 2e 0a 20 20 20 20 20 20 20 20 | .callbacks.in.renderer.......... |
27980 | 69 66 20 28 72 65 6e 64 65 72 65 72 46 75 6e 63 74 69 6f 6e 73 2e 68 61 73 28 6f 62 6a 65 63 74 | if.(rendererFunctions.has(object |
279a0 | 49 64 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 72 65 6e 64 65 72 65 72 | Id)).{...........return.renderer |
279c0 | 46 75 6e 63 74 69 6f 6e 73 2e 67 65 74 28 6f 62 6a 65 63 74 49 64 29 0a 20 20 20 20 20 20 20 20 | Functions.get(objectId)......... |
279e0 | 7d 0a 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 | }..........const.callIntoRendere |
27a00 | 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 20 | r.=.function.(...args).{........ |
27a20 | 20 20 20 69 66 20 28 21 73 65 6e 64 65 72 2e 69 73 44 65 73 74 72 6f 79 65 64 28 29 29 20 7b 0a | ...if.(!sender.isDestroyed()).{. |
27a40 | 20 20 20 20 20 20 20 20 20 20 20 20 73 65 6e 64 65 72 2e 5f 73 65 6e 64 49 6e 74 65 72 6e 61 6c | ............sender._sendInternal |
27a60 | 28 27 45 4c 45 43 54 52 4f 4e 5f 52 45 4e 44 45 52 45 52 5f 43 41 4c 4c 42 41 43 4b 27 2c 20 63 | ('ELECTRON_RENDERER_CALLBACK',.c |
27a80 | 6f 6e 74 65 78 74 49 64 2c 20 6d 65 74 61 2e 69 64 2c 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 73 | ontextId,.meta.id,.valueToMeta(s |
27aa0 | 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 61 72 67 73 29 29 0a 20 20 20 20 20 20 20 | ender,.contextId,.args))........ |
27ac0 | 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 6d 6f 76 65 52 65 | ...}.else.{.............removeRe |
27ae0 | 6d 6f 74 65 4c 69 73 74 65 6e 65 72 73 41 6e 64 4c 6f 67 57 61 72 6e 69 6e 67 28 74 68 69 73 2c | moteListenersAndLogWarning(this, |
27b00 | 20 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 72 29 0a 20 20 20 20 20 20 20 20 20 20 7d 0a 20 | .callIntoRenderer)...........}.. |
27b20 | 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 | .......}.........v8Util.setHidde |
27b40 | 6e 56 61 6c 75 65 28 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 72 2c 20 27 6c 6f 63 61 74 69 | nValue(callIntoRenderer,.'locati |
27b60 | 6f 6e 27 2c 20 6d 65 74 61 2e 6c 6f 63 61 74 69 6f 6e 29 0a 20 20 20 20 20 20 20 20 4f 62 6a 65 | on',.meta.location).........Obje |
27b80 | 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 | ct.defineProperty(callIntoRender |
27ba0 | 65 72 2c 20 27 6c 65 6e 67 74 68 27 2c 20 7b 20 76 61 6c 75 65 3a 20 6d 65 74 61 2e 6c 65 6e 67 | er,.'length',.{.value:.meta.leng |
27bc0 | 74 68 20 7d 29 0a 0a 20 20 20 20 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 52 65 6d 6f 74 65 43 | th.})..........v8Util.setRemoteC |
27be0 | 61 6c 6c 62 61 63 6b 46 72 65 65 72 28 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 72 2c 20 63 | allbackFreer(callIntoRenderer,.c |
27c00 | 6f 6e 74 65 78 74 49 64 2c 20 6d 65 74 61 2e 69 64 2c 20 73 65 6e 64 65 72 29 0a 20 20 20 20 20 | ontextId,.meta.id,.sender)...... |
27c20 | 20 20 20 72 65 6e 64 65 72 65 72 46 75 6e 63 74 69 6f 6e 73 2e 73 65 74 28 6f 62 6a 65 63 74 49 | ...rendererFunctions.set(objectI |
27c40 | 64 2c 20 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 72 29 0a 20 20 20 20 20 20 20 20 72 65 74 | d,.callIntoRenderer).........ret |
27c60 | 75 72 6e 20 63 61 6c 6c 49 6e 74 6f 52 65 6e 64 65 72 65 72 0a 20 20 20 20 20 20 7d 0a 20 20 20 | urn.callIntoRenderer.......}.... |
27c80 | 20 20 20 64 65 66 61 75 6c 74 3a 0a 20 20 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 54 79 | ...default:.........throw.new.Ty |
27ca0 | 70 65 45 72 72 6f 72 28 60 55 6e 6b 6e 6f 77 6e 20 74 79 70 65 3a 20 24 7b 6d 65 74 61 2e 74 79 | peError(`Unknown.type:.${meta.ty |
27cc0 | 70 65 7d 60 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 61 72 67 73 2e 6d 61 | pe}`).....}...}...return.args.ma |
27ce0 | 70 28 6d 65 74 61 54 6f 56 61 6c 75 65 29 0a 7d 0a 0a 2f 2f 20 43 61 6c 6c 20 61 20 66 75 6e 63 | p(metaToValue).}..//.Call.a.func |
27d00 | 74 69 6f 6e 20 61 6e 64 20 73 65 6e 64 20 72 65 70 6c 79 20 61 73 79 6e 63 68 72 6f 6e 6f 75 73 | tion.and.send.reply.asynchronous |
27d20 | 6c 79 20 69 66 20 69 74 27 73 20 61 20 61 6e 20 61 73 79 6e 63 68 72 6f 6e 6f 75 73 0a 2f 2f 20 | ly.if.it's.a.an.asynchronous.//. |
27d40 | 73 74 79 6c 65 20 66 75 6e 63 74 69 6f 6e 20 61 6e 64 20 74 68 65 20 63 61 6c 6c 65 72 20 64 69 | style.function.and.the.caller.di |
27d60 | 64 6e 27 74 20 70 61 73 73 20 61 20 63 61 6c 6c 62 61 63 6b 2e 0a 63 6f 6e 73 74 20 63 61 6c 6c | dn't.pass.a.callback..const.call |
27d80 | 46 75 6e 63 74 69 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 63 6f 6e 74 | Function.=.function.(event,.cont |
27da0 | 65 78 74 49 64 2c 20 66 75 6e 63 2c 20 63 61 6c 6c 65 72 2c 20 61 72 67 73 29 20 7b 0a 20 20 63 | extId,.func,.caller,.args).{...c |
27dc0 | 6f 6e 73 74 20 66 75 6e 63 4d 61 72 6b 65 64 41 73 79 6e 63 20 3d 20 76 38 55 74 69 6c 2e 67 65 | onst.funcMarkedAsync.=.v8Util.ge |
27de0 | 74 48 69 64 64 65 6e 56 61 6c 75 65 28 66 75 6e 63 2c 20 27 61 73 79 6e 63 68 72 6f 6e 6f 75 73 | tHiddenValue(func,.'asynchronous |
27e00 | 27 29 0a 20 20 63 6f 6e 73 74 20 66 75 6e 63 50 61 73 73 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 | ')...const.funcPassedCallback.=. |
27e20 | 74 79 70 65 6f 66 20 61 72 67 73 5b 61 72 67 73 2e 6c 65 6e 67 74 68 20 2d 20 31 5d 20 3d 3d 3d | typeof.args[args.length.-.1].=== |
27e40 | 20 27 66 75 6e 63 74 69 6f 6e 27 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 69 66 20 28 66 75 6e 63 | .'function'...try.{.....if.(func |
27e60 | 4d 61 72 6b 65 64 41 73 79 6e 63 20 26 26 20 21 66 75 6e 63 50 61 73 73 65 64 43 61 6c 6c 62 61 | MarkedAsync.&&.!funcPassedCallba |
27e80 | 63 6b 29 20 7b 0a 20 20 20 20 20 20 61 72 67 73 2e 70 75 73 68 28 66 75 6e 63 74 69 6f 6e 20 28 | ck).{.......args.push(function.( |
27ea0 | 72 65 74 29 20 7b 0a 20 20 20 20 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 | ret).{.........event.returnValue |
27ec0 | 20 3d 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e | .=.valueToMeta(event.sender,.con |
27ee0 | 74 65 78 74 49 64 2c 20 72 65 74 2c 20 74 72 75 65 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 | textId,.ret,.true).......})..... |
27f00 | 20 20 66 75 6e 63 2e 61 70 70 6c 79 28 63 61 6c 6c 65 72 2c 20 61 72 67 73 29 0a 20 20 20 20 7d | ..func.apply(caller,.args).....} |
27f20 | 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 74 20 3d 20 66 75 6e 63 2e 61 | .else.{.......const.ret.=.func.a |
27f40 | 70 70 6c 79 28 63 61 6c 6c 65 72 2c 20 61 72 67 73 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 | pply(caller,.args).......return. |
27f60 | 76 61 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 | valueToMeta(event.sender,.contex |
27f80 | 74 49 64 2c 20 72 65 74 2c 20 74 72 75 65 29 0a 20 20 20 20 7d 0a 20 20 7d 20 63 61 74 63 68 20 | tId,.ret,.true).....}...}.catch. |
27fa0 | 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 2f 2f 20 43 61 74 63 68 20 66 75 6e 63 74 69 6f 6e 73 | (error).{.....//.Catch.functions |
27fc0 | 20 74 68 72 6f 77 6e 20 66 75 72 74 68 65 72 20 64 6f 77 6e 20 69 6e 20 66 75 6e 63 74 69 6f 6e | .thrown.further.down.in.function |
27fe0 | 20 69 6e 76 6f 63 61 74 69 6f 6e 20 61 6e 64 20 77 72 61 70 0a 20 20 20 20 2f 2f 20 74 68 65 6d | .invocation.and.wrap.....//.them |
28000 | 20 77 69 74 68 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 6e 61 6d 65 20 73 6f 20 69 74 27 73 20 | .with.the.function.name.so.it's. |
28020 | 65 61 73 69 65 72 20 74 6f 20 74 72 61 63 65 20 74 68 69 6e 67 73 20 6c 69 6b 65 0a 20 20 20 20 | easier.to.trace.things.like..... |
28040 | 2f 2f 20 60 45 72 72 6f 72 20 70 72 6f 63 65 73 73 69 6e 67 20 61 72 67 75 6d 65 6e 74 20 2d 31 | //.`Error.processing.argument.-1 |
28060 | 2e 60 0a 20 20 20 20 63 6f 6e 73 74 20 66 75 6e 63 4e 61 6d 65 20 3d 20 66 75 6e 63 2e 6e 61 6d | .`.....const.funcName.=.func.nam |
28080 | 65 20 7c 7c 20 27 61 6e 6f 6e 79 6d 6f 75 73 27 0a 20 20 20 20 63 6f 6e 73 74 20 65 72 72 20 3d | e.||.'anonymous'.....const.err.= |
280a0 | 20 6e 65 77 20 45 72 72 6f 72 28 60 43 6f 75 6c 64 20 6e 6f 74 20 63 61 6c 6c 20 72 65 6d 6f 74 | .new.Error(`Could.not.call.remot |
280c0 | 65 20 66 75 6e 63 74 69 6f 6e 20 27 24 7b 66 75 6e 63 4e 61 6d 65 7d 27 2e 20 43 68 65 63 6b 20 | e.function.'${funcName}'..Check. |
280e0 | 74 68 61 74 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 73 69 67 6e 61 74 75 72 65 20 69 73 20 63 | that.the.function.signature.is.c |
28100 | 6f 72 72 65 63 74 2e 20 55 6e 64 65 72 6c 79 69 6e 67 20 65 72 72 6f 72 3a 20 24 7b 65 72 72 6f | orrect..Underlying.error:.${erro |
28120 | 72 2e 6d 65 73 73 61 67 65 7d 60 29 0a 20 20 20 20 65 72 72 2e 63 61 75 73 65 20 3d 20 65 72 72 | r.message}`).....err.cause.=.err |
28140 | 6f 72 0a 20 20 20 20 74 68 72 6f 77 20 65 72 72 0a 20 20 7d 0a 7d 0a 0a 63 6f 6e 73 74 20 68 61 | or.....throw.err...}.}..const.ha |
28160 | 6e 64 6c 65 52 65 6d 6f 74 65 43 6f 6d 6d 61 6e 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 68 | ndleRemoteCommand.=.function.(ch |
28180 | 61 6e 6e 65 6c 2c 20 68 61 6e 64 6c 65 72 29 20 7b 0a 20 20 69 70 63 4d 61 69 6e 2e 6f 6e 28 63 | annel,.handler).{...ipcMain.on(c |
281a0 | 68 61 6e 6e 65 6c 2c 20 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 2e 2e 2e 61 72 | hannel,.(event,.contextId,....ar |
281c0 | 67 73 29 20 3d 3e 20 7b 0a 20 20 20 20 6c 65 74 20 72 65 74 75 72 6e 56 61 6c 75 65 0a 20 20 20 | gs).=>.{.....let.returnValue.... |
281e0 | 20 69 66 20 28 21 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 5f 69 73 52 65 6d 6f 74 65 4d 6f 64 75 | .if.(!event.sender._isRemoteModu |
28200 | 6c 65 45 6e 61 62 6c 65 64 28 29 29 20 7b 0a 20 20 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 | leEnabled()).{.......event.retur |
28220 | 6e 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d | nValue.=.null.......return.....} |
28240 | 0a 0a 20 20 20 20 74 72 79 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 | ......try.{.......returnValue.=. |
28260 | 68 61 6e 64 6c 65 72 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 2e 2e 2e 61 72 67 | handler(event,.contextId,....arg |
28280 | 73 29 0a 20 20 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 72 | s).....}.catch.(error).{.......r |
282a0 | 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 78 63 65 70 74 69 6f 6e 54 6f 4d 65 74 61 28 65 76 65 | eturnValue.=.exceptionToMeta(eve |
282c0 | 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 65 72 72 6f 72 29 0a 20 20 20 | nt.sender,.contextId,.error).... |
282e0 | 20 7d 0a 0a 20 20 20 20 69 66 20 28 72 65 74 75 72 6e 56 61 6c 75 65 20 21 3d 3d 20 75 6e 64 65 | .}......if.(returnValue.!==.unde |
28300 | 66 69 6e 65 64 29 20 7b 0a 20 20 20 20 20 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 | fined).{.......event.returnValue |
28320 | 20 3d 20 72 65 74 75 72 6e 56 61 6c 75 65 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 68 61 6e | .=.returnValue.....}...}).}..han |
28340 | 64 6c 65 52 65 6d 6f 74 65 43 6f 6d 6d 61 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 | dleRemoteCommand('ELECTRON_BROWS |
28360 | 45 52 5f 57 52 4f 4e 47 5f 43 4f 4e 54 45 58 54 5f 45 52 52 4f 52 27 2c 20 66 75 6e 63 74 69 6f | ER_WRONG_CONTEXT_ERROR',.functio |
28380 | 6e 20 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 70 61 73 73 65 64 43 6f 6e 74 65 | n.(event,.contextId,.passedConte |
283a0 | 78 74 49 64 2c 20 69 64 29 20 7b 0a 20 20 63 6f 6e 73 74 20 6f 62 6a 65 63 74 49 64 20 3d 20 5b | xtId,.id).{...const.objectId.=.[ |
283c0 | 70 61 73 73 65 64 43 6f 6e 74 65 78 74 49 64 2c 20 69 64 5d 0a 20 20 69 66 20 28 21 72 65 6e 64 | passedContextId,.id]...if.(!rend |
283e0 | 65 72 65 72 46 75 6e 63 74 69 6f 6e 73 2e 68 61 73 28 6f 62 6a 65 63 74 49 64 29 29 20 7b 0a 20 | ererFunctions.has(objectId)).{.. |
28400 | 20 20 20 2f 2f 20 44 6f 20 6e 6f 74 68 69 6e 67 20 69 66 20 74 68 65 20 65 72 72 6f 72 20 68 61 | ...//.Do.nothing.if.the.error.ha |
28420 | 73 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 72 65 70 6f 72 74 65 64 20 62 65 66 6f 72 65 2e 0a | s.already.been.reported.before.. |
28440 | 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a 20 20 72 65 6d 6f 76 65 52 65 6d 6f 74 65 4c 69 73 | ....return...}...removeRemoteLis |
28460 | 74 65 6e 65 72 73 41 6e 64 4c 6f 67 57 61 72 6e 69 6e 67 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 | tenersAndLogWarning(event.sender |
28480 | 2c 20 72 65 6e 64 65 72 65 72 46 75 6e 63 74 69 6f 6e 73 2e 67 65 74 28 6f 62 6a 65 63 74 49 64 | ,.rendererFunctions.get(objectId |
284a0 | 29 29 0a 7d 29 0a 0a 68 61 6e 64 6c 65 52 65 6d 6f 74 65 43 6f 6d 6d 61 6e 64 28 27 45 4c 45 43 | )).})..handleRemoteCommand('ELEC |
284c0 | 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 52 45 51 55 49 52 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 | TRON_BROWSER_REQUIRE',.function. |
284e0 | 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 6d 6f 64 75 6c 65 4e 61 6d 65 29 20 7b | (event,.contextId,.moduleName).{ |
28500 | 0a 20 20 63 6f 6e 73 74 20 63 75 73 74 6f 6d 45 76 65 6e 74 20 3d 20 65 76 65 6e 74 42 69 6e 64 | ...const.customEvent.=.eventBind |
28520 | 69 6e 67 2e 63 72 65 61 74 65 57 69 74 68 53 65 6e 64 65 72 28 65 76 65 6e 74 2e 73 65 6e 64 65 | ing.createWithSender(event.sende |
28540 | 72 29 0a 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 65 6d 69 74 28 27 72 65 6d 6f 74 65 2d 72 | r)...event.sender.emit('remote-r |
28560 | 65 71 75 69 72 65 27 2c 20 63 75 73 74 6f 6d 45 76 65 6e 74 2c 20 6d 6f 64 75 6c 65 4e 61 6d 65 | equire',.customEvent,.moduleName |
28580 | 29 0a 0a 20 20 69 66 20 28 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 | )....if.(customEvent.returnValue |
285a0 | 20 3d 3d 3d 20 75 6e 64 65 66 69 6e 65 64 29 20 7b 0a 20 20 20 20 69 66 20 28 63 75 73 74 6f 6d | .===.undefined).{.....if.(custom |
285c0 | 45 76 65 6e 74 2e 64 65 66 61 75 6c 74 50 72 65 76 65 6e 74 65 64 29 20 7b 0a 20 20 20 20 20 20 | Event.defaultPrevented).{....... |
285e0 | 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 60 42 6c 6f 63 6b 65 64 20 72 65 6d 6f 74 65 2e | throw.new.Error(`Blocked.remote. |
28600 | 72 65 71 75 69 72 65 28 27 24 7b 6d 6f 64 75 6c 65 4e 61 6d 65 7d 27 29 60 29 0a 20 20 20 20 7d | require('${moduleName}')`).....} |
28620 | 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e | .else.{.......customEvent.return |
28640 | 56 61 6c 75 65 20 3d 20 70 72 6f 63 65 73 73 2e 6d 61 69 6e 4d 6f 64 75 6c 65 2e 72 65 71 75 69 | Value.=.process.mainModule.requi |
28660 | 72 65 28 6d 6f 64 75 6c 65 4e 61 6d 65 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 72 65 74 75 | re(moduleName).....}...}....retu |
28680 | 72 6e 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e | rn.valueToMeta(event.sender,.con |
286a0 | 74 65 78 74 49 64 2c 20 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 29 | textId,.customEvent.returnValue) |
286c0 | 0a 7d 29 0a 0a 68 61 6e 64 6c 65 52 65 6d 6f 74 65 43 6f 6d 6d 61 6e 64 28 27 45 4c 45 43 54 52 | .})..handleRemoteCommand('ELECTR |
286e0 | 4f 4e 5f 42 52 4f 57 53 45 52 5f 47 45 54 5f 42 55 49 4c 54 49 4e 27 2c 20 66 75 6e 63 74 69 6f | ON_BROWSER_GET_BUILTIN',.functio |
28700 | 6e 20 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 6d 6f 64 75 6c 65 4e 61 6d 65 29 | n.(event,.contextId,.moduleName) |
28720 | 20 7b 0a 20 20 63 6f 6e 73 74 20 63 75 73 74 6f 6d 45 76 65 6e 74 20 3d 20 65 76 65 6e 74 42 69 | .{...const.customEvent.=.eventBi |
28740 | 6e 64 69 6e 67 2e 63 72 65 61 74 65 57 69 74 68 53 65 6e 64 65 72 28 65 76 65 6e 74 2e 73 65 6e | nding.createWithSender(event.sen |
28760 | 64 65 72 29 0a 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 65 6d 69 74 28 27 72 65 6d 6f 74 65 | der)...event.sender.emit('remote |
28780 | 2d 67 65 74 2d 62 75 69 6c 74 69 6e 27 2c 20 63 75 73 74 6f 6d 45 76 65 6e 74 2c 20 6d 6f 64 75 | -get-builtin',.customEvent,.modu |
287a0 | 6c 65 4e 61 6d 65 29 0a 0a 20 20 69 66 20 28 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 | leName)....if.(customEvent.retur |
287c0 | 6e 56 61 6c 75 65 20 3d 3d 3d 20 75 6e 64 65 66 69 6e 65 64 29 20 7b 0a 20 20 20 20 69 66 20 28 | nValue.===.undefined).{.....if.( |
287e0 | 63 75 73 74 6f 6d 45 76 65 6e 74 2e 64 65 66 61 75 6c 74 50 72 65 76 65 6e 74 65 64 29 20 7b 0a | customEvent.defaultPrevented).{. |
28800 | 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 60 42 6c 6f 63 6b 65 64 20 72 | ......throw.new.Error(`Blocked.r |
28820 | 65 6d 6f 74 65 2e 67 65 74 42 75 69 6c 74 69 6e 28 27 24 7b 6d 6f 64 75 6c 65 4e 61 6d 65 7d 27 | emote.getBuiltin('${moduleName}' |
28840 | 29 60 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 63 75 73 74 6f 6d 45 76 65 | )`).....}.else.{.......customEve |
28860 | 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 6c 65 63 74 72 6f 6e 5b 6d 6f 64 75 6c 65 | nt.returnValue.=.electron[module |
28880 | 4e 61 6d 65 5d 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 76 61 6c 75 65 54 | Name].....}...}....return.valueT |
288a0 | 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 63 | oMeta(event.sender,.contextId,.c |
288c0 | 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 29 0a 7d 29 0a 0a 68 61 6e 64 | ustomEvent.returnValue).})..hand |
288e0 | 6c 65 52 65 6d 6f 74 65 43 6f 6d 6d 61 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 | leRemoteCommand('ELECTRON_BROWSE |
28900 | 52 5f 47 4c 4f 42 41 4c 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 63 6f 6e 74 | R_GLOBAL',.function.(event,.cont |
28920 | 65 78 74 49 64 2c 20 67 6c 6f 62 61 6c 4e 61 6d 65 29 20 7b 0a 20 20 63 6f 6e 73 74 20 63 75 73 | extId,.globalName).{...const.cus |
28940 | 74 6f 6d 45 76 65 6e 74 20 3d 20 65 76 65 6e 74 42 69 6e 64 69 6e 67 2e 63 72 65 61 74 65 57 69 | tomEvent.=.eventBinding.createWi |
28960 | 74 68 53 65 6e 64 65 72 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 29 0a 20 20 65 76 65 6e 74 2e 73 | thSender(event.sender)...event.s |
28980 | 65 6e 64 65 72 2e 65 6d 69 74 28 27 72 65 6d 6f 74 65 2d 67 65 74 2d 67 6c 6f 62 61 6c 27 2c 20 | ender.emit('remote-get-global',. |
289a0 | 63 75 73 74 6f 6d 45 76 65 6e 74 2c 20 67 6c 6f 62 61 6c 4e 61 6d 65 29 0a 0a 20 20 69 66 20 28 | customEvent,.globalName)....if.( |
289c0 | 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 3d 3d 20 75 6e 64 65 | customEvent.returnValue.===.unde |
289e0 | 66 69 6e 65 64 29 20 7b 0a 20 20 20 20 69 66 20 28 63 75 73 74 6f 6d 45 76 65 6e 74 2e 64 65 66 | fined).{.....if.(customEvent.def |
28a00 | 61 75 6c 74 50 72 65 76 65 6e 74 65 64 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 | aultPrevented).{.......throw.new |
28a20 | 20 45 72 72 6f 72 28 60 42 6c 6f 63 6b 65 64 20 72 65 6d 6f 74 65 2e 67 65 74 47 6c 6f 62 61 6c | .Error(`Blocked.remote.getGlobal |
28a40 | 28 27 24 7b 67 6c 6f 62 61 6c 4e 61 6d 65 7d 27 29 60 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b | ('${globalName}')`).....}.else.{ |
28a60 | 0a 20 20 20 20 20 20 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d | .......customEvent.returnValue.= |
28a80 | 20 67 6c 6f 62 61 6c 5b 67 6c 6f 62 61 6c 4e 61 6d 65 5d 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 | .global[globalName].....}...}... |
28aa0 | 20 72 65 74 75 72 6e 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 | .return.valueToMeta(event.sender |
28ac0 | 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 | ,.contextId,.customEvent.returnV |
28ae0 | 61 6c 75 65 29 0a 7d 29 0a 0a 68 61 6e 64 6c 65 52 65 6d 6f 74 65 43 6f 6d 6d 61 6e 64 28 27 45 | alue).})..handleRemoteCommand('E |
28b00 | 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 43 55 52 52 45 4e 54 5f 57 49 4e 44 4f 57 27 2c | LECTRON_BROWSER_CURRENT_WINDOW', |
28b20 | 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 29 20 7b 0a 20 | .function.(event,.contextId).{.. |
28b40 | 20 63 6f 6e 73 74 20 63 75 73 74 6f 6d 45 76 65 6e 74 20 3d 20 65 76 65 6e 74 42 69 6e 64 69 6e | .const.customEvent.=.eventBindin |
28b60 | 67 2e 63 72 65 61 74 65 57 69 74 68 53 65 6e 64 65 72 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 29 | g.createWithSender(event.sender) |
28b80 | 0a 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 65 6d 69 74 28 27 72 65 6d 6f 74 65 2d 67 65 74 | ...event.sender.emit('remote-get |
28ba0 | 2d 63 75 72 72 65 6e 74 2d 77 69 6e 64 6f 77 27 2c 20 63 75 73 74 6f 6d 45 76 65 6e 74 29 0a 0a | -current-window',.customEvent).. |
28bc0 | 20 20 69 66 20 28 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 3d | ..if.(customEvent.returnValue.== |
28be0 | 3d 20 75 6e 64 65 66 69 6e 65 64 29 20 7b 0a 20 20 20 20 69 66 20 28 63 75 73 74 6f 6d 45 76 65 | =.undefined).{.....if.(customEve |
28c00 | 6e 74 2e 64 65 66 61 75 6c 74 50 72 65 76 65 6e 74 65 64 29 20 7b 0a 20 20 20 20 20 20 74 68 72 | nt.defaultPrevented).{.......thr |
28c20 | 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 42 6c 6f 63 6b 65 64 20 72 65 6d 6f 74 65 2e 67 65 74 | ow.new.Error('Blocked.remote.get |
28c40 | 43 75 72 72 65 6e 74 57 69 6e 64 6f 77 28 29 27 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 | CurrentWindow()').....}.else.{.. |
28c60 | 20 20 20 20 20 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 65 | .....customEvent.returnValue.=.e |
28c80 | 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 65 74 4f 77 6e 65 72 42 72 6f 77 73 65 72 57 69 6e 64 6f | vent.sender.getOwnerBrowserWindo |
28ca0 | 77 28 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 76 61 6c 75 65 54 6f 4d | w().....}...}....return.valueToM |
28cc0 | 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 63 75 73 | eta(event.sender,.contextId,.cus |
28ce0 | 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 29 0a 7d 29 0a 0a 68 61 6e 64 6c 65 | tomEvent.returnValue).})..handle |
28d00 | 52 65 6d 6f 74 65 43 6f 6d 6d 61 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f | RemoteCommand('ELECTRON_BROWSER_ |
28d20 | 43 55 52 52 45 4e 54 5f 57 45 42 5f 43 4f 4e 54 45 4e 54 53 27 2c 20 66 75 6e 63 74 69 6f 6e 20 | CURRENT_WEB_CONTENTS',.function. |
28d40 | 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 29 20 7b 0a 20 20 63 6f 6e 73 74 20 63 75 73 | (event,.contextId).{...const.cus |
28d60 | 74 6f 6d 45 76 65 6e 74 20 3d 20 65 76 65 6e 74 42 69 6e 64 69 6e 67 2e 63 72 65 61 74 65 57 69 | tomEvent.=.eventBinding.createWi |
28d80 | 74 68 53 65 6e 64 65 72 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 29 0a 20 20 65 76 65 6e 74 2e 73 | thSender(event.sender)...event.s |
28da0 | 65 6e 64 65 72 2e 65 6d 69 74 28 27 72 65 6d 6f 74 65 2d 67 65 74 2d 63 75 72 72 65 6e 74 2d 77 | ender.emit('remote-get-current-w |
28dc0 | 65 62 2d 63 6f 6e 74 65 6e 74 73 27 2c 20 63 75 73 74 6f 6d 45 76 65 6e 74 29 0a 0a 20 20 69 66 | eb-contents',.customEvent)....if |
28de0 | 20 28 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 3d 3d 20 75 6e | .(customEvent.returnValue.===.un |
28e00 | 64 65 66 69 6e 65 64 29 20 7b 0a 20 20 20 20 69 66 20 28 63 75 73 74 6f 6d 45 76 65 6e 74 2e 64 | defined).{.....if.(customEvent.d |
28e20 | 65 66 61 75 6c 74 50 72 65 76 65 6e 74 65 64 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e | efaultPrevented).{.......throw.n |
28e40 | 65 77 20 45 72 72 6f 72 28 27 42 6c 6f 63 6b 65 64 20 72 65 6d 6f 74 65 2e 67 65 74 43 75 72 72 | ew.Error('Blocked.remote.getCurr |
28e60 | 65 6e 74 57 65 62 43 6f 6e 74 65 6e 74 73 28 29 27 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a | entWebContents()').....}.else.{. |
28e80 | 20 20 20 20 20 20 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 | ......customEvent.returnValue.=. |
28ea0 | 65 76 65 6e 74 2e 73 65 6e 64 65 72 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e | event.sender.....}...}....return |
28ec0 | 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 | .valueToMeta(event.sender,.conte |
28ee0 | 78 74 49 64 2c 20 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 29 0a 7d | xtId,.customEvent.returnValue).} |
28f00 | 29 0a 0a 68 61 6e 64 6c 65 52 65 6d 6f 74 65 43 6f 6d 6d 61 6e 64 28 27 45 4c 45 43 54 52 4f 4e | )..handleRemoteCommand('ELECTRON |
28f20 | 5f 42 52 4f 57 53 45 52 5f 43 4f 4e 53 54 52 55 43 54 4f 52 27 2c 20 66 75 6e 63 74 69 6f 6e 20 | _BROWSER_CONSTRUCTOR',.function. |
28f40 | 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 69 64 2c 20 61 72 67 73 29 20 7b 0a 20 | (event,.contextId,.id,.args).{.. |
28f60 | 20 61 72 67 73 20 3d 20 75 6e 77 72 61 70 41 72 67 73 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c | .args.=.unwrapArgs(event.sender, |
28f80 | 20 63 6f 6e 74 65 78 74 49 64 2c 20 61 72 67 73 29 0a 20 20 63 6f 6e 73 74 20 63 6f 6e 73 74 72 | .contextId,.args)...const.constr |
28fa0 | 75 63 74 6f 72 20 3d 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 67 65 74 28 69 64 29 0a | uctor.=.objectsRegistry.get(id). |
28fc0 | 0a 20 20 69 66 20 28 63 6f 6e 73 74 72 75 63 74 6f 72 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 | ...if.(constructor.==.null).{... |
28fe0 | 20 20 74 68 72 6f 77 52 50 43 45 72 72 6f 72 28 60 43 61 6e 6e 6f 74 20 63 61 6c 6c 20 63 6f 6e | ..throwRPCError(`Cannot.call.con |
29000 | 73 74 72 75 63 74 6f 72 20 6f 6e 20 6d 69 73 73 69 6e 67 20 72 65 6d 6f 74 65 20 6f 62 6a 65 63 | structor.on.missing.remote.objec |
29020 | 74 20 24 7b 69 64 7d 60 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 76 61 6c 75 65 54 6f 4d | t.${id}`)...}....return.valueToM |
29040 | 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 6e 65 77 | eta(event.sender,.contextId,.new |
29060 | 20 63 6f 6e 73 74 72 75 63 74 6f 72 28 2e 2e 2e 61 72 67 73 29 29 0a 7d 29 0a 0a 68 61 6e 64 6c | .constructor(...args)).})..handl |
29080 | 65 52 65 6d 6f 74 65 43 6f 6d 6d 61 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 | eRemoteCommand('ELECTRON_BROWSER |
290a0 | 5f 46 55 4e 43 54 49 4f 4e 5f 43 41 4c 4c 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 | _FUNCTION_CALL',.function.(event |
290c0 | 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 69 64 2c 20 61 72 67 73 29 20 7b 0a 20 20 61 72 67 73 20 | ,.contextId,.id,.args).{...args. |
290e0 | 3d 20 75 6e 77 72 61 70 41 72 67 73 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 | =.unwrapArgs(event.sender,.conte |
29100 | 78 74 49 64 2c 20 61 72 67 73 29 0a 20 20 63 6f 6e 73 74 20 66 75 6e 63 20 3d 20 6f 62 6a 65 63 | xtId,.args)...const.func.=.objec |
29120 | 74 73 52 65 67 69 73 74 72 79 2e 67 65 74 28 69 64 29 0a 0a 20 20 69 66 20 28 66 75 6e 63 20 3d | tsRegistry.get(id)....if.(func.= |
29140 | 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 52 50 43 45 72 72 6f 72 28 60 43 61 6e | =.null).{.....throwRPCError(`Can |
29160 | 6e 6f 74 20 63 61 6c 6c 20 66 75 6e 63 74 69 6f 6e 20 6f 6e 20 6d 69 73 73 69 6e 67 20 72 65 6d | not.call.function.on.missing.rem |
29180 | 6f 74 65 20 6f 62 6a 65 63 74 20 24 7b 69 64 7d 60 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e | ote.object.${id}`)...}....return |
291a0 | 20 63 61 6c 6c 46 75 6e 63 74 69 6f 6e 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 | .callFunction(event,.contextId,. |
291c0 | 66 75 6e 63 2c 20 67 6c 6f 62 61 6c 2c 20 61 72 67 73 29 0a 7d 29 0a 0a 68 61 6e 64 6c 65 52 65 | func,.global,.args).})..handleRe |
291e0 | 6d 6f 74 65 43 6f 6d 6d 61 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 4d 45 | moteCommand('ELECTRON_BROWSER_ME |
29200 | 4d 42 45 52 5f 43 4f 4e 53 54 52 55 43 54 4f 52 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 | MBER_CONSTRUCTOR',.function.(eve |
29220 | 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 69 64 2c 20 6d 65 74 68 6f 64 2c 20 61 72 67 73 29 | nt,.contextId,.id,.method,.args) |
29240 | 20 7b 0a 20 20 61 72 67 73 20 3d 20 75 6e 77 72 61 70 41 72 67 73 28 65 76 65 6e 74 2e 73 65 6e | .{...args.=.unwrapArgs(event.sen |
29260 | 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 61 72 67 73 29 0a 20 20 63 6f 6e 73 74 20 6f 62 | der,.contextId,.args)...const.ob |
29280 | 6a 65 63 74 20 3d 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 67 65 74 28 69 64 29 0a 0a | ject.=.objectsRegistry.get(id).. |
292a0 | 20 20 69 66 20 28 6f 62 6a 65 63 74 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 74 68 72 6f | ..if.(object.==.null).{.....thro |
292c0 | 77 52 50 43 45 72 72 6f 72 28 60 43 61 6e 6e 6f 74 20 63 61 6c 6c 20 63 6f 6e 73 74 72 75 63 74 | wRPCError(`Cannot.call.construct |
292e0 | 6f 72 20 27 24 7b 6d 65 74 68 6f 64 7d 27 20 6f 6e 20 6d 69 73 73 69 6e 67 20 72 65 6d 6f 74 65 | or.'${method}'.on.missing.remote |
29300 | 20 6f 62 6a 65 63 74 20 24 7b 69 64 7d 60 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 76 61 | .object.${id}`)...}....return.va |
29320 | 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 | lueToMeta(event.sender,.contextI |
29340 | 64 2c 20 6e 65 77 20 6f 62 6a 65 63 74 5b 6d 65 74 68 6f 64 5d 28 2e 2e 2e 61 72 67 73 29 29 0a | d,.new.object[method](...args)). |
29360 | 7d 29 0a 0a 68 61 6e 64 6c 65 52 65 6d 6f 74 65 43 6f 6d 6d 61 6e 64 28 27 45 4c 45 43 54 52 4f | })..handleRemoteCommand('ELECTRO |
29380 | 4e 5f 42 52 4f 57 53 45 52 5f 4d 45 4d 42 45 52 5f 43 41 4c 4c 27 2c 20 66 75 6e 63 74 69 6f 6e | N_BROWSER_MEMBER_CALL',.function |
293a0 | 20 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 69 64 2c 20 6d 65 74 68 6f 64 2c 20 | .(event,.contextId,.id,.method,. |
293c0 | 61 72 67 73 29 20 7b 0a 20 20 61 72 67 73 20 3d 20 75 6e 77 72 61 70 41 72 67 73 28 65 76 65 6e | args).{...args.=.unwrapArgs(even |
293e0 | 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 61 72 67 73 29 0a 20 20 63 6f 6e | t.sender,.contextId,.args)...con |
29400 | 73 74 20 6f 62 6a 20 3d 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 67 65 74 28 69 64 29 | st.obj.=.objectsRegistry.get(id) |
29420 | 0a 0a 20 20 69 66 20 28 6f 62 6a 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 | ....if.(obj.==.null).{.....throw |
29440 | 52 50 43 45 72 72 6f 72 28 60 43 61 6e 6e 6f 74 20 63 61 6c 6c 20 66 75 6e 63 74 69 6f 6e 20 27 | RPCError(`Cannot.call.function.' |
29460 | 24 7b 6d 65 74 68 6f 64 7d 27 20 6f 6e 20 6d 69 73 73 69 6e 67 20 72 65 6d 6f 74 65 20 6f 62 6a | ${method}'.on.missing.remote.obj |
29480 | 65 63 74 20 24 7b 69 64 7d 60 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 63 61 6c 6c 46 75 | ect.${id}`)...}....return.callFu |
294a0 | 6e 63 74 69 6f 6e 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 6f 62 6a 5b 6d 65 74 | nction(event,.contextId,.obj[met |
294c0 | 68 6f 64 5d 2c 20 6f 62 6a 2c 20 61 72 67 73 29 0a 7d 29 0a 0a 68 61 6e 64 6c 65 52 65 6d 6f 74 | hod],.obj,.args).})..handleRemot |
294e0 | 65 43 6f 6d 6d 61 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 4d 45 4d 42 45 | eCommand('ELECTRON_BROWSER_MEMBE |
29500 | 52 5f 53 45 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 | R_SET',.function.(event,.context |
29520 | 49 64 2c 20 69 64 2c 20 6e 61 6d 65 2c 20 61 72 67 73 29 20 7b 0a 20 20 61 72 67 73 20 3d 20 75 | Id,.id,.name,.args).{...args.=.u |
29540 | 6e 77 72 61 70 41 72 67 73 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 | nwrapArgs(event.sender,.contextI |
29560 | 64 2c 20 61 72 67 73 29 0a 20 20 63 6f 6e 73 74 20 6f 62 6a 20 3d 20 6f 62 6a 65 63 74 73 52 65 | d,.args)...const.obj.=.objectsRe |
29580 | 67 69 73 74 72 79 2e 67 65 74 28 69 64 29 0a 0a 20 20 69 66 20 28 6f 62 6a 20 3d 3d 20 6e 75 6c | gistry.get(id)....if.(obj.==.nul |
295a0 | 6c 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 52 50 43 45 72 72 6f 72 28 60 43 61 6e 6e 6f 74 20 73 | l).{.....throwRPCError(`Cannot.s |
295c0 | 65 74 20 70 72 6f 70 65 72 74 79 20 27 24 7b 6e 61 6d 65 7d 27 20 6f 6e 20 6d 69 73 73 69 6e 67 | et.property.'${name}'.on.missing |
295e0 | 20 72 65 6d 6f 74 65 20 6f 62 6a 65 63 74 20 24 7b 69 64 7d 60 29 0a 20 20 7d 0a 0a 20 20 6f 62 | .remote.object.${id}`)...}....ob |
29600 | 6a 5b 6e 61 6d 65 5d 20 3d 20 61 72 67 73 5b 30 5d 0a 20 20 72 65 74 75 72 6e 20 6e 75 6c 6c 0a | j[name].=.args[0]...return.null. |
29620 | 7d 29 0a 0a 68 61 6e 64 6c 65 52 65 6d 6f 74 65 43 6f 6d 6d 61 6e 64 28 27 45 4c 45 43 54 52 4f | })..handleRemoteCommand('ELECTRO |
29640 | 4e 5f 42 52 4f 57 53 45 52 5f 4d 45 4d 42 45 52 5f 47 45 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 | N_BROWSER_MEMBER_GET',.function. |
29660 | 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 69 64 2c 20 6e 61 6d 65 29 20 7b 0a 20 | (event,.contextId,.id,.name).{.. |
29680 | 20 63 6f 6e 73 74 20 6f 62 6a 20 3d 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 67 65 74 | .const.obj.=.objectsRegistry.get |
296a0 | 28 69 64 29 0a 0a 20 20 69 66 20 28 6f 62 6a 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 74 | (id)....if.(obj.==.null).{.....t |
296c0 | 68 72 6f 77 52 50 43 45 72 72 6f 72 28 60 43 61 6e 6e 6f 74 20 67 65 74 20 70 72 6f 70 65 72 74 | hrowRPCError(`Cannot.get.propert |
296e0 | 79 20 27 24 7b 6e 61 6d 65 7d 27 20 6f 6e 20 6d 69 73 73 69 6e 67 20 72 65 6d 6f 74 65 20 6f 62 | y.'${name}'.on.missing.remote.ob |
29700 | 6a 65 63 74 20 24 7b 69 64 7d 60 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 76 61 6c 75 65 | ject.${id}`)...}....return.value |
29720 | 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 | ToMeta(event.sender,.contextId,. |
29740 | 6f 62 6a 5b 6e 61 6d 65 5d 29 0a 7d 29 0a 0a 68 61 6e 64 6c 65 52 65 6d 6f 74 65 43 6f 6d 6d 61 | obj[name]).})..handleRemoteComma |
29760 | 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 44 45 52 45 46 45 52 45 4e 43 45 | nd('ELECTRON_BROWSER_DEREFERENCE |
29780 | 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 69 | ',.function.(event,.contextId,.i |
297a0 | 64 29 20 7b 0a 20 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 2e 72 65 6d 6f 76 65 28 65 76 | d).{...objectsRegistry.remove(ev |
297c0 | 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 69 64 29 0a 7d 29 0a 0a 68 | ent.sender,.contextId,.id).})..h |
297e0 | 61 6e 64 6c 65 52 65 6d 6f 74 65 43 6f 6d 6d 61 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f | andleRemoteCommand('ELECTRON_BRO |
29800 | 57 53 45 52 5f 43 4f 4e 54 45 58 54 5f 52 45 4c 45 41 53 45 27 2c 20 28 65 76 65 6e 74 2c 20 63 | WSER_CONTEXT_RELEASE',.(event,.c |
29820 | 6f 6e 74 65 78 74 49 64 29 20 3d 3e 20 7b 0a 20 20 6f 62 6a 65 63 74 73 52 65 67 69 73 74 72 79 | ontextId).=>.{...objectsRegistry |
29840 | 2e 63 6c 65 61 72 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 49 64 29 0a | .clear(event.sender,.contextId). |
29860 | 20 20 72 65 74 75 72 6e 20 6e 75 6c 6c 0a 7d 29 0a 0a 68 61 6e 64 6c 65 52 65 6d 6f 74 65 43 6f | ..return.null.})..handleRemoteCo |
29880 | 6d 6d 61 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 47 55 45 53 54 5f 57 45 | mmand('ELECTRON_BROWSER_GUEST_WE |
298a0 | 42 5f 43 4f 4e 54 45 4e 54 53 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 63 6f | B_CONTENTS',.function.(event,.co |
298c0 | 6e 74 65 78 74 49 64 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 63 6f | ntextId,.guestInstanceId).{...co |
298e0 | 6e 73 74 20 67 75 65 73 74 20 3d 20 67 75 65 73 74 56 69 65 77 4d 61 6e 61 67 65 72 2e 67 65 74 | nst.guest.=.guestViewManager.get |
29900 | 47 75 65 73 74 46 6f 72 57 65 62 43 6f 6e 74 65 6e 74 73 28 67 75 65 73 74 49 6e 73 74 61 6e 63 | GuestForWebContents(guestInstanc |
29920 | 65 49 64 2c 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 29 0a 0a 20 20 63 6f 6e 73 74 20 63 75 73 74 | eId,.event.sender)....const.cust |
29940 | 6f 6d 45 76 65 6e 74 20 3d 20 65 76 65 6e 74 42 69 6e 64 69 6e 67 2e 63 72 65 61 74 65 57 69 74 | omEvent.=.eventBinding.createWit |
29960 | 68 53 65 6e 64 65 72 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 29 0a 20 20 65 76 65 6e 74 2e 73 65 | hSender(event.sender)...event.se |
29980 | 6e 64 65 72 2e 65 6d 69 74 28 27 72 65 6d 6f 74 65 2d 67 65 74 2d 67 75 65 73 74 2d 77 65 62 2d | nder.emit('remote-get-guest-web- |
299a0 | 63 6f 6e 74 65 6e 74 73 27 2c 20 63 75 73 74 6f 6d 45 76 65 6e 74 2c 20 67 75 65 73 74 29 0a 0a | contents',.customEvent,.guest).. |
299c0 | 20 20 69 66 20 28 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 3d | ..if.(customEvent.returnValue.== |
299e0 | 3d 20 75 6e 64 65 66 69 6e 65 64 29 20 7b 0a 20 20 20 20 69 66 20 28 63 75 73 74 6f 6d 45 76 65 | =.undefined).{.....if.(customEve |
29a00 | 6e 74 2e 64 65 66 61 75 6c 74 50 72 65 76 65 6e 74 65 64 29 20 7b 0a 20 20 20 20 20 20 74 68 72 | nt.defaultPrevented).{.......thr |
29a20 | 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 60 42 6c 6f 63 6b 65 64 20 72 65 6d 6f 74 65 2e 67 65 74 | ow.new.Error(`Blocked.remote.get |
29a40 | 47 75 65 73 74 46 6f 72 57 65 62 43 6f 6e 74 65 6e 74 73 28 29 60 29 0a 20 20 20 20 7d 20 65 6c | GuestForWebContents()`).....}.el |
29a60 | 73 65 20 7b 0a 20 20 20 20 20 20 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c | se.{.......customEvent.returnVal |
29a80 | 75 65 20 3d 20 67 75 65 73 74 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 76 | ue.=.guest.....}...}....return.v |
29aa0 | 61 6c 75 65 54 6f 4d 65 74 61 28 65 76 65 6e 74 2e 73 65 6e 64 65 72 2c 20 63 6f 6e 74 65 78 74 | alueToMeta(event.sender,.context |
29ac0 | 49 64 2c 20 63 75 73 74 6f 6d 45 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 29 0a 7d 29 0a | Id,.customEvent.returnValue).}). |
29ae0 | 0a 2f 2f 20 49 6d 70 6c 65 6d 65 6e 74 73 20 77 69 6e 64 6f 77 2e 63 6c 6f 73 65 28 29 0a 69 70 | .//.Implements.window.close().ip |
29b00 | 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 57 49 4e 44 4f | cMain.on('ELECTRON_BROWSER_WINDO |
29b20 | 57 5f 43 4c 4f 53 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 29 20 7b 0a 20 20 63 | W_CLOSE',.function.(event).{...c |
29b40 | 6f 6e 73 74 20 77 69 6e 64 6f 77 20 3d 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 65 74 4f 77 | onst.window.=.event.sender.getOw |
29b60 | 6e 65 72 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 28 29 0a 20 20 69 66 20 28 77 69 6e 64 6f 77 29 | nerBrowserWindow()...if.(window) |
29b80 | 20 7b 0a 20 20 20 20 77 69 6e 64 6f 77 2e 63 6c 6f 73 65 28 29 0a 20 20 7d 0a 20 20 65 76 65 6e | .{.....window.close()...}...even |
29ba0 | 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 0a 7d 29 0a 0a 63 6f 6e 73 74 20 73 | t.returnValue.=.null.})..const.s |
29bc0 | 65 74 52 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c | etReturnValue.=.function.(event, |
29be0 | 20 67 65 74 56 61 6c 75 65 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 | .getValue).{...try.{.....event.r |
29c00 | 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 5b 6e 75 6c 6c 2c 20 67 65 74 56 61 6c 75 65 28 29 5d 0a | eturnValue.=.[null,.getValue()]. |
29c20 | 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 65 76 65 6e 74 2e 72 65 | ..}.catch.(error).{.....event.re |
29c40 | 74 75 72 6e 56 61 6c 75 65 20 3d 20 5b 65 72 72 6f 72 55 74 69 6c 73 2e 73 65 72 69 61 6c 69 7a | turnValue.=.[errorUtils.serializ |
29c60 | 65 28 65 72 72 6f 72 29 5d 0a 20 20 7d 0a 7d 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 | e(error)]...}.}..ipcMain.on('ELE |
29c80 | 43 54 52 4f 4e 5f 43 52 41 53 48 5f 52 45 50 4f 52 54 45 52 5f 49 4e 49 54 27 2c 20 66 75 6e 63 | CTRON_CRASH_REPORTER_INIT',.func |
29ca0 | 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 73 65 74 52 65 74 | tion.(event,.options).{...setRet |
29cc0 | 75 72 6e 56 61 6c 75 65 28 65 76 65 6e 74 2c 20 28 29 20 3d 3e 20 63 72 61 73 68 52 65 70 6f 72 | urnValue(event,.().=>.crashRepor |
29ce0 | 74 65 72 49 6e 69 74 28 6f 70 74 69 6f 6e 73 29 29 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e | terInit(options)).})..ipcMain.on |
29d00 | 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 47 45 54 5f 4c 41 53 54 5f 57 45 42 5f | ('ELECTRON_BROWSER_GET_LAST_WEB_ |
29d20 | 50 52 45 46 45 52 45 4e 43 45 53 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 29 20 7b | PREFERENCES',.function.(event).{ |
29d40 | 0a 20 20 73 65 74 52 65 74 75 72 6e 56 61 6c 75 65 28 65 76 65 6e 74 2c 20 28 29 20 3d 3e 20 65 | ...setReturnValue(event,.().=>.e |
29d60 | 76 65 6e 74 2e 73 65 6e 64 65 72 2e 67 65 74 4c 61 73 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 | vent.sender.getLastWebPreference |
29d80 | 73 28 29 29 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 | s()).})..ipcMain.on('ELECTRON_BR |
29da0 | 4f 57 53 45 52 5f 43 4c 49 50 42 4f 41 52 44 5f 52 45 41 44 5f 46 49 4e 44 5f 54 45 58 54 27 2c | OWSER_CLIPBOARD_READ_FIND_TEXT', |
29dc0 | 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 29 20 7b 0a 20 20 73 65 74 52 65 74 75 72 6e 56 | .function.(event).{...setReturnV |
29de0 | 61 6c 75 65 28 65 76 65 6e 74 2c 20 28 29 20 3d 3e 20 65 6c 65 63 74 72 6f 6e 2e 63 6c 69 70 62 | alue(event,.().=>.electron.clipb |
29e00 | 6f 61 72 64 2e 72 65 61 64 46 69 6e 64 54 65 78 74 28 29 29 0a 7d 29 0a 0a 69 70 63 4d 61 69 6e | oard.readFindText()).})..ipcMain |
29e20 | 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 43 4c 49 50 42 4f 41 52 44 5f | .on('ELECTRON_BROWSER_CLIPBOARD_ |
29e40 | 57 52 49 54 45 5f 46 49 4e 44 5f 54 45 58 54 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e | WRITE_FIND_TEXT',.function.(even |
29e60 | 74 2c 20 74 65 78 74 29 20 7b 0a 20 20 73 65 74 52 65 74 75 72 6e 56 61 6c 75 65 28 65 76 65 6e | t,.text).{...setReturnValue(even |
29e80 | 74 2c 20 28 29 20 3d 3e 20 65 6c 65 63 74 72 6f 6e 2e 63 6c 69 70 62 6f 61 72 64 2e 77 72 69 74 | t,.().=>.electron.clipboard.writ |
29ea0 | 65 46 69 6e 64 54 65 78 74 28 74 65 78 74 29 29 0a 7d 29 0a 0a 63 6f 6e 73 74 20 67 65 74 50 72 | eFindText(text)).})..const.getPr |
29ec0 | 65 6c 6f 61 64 53 63 72 69 70 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 70 72 65 6c 6f 61 64 50 | eloadScript.=.function.(preloadP |
29ee0 | 61 74 68 29 20 7b 0a 20 20 6c 65 74 20 70 72 65 6c 6f 61 64 53 72 63 20 3d 20 6e 75 6c 6c 0a 20 | ath).{...let.preloadSrc.=.null.. |
29f00 | 20 6c 65 74 20 70 72 65 6c 6f 61 64 45 72 72 6f 72 20 3d 20 6e 75 6c 6c 0a 20 20 69 66 20 28 70 | .let.preloadError.=.null...if.(p |
29f20 | 72 65 6c 6f 61 64 50 61 74 68 29 20 7b 0a 20 20 20 20 74 72 79 20 7b 0a 20 20 20 20 20 20 70 72 | reloadPath).{.....try.{.......pr |
29f40 | 65 6c 6f 61 64 53 72 63 20 3d 20 66 73 2e 72 65 61 64 46 69 6c 65 53 79 6e 63 28 70 72 65 6c 6f | eloadSrc.=.fs.readFileSync(prelo |
29f60 | 61 64 50 61 74 68 29 2e 74 6f 53 74 72 69 6e 67 28 29 0a 20 20 20 20 7d 20 63 61 74 63 68 20 28 | adPath).toString().....}.catch.( |
29f80 | 65 72 72 29 20 7b 0a 20 20 20 20 20 20 70 72 65 6c 6f 61 64 45 72 72 6f 72 20 3d 20 65 72 72 6f | err).{.......preloadError.=.erro |
29fa0 | 72 55 74 69 6c 73 2e 73 65 72 69 61 6c 69 7a 65 28 65 72 72 29 0a 20 20 20 20 7d 0a 20 20 7d 0a | rUtils.serialize(err).....}...}. |
29fc0 | 20 20 72 65 74 75 72 6e 20 7b 20 70 72 65 6c 6f 61 64 50 61 74 68 2c 20 70 72 65 6c 6f 61 64 53 | ..return.{.preloadPath,.preloadS |
29fe0 | 72 63 2c 20 70 72 65 6c 6f 61 64 45 72 72 6f 72 20 7d 0a 7d 0a 0a 69 70 63 4d 61 69 6e 2e 6f 6e | rc,.preloadError.}.}..ipcMain.on |
2a000 | 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 53 41 4e 44 42 4f 58 5f 4c 4f 41 44 27 | ('ELECTRON_BROWSER_SANDBOX_LOAD' |
2a020 | 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 29 20 7b 0a 20 20 63 6f 6e 73 74 20 70 72 65 | ,.function.(event).{...const.pre |
2a040 | 6c 6f 61 64 50 61 74 68 73 20 3d 20 5b 0a 20 20 20 20 2e 2e 2e 28 65 76 65 6e 74 2e 73 65 6e 64 | loadPaths.=.[........(event.send |
2a060 | 65 72 2e 73 65 73 73 69 6f 6e 20 3f 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 73 65 73 73 69 6f | er.session.?.event.sender.sessio |
2a080 | 6e 2e 67 65 74 50 72 65 6c 6f 61 64 73 28 29 20 3a 20 5b 5d 29 2c 0a 20 20 20 20 65 76 65 6e 74 | n.getPreloads().:.[]),.....event |
2a0a0 | 2e 73 65 6e 64 65 72 2e 5f 67 65 74 50 72 65 6c 6f 61 64 50 61 74 68 28 29 0a 20 20 5d 0a 0a 20 | .sender._getPreloadPath()...]... |
2a0c0 | 20 65 76 65 6e 74 2e 72 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 7b 0a 20 20 20 20 70 72 65 6c 6f | .event.returnValue.=.{.....prelo |
2a0e0 | 61 64 53 63 72 69 70 74 73 3a 20 70 72 65 6c 6f 61 64 50 61 74 68 73 2e 6d 61 70 28 70 61 74 68 | adScripts:.preloadPaths.map(path |
2a100 | 20 3d 3e 20 67 65 74 50 72 65 6c 6f 61 64 53 63 72 69 70 74 28 70 61 74 68 29 29 2c 0a 20 20 20 | .=>.getPreloadScript(path)),.... |
2a120 | 20 69 73 52 65 6d 6f 74 65 4d 6f 64 75 6c 65 45 6e 61 62 6c 65 64 3a 20 65 76 65 6e 74 2e 73 65 | .isRemoteModuleEnabled:.event.se |
2a140 | 6e 64 65 72 2e 5f 69 73 52 65 6d 6f 74 65 4d 6f 64 75 6c 65 45 6e 61 62 6c 65 64 28 29 2c 0a 20 | nder._isRemoteModuleEnabled(),.. |
2a160 | 20 20 20 70 72 6f 63 65 73 73 3a 20 7b 0a 20 20 20 20 20 20 61 72 63 68 3a 20 70 72 6f 63 65 73 | ...process:.{.......arch:.proces |
2a180 | 73 2e 61 72 63 68 2c 0a 20 20 20 20 20 20 70 6c 61 74 66 6f 72 6d 3a 20 70 72 6f 63 65 73 73 2e | s.arch,.......platform:.process. |
2a1a0 | 70 6c 61 74 66 6f 72 6d 2c 0a 20 20 20 20 20 20 65 6e 76 3a 20 70 72 6f 63 65 73 73 2e 65 6e 76 | platform,.......env:.process.env |
2a1c0 | 2c 0a 20 20 20 20 20 20 76 65 72 73 69 6f 6e 3a 20 70 72 6f 63 65 73 73 2e 76 65 72 73 69 6f 6e | ,.......version:.process.version |
2a1e0 | 2c 0a 20 20 20 20 20 20 76 65 72 73 69 6f 6e 73 3a 20 70 72 6f 63 65 73 73 2e 76 65 72 73 69 6f | ,.......versions:.process.versio |
2a200 | 6e 73 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 69 66 | ns.....}...}.}).'use.strict'..if |
2a220 | 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 6c 69 6e 75 78 27 20 26 | .(process.platform.===.'linux'.& |
2a240 | 26 20 70 72 6f 63 65 73 73 2e 74 79 70 65 20 3d 3d 3d 20 27 72 65 6e 64 65 72 65 72 27 29 20 7b | &.process.type.===.'renderer').{ |
2a260 | 0a 20 20 2f 2f 20 4f 6e 20 4c 69 6e 75 78 20 77 65 20 63 6f 75 6c 64 20 6e 6f 74 20 61 63 63 65 | ...//.On.Linux.we.could.not.acce |
2a280 | 73 73 20 63 6c 69 70 62 6f 61 72 64 20 69 6e 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 73 | ss.clipboard.in.renderer.process |
2a2a0 | 2e 0a 20 20 63 6f 6e 73 74 20 7b 20 67 65 74 52 65 6d 6f 74 65 46 6f 72 55 73 61 67 65 20 7d 20 | ....const.{.getRemoteForUsage.}. |
2a2c0 | 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 | =.require('@electron/internal/re |
2a2e0 | 6e 64 65 72 65 72 2f 72 65 6d 6f 74 65 27 29 0a 20 20 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 | nderer/remote')...module.exports |
2a300 | 20 3d 20 67 65 74 52 65 6d 6f 74 65 46 6f 72 55 73 61 67 65 28 27 63 6c 69 70 62 6f 61 72 64 27 | .=.getRemoteForUsage('clipboard' |
2a320 | 29 2e 63 6c 69 70 62 6f 61 72 64 0a 7d 20 65 6c 73 65 20 7b 0a 20 20 63 6f 6e 73 74 20 63 6c 69 | ).clipboard.}.else.{...const.cli |
2a340 | 70 62 6f 61 72 64 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 63 6c | pboard.=.process.atomBinding('cl |
2a360 | 69 70 62 6f 61 72 64 27 29 0a 0a 20 20 2f 2f 20 52 65 61 64 2f 77 72 69 74 65 20 74 6f 20 66 69 | ipboard')....//.Read/write.to.fi |
2a380 | 6e 64 20 70 61 73 74 65 62 6f 61 72 64 20 6f 76 65 72 20 49 50 43 20 73 69 6e 63 65 20 6f 6e 6c | nd.pasteboard.over.IPC.since.onl |
2a3a0 | 79 20 6d 61 69 6e 20 70 72 6f 63 65 73 73 20 69 73 20 6e 6f 74 69 66 69 65 64 0a 20 20 2f 2f 20 | y.main.process.is.notified...//. |
2a3c0 | 6f 66 20 63 68 61 6e 67 65 73 0a 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 | of.changes...if.(process.platfor |
2a3e0 | 6d 20 3d 3d 3d 20 27 64 61 72 77 69 6e 27 20 26 26 20 70 72 6f 63 65 73 73 2e 74 79 70 65 20 3d | m.===.'darwin'.&&.process.type.= |
2a400 | 3d 3d 20 27 72 65 6e 64 65 72 65 72 27 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 69 70 63 52 65 | ==.'renderer').{.....const.ipcRe |
2a420 | 6e 64 65 72 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 | nderer.=.require('@electron/inte |
2a440 | 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 69 70 63 2d 72 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 | rnal/renderer/ipc-renderer-inter |
2a460 | 6e 61 6c 27 29 0a 20 20 20 20 63 6f 6e 73 74 20 65 72 72 6f 72 55 74 69 6c 73 20 3d 20 72 65 71 | nal').....const.errorUtils.=.req |
2a480 | 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f | uire('@electron/internal/common/ |
2a4a0 | 65 72 72 6f 72 2d 75 74 69 6c 73 27 29 0a 0a 20 20 20 20 63 6f 6e 73 74 20 69 6e 76 6f 6b 65 20 | error-utils')......const.invoke. |
2a4c0 | 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 6f 6d 6d 61 6e 64 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a | =.function.(command,....args).{. |
2a4e0 | 20 20 20 20 20 20 63 6f 6e 73 74 20 5b 20 65 72 72 6f 72 2c 20 72 65 73 75 6c 74 20 5d 20 3d 20 | ......const.[.error,.result.].=. |
2a500 | 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 2e 2e | ipcRenderer.sendSync(command,... |
2a520 | 2e 61 72 67 73 29 0a 0a 20 20 20 20 20 20 69 66 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 | .args)........if.(error).{...... |
2a540 | 20 20 20 74 68 72 6f 77 20 65 72 72 6f 72 55 74 69 6c 73 2e 64 65 73 65 72 69 61 6c 69 7a 65 28 | ...throw.errorUtils.deserialize( |
2a560 | 65 72 72 6f 72 29 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 72 65 | error).......}.else.{.........re |
2a580 | 74 75 72 6e 20 72 65 73 75 6c 74 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 | turn.result.......}.....}......c |
2a5a0 | 6c 69 70 62 6f 61 72 64 2e 72 65 61 64 46 69 6e 64 54 65 78 74 20 3d 20 28 2e 2e 2e 61 72 67 73 | lipboard.readFindText.=.(...args |
2a5c0 | 29 20 3d 3e 20 69 6e 76 6f 6b 65 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 43 4c | ).=>.invoke('ELECTRON_BROWSER_CL |
2a5e0 | 49 50 42 4f 41 52 44 5f 52 45 41 44 5f 46 49 4e 44 5f 54 45 58 54 27 2c 20 2e 2e 2e 61 72 67 73 | IPBOARD_READ_FIND_TEXT',....args |
2a600 | 29 0a 20 20 20 20 63 6c 69 70 62 6f 61 72 64 2e 77 72 69 74 65 46 69 6e 64 54 65 78 74 20 3d 20 | ).....clipboard.writeFindText.=. |
2a620 | 28 2e 2e 2e 61 72 67 73 29 20 3d 3e 20 69 6e 76 6f 6b 65 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 | (...args).=>.invoke('ELECTRON_BR |
2a640 | 4f 57 53 45 52 5f 43 4c 49 50 42 4f 41 52 44 5f 57 52 49 54 45 5f 46 49 4e 44 5f 54 45 58 54 27 | OWSER_CLIPBOARD_WRITE_FIND_TEXT' |
2a660 | 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 0a 0a 20 20 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 | ,....args)...}....module.exports |
2a680 | 20 3d 20 63 6c 69 70 62 6f 61 72 64 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 6c 65 74 | .=.clipboard.}.'use.strict'..let |
2a6a0 | 20 64 65 70 72 65 63 61 74 69 6f 6e 48 61 6e 64 6c 65 72 20 3d 20 6e 75 6c 6c 0a 0a 66 75 6e 63 | .deprecationHandler.=.null..func |
2a6c0 | 74 69 6f 6e 20 77 61 72 6e 4f 6e 63 65 20 28 6f 6c 64 4e 61 6d 65 2c 20 6e 65 77 4e 61 6d 65 29 | tion.warnOnce.(oldName,.newName) |
2a6e0 | 20 7b 0a 20 20 6c 65 74 20 77 61 72 6e 65 64 20 3d 20 66 61 6c 73 65 0a 20 20 63 6f 6e 73 74 20 | .{...let.warned.=.false...const. |
2a700 | 6d 73 67 20 3d 20 6e 65 77 4e 61 6d 65 0a 20 20 20 20 3f 20 60 27 24 7b 6f 6c 64 4e 61 6d 65 7d | msg.=.newName.....?.`'${oldName} |
2a720 | 27 20 69 73 20 64 65 70 72 65 63 61 74 65 64 20 61 6e 64 20 77 69 6c 6c 20 62 65 20 72 65 6d 6f | '.is.deprecated.and.will.be.remo |
2a740 | 76 65 64 2e 20 50 6c 65 61 73 65 20 75 73 65 20 27 24 7b 6e 65 77 4e 61 6d 65 7d 27 20 69 6e 73 | ved..Please.use.'${newName}'.ins |
2a760 | 74 65 61 64 2e 60 0a 20 20 20 20 3a 20 60 27 24 7b 6f 6c 64 4e 61 6d 65 7d 27 20 69 73 20 64 65 | tead.`.....:.`'${oldName}'.is.de |
2a780 | 70 72 65 63 61 74 65 64 20 61 6e 64 20 77 69 6c 6c 20 62 65 20 72 65 6d 6f 76 65 64 2e 60 0a 20 | precated.and.will.be.removed.`.. |
2a7a0 | 20 72 65 74 75 72 6e 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 21 77 61 72 6e 65 64 20 | .return.().=>.{.....if.(!warned. |
2a7c0 | 26 26 20 21 70 72 6f 63 65 73 73 2e 6e 6f 44 65 70 72 65 63 61 74 69 6f 6e 29 20 7b 0a 20 20 20 | &&.!process.noDeprecation).{.... |
2a7e0 | 20 20 20 77 61 72 6e 65 64 20 3d 20 74 72 75 65 0a 20 20 20 20 20 20 64 65 70 72 65 63 61 74 65 | ...warned.=.true.......deprecate |
2a800 | 2e 6c 6f 67 28 6d 73 67 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 63 6f 6e 73 74 20 64 65 70 | .log(msg).....}...}.}..const.dep |
2a820 | 72 65 63 61 74 65 20 3d 20 7b 0a 20 20 73 65 74 48 61 6e 64 6c 65 72 3a 20 28 68 61 6e 64 6c 65 | recate.=.{...setHandler:.(handle |
2a840 | 72 29 20 3d 3e 20 7b 20 64 65 70 72 65 63 61 74 69 6f 6e 48 61 6e 64 6c 65 72 20 3d 20 68 61 6e | r).=>.{.deprecationHandler.=.han |
2a860 | 64 6c 65 72 20 7d 2c 0a 20 20 67 65 74 48 61 6e 64 6c 65 72 3a 20 28 29 20 3d 3e 20 64 65 70 72 | dler.},...getHandler:.().=>.depr |
2a880 | 65 63 61 74 69 6f 6e 48 61 6e 64 6c 65 72 2c 0a 20 20 77 61 72 6e 3a 20 28 6f 6c 64 4e 61 6d 65 | ecationHandler,...warn:.(oldName |
2a8a0 | 2c 20 6e 65 77 4e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 64 65 70 72 65 | ,.newName).=>.{.....return.depre |
2a8c0 | 63 61 74 65 2e 6c 6f 67 28 60 27 24 7b 6f 6c 64 4e 61 6d 65 7d 27 20 69 73 20 64 65 70 72 65 63 | cate.log(`'${oldName}'.is.deprec |
2a8e0 | 61 74 65 64 2e 20 55 73 65 20 27 24 7b 6e 65 77 4e 61 6d 65 7d 27 20 69 6e 73 74 65 61 64 2e 60 | ated..Use.'${newName}'.instead.` |
2a900 | 29 0a 20 20 7d 2c 0a 20 20 6c 6f 67 3a 20 28 6d 65 73 73 61 67 65 29 20 3d 3e 20 7b 0a 20 20 20 | )...},...log:.(message).=>.{.... |
2a920 | 20 69 66 20 28 74 79 70 65 6f 66 20 64 65 70 72 65 63 61 74 69 6f 6e 48 61 6e 64 6c 65 72 20 3d | .if.(typeof.deprecationHandler.= |
2a940 | 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 64 65 70 72 65 63 61 74 69 | ==.'function').{.......deprecati |
2a960 | 6f 6e 48 61 6e 64 6c 65 72 28 6d 65 73 73 61 67 65 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 | onHandler(message).....}.else.if |
2a980 | 20 28 70 72 6f 63 65 73 73 2e 74 68 72 6f 77 44 65 70 72 65 63 61 74 69 6f 6e 29 20 7b 0a 20 20 | .(process.throwDeprecation).{... |
2a9a0 | 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 6d 65 73 73 61 67 65 29 0a 20 20 20 | ....throw.new.Error(message).... |
2a9c0 | 20 7d 20 65 6c 73 65 20 69 66 20 28 70 72 6f 63 65 73 73 2e 74 72 61 63 65 44 65 70 72 65 63 61 | .}.else.if.(process.traceDepreca |
2a9e0 | 74 69 6f 6e 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 6f 6e 73 6f 6c 65 2e 74 72 61 | tion).{.......return.console.tra |
2aa00 | 63 65 28 6d 65 73 73 61 67 65 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 | ce(message).....}.else.{.......r |
2aa20 | 65 74 75 72 6e 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 60 28 65 6c 65 63 74 72 6f 6e 29 20 24 | eturn.console.warn(`(electron).$ |
2aa40 | 7b 6d 65 73 73 61 67 65 7d 60 29 0a 20 20 20 20 7d 0a 20 20 7d 2c 0a 0a 20 20 65 76 65 6e 74 3a | {message}`).....}...},....event: |
2aa60 | 20 28 65 6d 69 74 74 65 72 2c 20 6f 6c 64 4e 61 6d 65 2c 20 6e 65 77 4e 61 6d 65 29 20 3d 3e 20 | .(emitter,.oldName,.newName).=>. |
2aa80 | 7b 0a 20 20 20 20 63 6f 6e 73 74 20 77 61 72 6e 20 3d 20 6e 65 77 4e 61 6d 65 2e 73 74 61 72 74 | {.....const.warn.=.newName.start |
2aaa0 | 73 57 69 74 68 28 27 2d 27 29 20 2f 2a 20 69 6e 74 65 72 6e 61 6c 20 65 76 65 6e 74 20 2a 2f 0a | sWith('-')./*.internal.event.*/. |
2aac0 | 20 20 20 20 20 20 3f 20 77 61 72 6e 4f 6e 63 65 28 60 24 7b 6f 6c 64 4e 61 6d 65 7d 20 65 76 65 | ......?.warnOnce(`${oldName}.eve |
2aae0 | 6e 74 60 29 0a 20 20 20 20 20 20 3a 20 77 61 72 6e 4f 6e 63 65 28 60 24 7b 6f 6c 64 4e 61 6d 65 | nt`).......:.warnOnce(`${oldName |
2ab00 | 7d 20 65 76 65 6e 74 60 2c 20 60 24 7b 6e 65 77 4e 61 6d 65 7d 20 65 76 65 6e 74 60 29 0a 20 20 | }.event`,.`${newName}.event`)... |
2ab20 | 20 20 72 65 74 75 72 6e 20 65 6d 69 74 74 65 72 2e 6f 6e 28 6e 65 77 4e 61 6d 65 2c 20 66 75 6e | ..return.emitter.on(newName,.fun |
2ab40 | 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 74 68 69 73 | ction.(...args).{.......if.(this |
2ab60 | 2e 6c 69 73 74 65 6e 65 72 43 6f 75 6e 74 28 6f 6c 64 4e 61 6d 65 29 20 21 3d 3d 20 30 29 20 7b | .listenerCount(oldName).!==.0).{ |
2ab80 | 0a 20 20 20 20 20 20 20 20 77 61 72 6e 28 29 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 65 6d 69 | .........warn().........this.emi |
2aba0 | 74 28 6f 6c 64 4e 61 6d 65 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 | t(oldName,....args).......}..... |
2abc0 | 7d 29 0a 20 20 7d 2c 0a 0a 20 20 72 65 6d 6f 76 65 50 72 6f 70 65 72 74 79 3a 20 28 6f 2c 20 72 | })...},....removeProperty:.(o,.r |
2abe0 | 65 6d 6f 76 65 64 4e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 20 20 2f 2f 20 69 66 20 74 68 65 20 70 | emovedName).=>.{.....//.if.the.p |
2ac00 | 72 6f 70 65 72 74 79 27 73 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 72 65 6d 6f 76 65 64 2c 20 | roperty's.already.been.removed,. |
2ac20 | 77 61 72 6e 20 61 62 6f 75 74 20 69 74 0a 20 20 20 20 69 66 20 28 21 28 72 65 6d 6f 76 65 64 4e | warn.about.it.....if.(!(removedN |
2ac40 | 61 6d 65 20 69 6e 20 6f 29 29 20 7b 0a 20 20 20 20 20 20 64 65 70 72 65 63 61 74 65 2e 6c 6f 67 | ame.in.o)).{.......deprecate.log |
2ac60 | 28 60 55 6e 61 62 6c 65 20 74 6f 20 72 65 6d 6f 76 65 20 70 72 6f 70 65 72 74 79 20 27 24 7b 72 | (`Unable.to.remove.property.'${r |
2ac80 | 65 6d 6f 76 65 64 4e 61 6d 65 7d 27 20 66 72 6f 6d 20 61 6e 20 6f 62 6a 65 63 74 20 74 68 61 74 | emovedName}'.from.an.object.that |
2aca0 | 20 6c 61 63 6b 73 20 69 74 2e 60 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 77 72 61 70 20 | .lacks.it.`).....}......//.wrap. |
2acc0 | 74 68 65 20 64 65 70 72 65 63 61 74 65 64 20 70 72 6f 70 65 72 74 79 20 69 6e 20 61 6e 20 61 63 | the.deprecated.property.in.an.ac |
2ace0 | 63 65 73 73 6f 72 20 74 6f 20 77 61 72 6e 0a 20 20 20 20 63 6f 6e 73 74 20 77 61 72 6e 20 3d 20 | cessor.to.warn.....const.warn.=. |
2ad00 | 77 61 72 6e 4f 6e 63 65 28 72 65 6d 6f 76 65 64 4e 61 6d 65 29 0a 20 20 20 20 6c 65 74 20 76 61 | warnOnce(removedName).....let.va |
2ad20 | 6c 20 3d 20 6f 5b 72 65 6d 6f 76 65 64 4e 61 6d 65 5d 0a 20 20 20 20 72 65 74 75 72 6e 20 4f 62 | l.=.o[removedName].....return.Ob |
2ad40 | 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 6f 2c 20 72 65 6d 6f 76 65 64 4e 61 | ject.defineProperty(o,.removedNa |
2ad60 | 6d 65 2c 20 7b 0a 20 20 20 20 20 20 63 6f 6e 66 69 67 75 72 61 62 6c 65 3a 20 74 72 75 65 2c 0a | me,.{.......configurable:.true,. |
2ad80 | 20 20 20 20 20 20 67 65 74 3a 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 77 61 72 6e 28 | ......get:.().=>.{.........warn( |
2ada0 | 29 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 76 61 6c 0a 20 20 20 20 20 20 7d 2c 0a 20 20 | ).........return.val.......},... |
2adc0 | 20 20 20 20 73 65 74 3a 20 6e 65 77 56 61 6c 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 77 61 72 | ....set:.newVal.=>.{.........war |
2ade0 | 6e 28 29 0a 20 20 20 20 20 20 20 20 76 61 6c 20 3d 20 6e 65 77 56 61 6c 0a 20 20 20 20 20 20 7d | n().........val.=.newVal.......} |
2ae00 | 0a 20 20 20 20 7d 29 0a 20 20 7d 2c 0a 0a 20 20 72 65 6e 61 6d 65 50 72 6f 70 65 72 74 79 3a 20 | .....})...},....renameProperty:. |
2ae20 | 28 6f 2c 20 6f 6c 64 4e 61 6d 65 2c 20 6e 65 77 4e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 20 20 63 | (o,.oldName,.newName).=>.{.....c |
2ae40 | 6f 6e 73 74 20 77 61 72 6e 20 3d 20 77 61 72 6e 4f 6e 63 65 28 6f 6c 64 4e 61 6d 65 2c 20 6e 65 | onst.warn.=.warnOnce(oldName,.ne |
2ae60 | 77 4e 61 6d 65 29 0a 0a 20 20 20 20 2f 2f 20 69 66 20 74 68 65 20 6e 65 77 20 70 72 6f 70 65 72 | wName)......//.if.the.new.proper |
2ae80 | 74 79 20 69 73 6e 27 74 20 74 68 65 72 65 20 79 65 74 2c 0a 20 20 20 20 2f 2f 20 69 6e 6a 65 63 | ty.isn't.there.yet,.....//.injec |
2aea0 | 74 20 69 74 20 61 6e 64 20 77 61 72 6e 20 61 62 6f 75 74 20 69 74 0a 20 20 20 20 69 66 20 28 28 | t.it.and.warn.about.it.....if.(( |
2aec0 | 6f 6c 64 4e 61 6d 65 20 69 6e 20 6f 29 20 26 26 20 21 28 6e 65 77 4e 61 6d 65 20 69 6e 20 6f 29 | oldName.in.o).&&.!(newName.in.o) |
2aee0 | 29 20 7b 0a 20 20 20 20 20 20 77 61 72 6e 28 29 0a 20 20 20 20 20 20 6f 5b 6e 65 77 4e 61 6d 65 | ).{.......warn().......o[newName |
2af00 | 5d 20 3d 20 6f 5b 6f 6c 64 4e 61 6d 65 5d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 77 72 61 | ].=.o[oldName].....}......//.wra |
2af20 | 70 20 74 68 65 20 64 65 70 72 65 63 61 74 65 64 20 70 72 6f 70 65 72 74 79 20 69 6e 20 61 6e 20 | p.the.deprecated.property.in.an. |
2af40 | 61 63 63 65 73 73 6f 72 20 74 6f 20 77 61 72 6e 0a 20 20 20 20 2f 2f 20 61 6e 64 20 72 65 64 69 | accessor.to.warn.....//.and.redi |
2af60 | 72 65 63 74 20 74 6f 20 74 68 65 20 6e 65 77 20 70 72 6f 70 65 72 74 79 0a 20 20 20 20 72 65 74 | rect.to.the.new.property.....ret |
2af80 | 75 72 6e 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 6f 2c 20 6f 6c 64 | urn.Object.defineProperty(o,.old |
2afa0 | 4e 61 6d 65 2c 20 7b 0a 20 20 20 20 20 20 67 65 74 3a 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 | Name,.{.......get:.().=>.{...... |
2afc0 | 20 20 20 77 61 72 6e 28 29 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6f 5b 6e 65 77 4e 61 | ...warn().........return.o[newNa |
2afe0 | 6d 65 5d 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 73 65 74 3a 20 76 61 6c 75 65 20 3d 3e | me].......},.......set:.value.=> |
2b000 | 20 7b 0a 20 20 20 20 20 20 20 20 77 61 72 6e 28 29 0a 20 20 20 20 20 20 20 20 6f 5b 6e 65 77 4e | .{.........warn().........o[newN |
2b020 | 61 6d 65 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 29 0a 20 20 7d 0a | ame].=.value.......}.....})...}. |
2b040 | 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 64 65 70 72 65 63 61 74 65 0a 27 75 | }..module.exports.=.deprecate.'u |
2b060 | 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 64 65 70 72 65 63 61 74 65 20 3d 20 72 65 | se.strict'..const.deprecate.=.re |
2b080 | 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 2e 64 65 70 72 65 63 61 74 65 0a 0a 65 78 70 | quire('electron').deprecate..exp |
2b0a0 | 6f 72 74 73 2e 73 65 74 48 61 6e 64 6c 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 64 65 70 72 | orts.setHandler.=.function.(depr |
2b0c0 | 65 63 61 74 69 6f 6e 48 61 6e 64 6c 65 72 29 20 7b 0a 20 20 64 65 70 72 65 63 61 74 65 2e 73 65 | ecationHandler).{...deprecate.se |
2b0e0 | 74 48 61 6e 64 6c 65 72 28 64 65 70 72 65 63 61 74 69 6f 6e 48 61 6e 64 6c 65 72 29 0a 7d 0a 0a | tHandler(deprecationHandler).}.. |
2b100 | 65 78 70 6f 72 74 73 2e 67 65 74 48 61 6e 64 6c 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 | exports.getHandler.=.function.() |
2b120 | 20 7b 0a 20 20 72 65 74 75 72 6e 20 64 65 70 72 65 63 61 74 65 2e 67 65 74 48 61 6e 64 6c 65 72 | .{...return.deprecate.getHandler |
2b140 | 28 29 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 6d 6f 64 75 6c 65 4c | ().}.'use.strict'..const.moduleL |
2b160 | 69 73 74 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 | ist.=.require('@electron/interna |
2b180 | 6c 2f 63 6f 6d 6d 6f 6e 2f 61 70 69 2f 6d 6f 64 75 6c 65 2d 6c 69 73 74 27 29 0a 0a 65 78 70 6f | l/common/api/module-list')..expo |
2b1a0 | 72 74 73 2e 6d 65 6d 6f 69 7a 65 64 47 65 74 74 65 72 20 3d 20 28 67 65 74 74 65 72 29 20 3d 3e | rts.memoizedGetter.=.(getter).=> |
2b1c0 | 20 7b 0a 20 20 2f 2a 0a 20 20 20 2a 20 49 74 27 73 20 6f 6b 20 74 6f 20 6c 65 61 6b 20 74 68 69 | .{.../*....*.It's.ok.to.leak.thi |
2b1e0 | 73 20 76 61 6c 75 65 20 61 73 20 69 74 20 77 6f 75 6c 64 20 62 65 20 6c 65 61 6b 65 64 20 62 79 | s.value.as.it.would.be.leaked.by |
2b200 | 20 74 68 65 20 67 6c 6f 62 61 6c 0a 20 20 20 2a 20 6e 6f 64 65 20 6d 6f 64 75 6c 65 20 63 61 63 | .the.global....*.node.module.cac |
2b220 | 68 65 20 61 6e 79 77 61 79 20 61 74 20 60 4d 6f 64 75 6c 65 2e 5f 63 61 63 68 65 60 2e 20 20 54 | he.anyway.at.`Module._cache`...T |
2b240 | 68 69 73 20 6d 65 6d 6f 69 7a 61 74 69 6f 6e 0a 20 20 20 2a 20 69 73 20 64 72 61 6d 61 74 69 63 | his.memoization....*.is.dramatic |
2b260 | 61 6c 6c 79 20 66 61 73 74 65 72 20 74 68 61 6e 20 72 65 6c 79 69 6e 67 20 6f 6e 20 6e 6f 64 65 | ally.faster.than.relying.on.node |
2b280 | 73 20 6d 6f 64 75 6c 65 20 63 61 63 68 65 20 68 6f 77 65 76 65 72 0a 20 20 20 2a 2f 0a 20 20 6c | s.module.cache.however....*/...l |
2b2a0 | 65 74 20 6d 65 6d 6f 69 7a 65 64 56 61 6c 75 65 20 3d 20 6e 75 6c 6c 0a 0a 20 20 72 65 74 75 72 | et.memoizedValue.=.null....retur |
2b2c0 | 6e 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 6d 65 6d 6f 69 7a 65 64 56 61 6c 75 65 20 | n.().=>.{.....if.(memoizedValue. |
2b2e0 | 3d 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 6d 65 6d 6f 69 7a 65 64 56 61 6c 75 65 20 | ===.null).{.......memoizedValue. |
2b300 | 3d 20 67 65 74 74 65 72 28 29 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 6d 65 6d 6f | =.getter().....}.....return.memo |
2b320 | 69 7a 65 64 56 61 6c 75 65 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 61 63 68 65 73 20 70 72 6f | izedValue...}.}..//.Attaches.pro |
2b340 | 70 65 72 74 69 65 73 20 74 6f 20 7c 74 61 72 67 65 74 45 78 70 6f 72 74 73 7c 2e 0a 65 78 70 6f | perties.to.|targetExports|..expo |
2b360 | 72 74 73 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 69 65 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 | rts.defineProperties.=.function. |
2b380 | 28 74 61 72 67 65 74 45 78 70 6f 72 74 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 64 65 73 63 72 69 | (targetExports).{...const.descri |
2b3a0 | 70 74 6f 72 73 20 3d 20 7b 7d 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 6d 6f 64 75 6c 65 20 6f | ptors.=.{}...for.(const.module.o |
2b3c0 | 66 20 6d 6f 64 75 6c 65 4c 69 73 74 29 20 7b 0a 20 20 20 20 64 65 73 63 72 69 70 74 6f 72 73 5b | f.moduleList).{.....descriptors[ |
2b3e0 | 6d 6f 64 75 6c 65 2e 6e 61 6d 65 5d 20 3d 20 7b 0a 20 20 20 20 20 20 65 6e 75 6d 65 72 61 62 6c | module.name].=.{.......enumerabl |
2b400 | 65 3a 20 21 6d 6f 64 75 6c 65 2e 70 72 69 76 61 74 65 2c 0a 20 20 20 20 20 20 67 65 74 3a 20 65 | e:.!module.private,.......get:.e |
2b420 | 78 70 6f 72 74 73 2e 6d 65 6d 6f 69 7a 65 64 47 65 74 74 65 72 28 28 29 20 3d 3e 20 72 65 71 75 | xports.memoizedGetter(().=>.requ |
2b440 | 69 72 65 28 60 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 61 | ire(`@electron/internal/common/a |
2b460 | 70 69 2f 24 7b 6d 6f 64 75 6c 65 2e 66 69 6c 65 7d 60 29 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 | pi/${module.file}`)).....}...}.. |
2b480 | 20 72 65 74 75 72 6e 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 69 65 73 28 | .return.Object.defineProperties( |
2b4a0 | 74 61 72 67 65 74 45 78 70 6f 72 74 73 2c 20 64 65 73 63 72 69 70 74 6f 72 73 29 0a 7d 0a 27 75 | targetExports,.descriptors).}.'u |
2b4c0 | 73 65 20 73 74 72 69 63 74 27 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 66 75 6e | se.strict'..module.exports.=.fun |
2b4e0 | 63 74 69 6f 6e 20 69 73 50 72 6f 6d 69 73 65 20 28 76 61 6c 29 20 7b 0a 20 20 72 65 74 75 72 6e | ction.isPromise.(val).{...return |
2b500 | 20 28 0a 20 20 20 20 76 61 6c 20 26 26 0a 20 20 20 20 76 61 6c 2e 74 68 65 6e 20 26 26 0a 20 20 | .(.....val.&&.....val.then.&&... |
2b520 | 20 20 76 61 6c 2e 74 68 65 6e 20 69 6e 73 74 61 6e 63 65 6f 66 20 46 75 6e 63 74 69 6f 6e 20 26 | ..val.then.instanceof.Function.& |
2b540 | 26 0a 20 20 20 20 76 61 6c 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 26 26 0a 20 20 20 20 76 61 6c | &.....val.constructor.&&.....val |
2b560 | 2e 63 6f 6e 73 74 72 75 63 74 6f 72 2e 72 65 6a 65 63 74 20 26 26 0a 20 20 20 20 76 61 6c 2e 63 | .constructor.reject.&&.....val.c |
2b580 | 6f 6e 73 74 72 75 63 74 6f 72 2e 72 65 6a 65 63 74 20 69 6e 73 74 61 6e 63 65 6f 66 20 46 75 6e | onstructor.reject.instanceof.Fun |
2b5a0 | 63 74 69 6f 6e 20 26 26 0a 20 20 20 20 76 61 6c 2e 63 6f 6e 73 74 72 75 63 74 6f 72 2e 72 65 73 | ction.&&.....val.constructor.res |
2b5c0 | 6f 6c 76 65 20 26 26 0a 20 20 20 20 76 61 6c 2e 63 6f 6e 73 74 72 75 63 74 6f 72 2e 72 65 73 6f | olve.&&.....val.constructor.reso |
2b5e0 | 6c 76 65 20 69 6e 73 74 61 6e 63 65 6f 66 20 46 75 6e 63 74 69 6f 6e 0a 20 20 29 0a 7d 0a 27 75 | lve.instanceof.Function...).}.'u |
2b600 | 73 65 20 73 74 72 69 63 74 27 0a 0a 2f 2f 20 43 6f 6d 6d 6f 6e 20 6d 6f 64 75 6c 65 73 2c 20 70 | se.strict'..//.Common.modules,.p |
2b620 | 6c 65 61 73 65 20 73 6f 72 74 20 61 6c 70 68 61 62 65 74 69 63 61 6c 6c 79 0a 6d 6f 64 75 6c 65 | lease.sort.alphabetically.module |
2b640 | 2e 65 78 70 6f 72 74 73 20 3d 20 5b 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 63 6c 69 70 62 6f 61 72 | .exports.=.[...{.name:.'clipboar |
2b660 | 64 27 2c 20 66 69 6c 65 3a 20 27 63 6c 69 70 62 6f 61 72 64 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d | d',.file:.'clipboard'.},...{.nam |
2b680 | 65 3a 20 27 6e 61 74 69 76 65 49 6d 61 67 65 27 2c 20 66 69 6c 65 3a 20 27 6e 61 74 69 76 65 2d | e:.'nativeImage',.file:.'native- |
2b6a0 | 69 6d 61 67 65 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 73 68 65 6c 6c 27 2c 20 66 69 6c | image'.},...{.name:.'shell',.fil |
2b6c0 | 65 3a 20 27 73 68 65 6c 6c 27 20 7d 2c 0a 20 20 2f 2f 20 54 68 65 20 69 6e 74 65 72 6e 61 6c 20 | e:.'shell'.},...//.The.internal. |
2b6e0 | 6d 6f 64 75 6c 65 73 2c 20 69 6e 76 69 73 69 62 6c 65 20 75 6e 6c 65 73 73 20 79 6f 75 20 6b 6e | modules,.invisible.unless.you.kn |
2b700 | 6f 77 20 74 68 65 69 72 20 6e 61 6d 65 73 2e 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 64 65 70 72 65 | ow.their.names....{.name:.'depre |
2b720 | 63 61 74 65 27 2c 20 66 69 6c 65 3a 20 27 64 65 70 72 65 63 61 74 65 27 2c 20 70 72 69 76 61 74 | cate',.file:.'deprecate',.privat |
2b740 | 65 3a 20 74 72 75 65 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 64 65 70 72 65 63 61 74 69 6f | e:.true.},...{.name:.'deprecatio |
2b760 | 6e 73 27 2c 20 66 69 6c 65 3a 20 27 64 65 70 72 65 63 61 74 69 6f 6e 73 27 2c 20 70 72 69 76 61 | ns',.file:.'deprecations',.priva |
2b780 | 74 65 3a 20 74 72 75 65 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 69 73 50 72 6f 6d 69 73 65 | te:.true.},...{.name:.'isPromise |
2b7a0 | 27 2c 20 66 69 6c 65 3a 20 27 69 73 2d 70 72 6f 6d 69 73 65 27 2c 20 70 72 69 76 61 74 65 3a 20 | ',.file:.'is-promise',.private:. |
2b7c0 | 74 72 75 65 20 7d 0a 5d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 6d 6f 64 75 6c 65 2e 65 78 | true.}.].'use.strict'..module.ex |
2b7e0 | 70 6f 72 74 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 6e 61 74 | ports.=.process.atomBinding('nat |
2b800 | 69 76 65 5f 69 6d 61 67 65 27 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 6d 6f 64 75 6c 65 | ive_image').'use.strict'..module |
2b820 | 2e 65 78 70 6f 72 74 73 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 | .exports.=.process.atomBinding(' |
2b840 | 73 68 65 6c 6c 27 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 | shell').'use.strict'..module.exp |
2b860 | 6f 72 74 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 61 74 6f 6d 42 69 6e 64 69 6e 67 53 65 74 75 70 | orts.=.function.atomBindingSetup |
2b880 | 20 28 62 69 6e 64 69 6e 67 2c 20 70 72 6f 63 65 73 73 54 79 70 65 29 20 7b 0a 20 20 72 65 74 75 | .(binding,.processType).{...retu |
2b8a0 | 72 6e 20 66 75 6e 63 74 69 6f 6e 20 61 74 6f 6d 42 69 6e 64 69 6e 67 20 28 6e 61 6d 65 29 20 7b | rn.function.atomBinding.(name).{ |
2b8c0 | 0a 20 20 20 20 74 72 79 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 28 | .....try.{.......return.binding( |
2b8e0 | 60 61 74 6f 6d 5f 24 7b 70 72 6f 63 65 73 73 54 79 70 65 7d 5f 24 7b 6e 61 6d 65 7d 60 29 0a 20 | `atom_${processType}_${name}`).. |
2b900 | 20 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 2f | ...}.catch.(error).{.......if.(/ |
2b920 | 4e 6f 20 73 75 63 68 20 6d 6f 64 75 6c 65 2f 2e 74 65 73 74 28 65 72 72 6f 72 2e 6d 65 73 73 61 | No.such.module/.test(error.messa |
2b940 | 67 65 29 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 28 60 61 | ge)).{.........return.binding(`a |
2b960 | 74 6f 6d 5f 63 6f 6d 6d 6f 6e 5f 24 7b 6e 61 6d 65 7d 60 29 0a 20 20 20 20 20 20 7d 20 65 6c 73 | tom_common_${name}`).......}.els |
2b980 | 65 20 7b 0a 20 20 20 20 20 20 20 20 74 68 72 6f 77 20 65 72 72 6f 72 0a 20 20 20 20 20 20 7d 0a | e.{.........throw.error.......}. |
2b9a0 | 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 2f 2f 20 4e 6f 74 | ....}...}.}.'use.strict'..//.Not |
2b9c0 | 65 3a 20 44 6f 6e 27 74 20 75 73 65 20 64 65 73 74 72 75 63 74 75 72 69 6e 67 20 61 73 73 69 67 | e:.Don't.use.destructuring.assig |
2b9e0 | 6e 6d 65 6e 74 20 66 6f 72 20 60 42 75 66 66 65 72 60 2c 20 6f 72 20 77 65 27 6c 6c 20 68 69 74 | nment.for.`Buffer`,.or.we'll.hit |
2ba00 | 20 61 0a 2f 2f 20 62 72 6f 77 73 65 72 69 66 79 20 62 75 67 20 74 68 61 74 20 6d 61 6b 65 73 20 | .a.//.browserify.bug.that.makes. |
2ba20 | 74 68 65 20 73 74 61 74 65 6d 65 6e 74 20 69 6e 76 61 6c 69 64 2c 20 74 68 72 6f 77 69 6e 67 20 | the.statement.invalid,.throwing. |
2ba40 | 61 6e 20 65 72 72 6f 72 20 69 6e 0a 2f 2f 20 73 61 6e 64 62 6f 78 65 64 20 72 65 6e 64 65 72 65 | an.error.in.//.sandboxed.rendere |
2ba60 | 72 2e 0a 63 6f 6e 73 74 20 42 75 66 66 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 62 75 66 66 65 | r..const.Buffer.=.require('buffe |
2ba80 | 72 27 29 2e 42 75 66 66 65 72 0a 0a 63 6f 6e 73 74 20 74 79 70 65 64 41 72 72 61 79 73 20 3d 20 | r').Buffer..const.typedArrays.=. |
2baa0 | 7b 0a 20 20 42 75 66 66 65 72 2c 0a 20 20 41 72 72 61 79 42 75 66 66 65 72 2c 0a 20 20 49 6e 74 | {...Buffer,...ArrayBuffer,...Int |
2bac0 | 38 41 72 72 61 79 2c 0a 20 20 55 69 6e 74 38 41 72 72 61 79 2c 0a 20 20 55 69 6e 74 38 43 6c 61 | 8Array,...Uint8Array,...Uint8Cla |
2bae0 | 6d 70 65 64 41 72 72 61 79 2c 0a 20 20 49 6e 74 31 36 41 72 72 61 79 2c 0a 20 20 55 69 6e 74 31 | mpedArray,...Int16Array,...Uint1 |
2bb00 | 36 41 72 72 61 79 2c 0a 20 20 49 6e 74 33 32 41 72 72 61 79 2c 0a 20 20 55 69 6e 74 33 32 41 72 | 6Array,...Int32Array,...Uint32Ar |
2bb20 | 72 61 79 2c 0a 20 20 46 6c 6f 61 74 33 32 41 72 72 61 79 2c 0a 20 20 46 6c 6f 61 74 36 34 41 72 | ray,...Float32Array,...Float64Ar |
2bb40 | 72 61 79 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 67 65 74 54 79 70 65 20 28 76 61 6c 75 65 29 20 | ray.}..function.getType.(value). |
2bb60 | 7b 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 74 79 70 65 20 6f 66 20 4f 62 6a 65 63 74 2e 6b 65 | {...for.(const.type.of.Object.ke |
2bb80 | 79 73 28 74 79 70 65 64 41 72 72 61 79 73 29 29 20 7b 0a 20 20 20 20 69 66 20 28 76 61 6c 75 65 | ys(typedArrays)).{.....if.(value |
2bba0 | 20 69 6e 73 74 61 6e 63 65 6f 66 20 74 79 70 65 64 41 72 72 61 79 73 5b 74 79 70 65 5d 29 20 7b | .instanceof.typedArrays[type]).{ |
2bbc0 | 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 79 70 65 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 72 | .......return.type.....}...}...r |
2bbe0 | 65 74 75 72 6e 20 6e 75 6c 6c 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 67 65 74 42 75 66 66 65 72 | eturn.null.}..function.getBuffer |
2bc00 | 20 28 76 61 6c 75 65 29 20 7b 0a 20 20 69 66 20 28 76 61 6c 75 65 20 69 6e 73 74 61 6e 63 65 6f | .(value).{...if.(value.instanceo |
2bc20 | 66 20 42 75 66 66 65 72 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 76 61 6c 75 65 0a 20 20 7d | f.Buffer).{.....return.value...} |
2bc40 | 20 65 6c 73 65 20 69 66 20 28 76 61 6c 75 65 20 69 6e 73 74 61 6e 63 65 6f 66 20 41 72 72 61 79 | .else.if.(value.instanceof.Array |
2bc60 | 42 75 66 66 65 72 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 42 75 66 66 65 72 2e 66 72 6f 6d | Buffer).{.....return.Buffer.from |
2bc80 | 28 76 61 6c 75 65 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 42 75 | (value)...}.else.{.....return.Bu |
2bca0 | 66 66 65 72 2e 66 72 6f 6d 28 76 61 6c 75 65 2e 62 75 66 66 65 72 2c 20 76 61 6c 75 65 2e 62 79 | ffer.from(value.buffer,.value.by |
2bcc0 | 74 65 4f 66 66 73 65 74 2c 20 76 61 6c 75 65 2e 62 79 74 65 4c 65 6e 67 74 68 29 0a 20 20 7d 0a | teOffset,.value.byteLength)...}. |
2bce0 | 7d 0a 0a 65 78 70 6f 72 74 73 2e 69 73 42 75 66 66 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 | }..exports.isBuffer.=.function.( |
2bd00 | 76 61 6c 75 65 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 41 72 72 61 79 42 75 66 66 65 72 2e 69 73 | value).{...return.ArrayBuffer.is |
2bd20 | 56 69 65 77 28 76 61 6c 75 65 29 20 7c 7c 20 76 61 6c 75 65 20 69 6e 73 74 61 6e 63 65 6f 66 20 | View(value).||.value.instanceof. |
2bd40 | 41 72 72 61 79 42 75 66 66 65 72 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 62 75 66 66 65 72 54 6f 4d | ArrayBuffer.}..exports.bufferToM |
2bd60 | 65 74 61 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 76 61 6c 75 65 29 20 7b 0a 20 20 72 65 74 75 72 | eta.=.function.(value).{...retur |
2bd80 | 6e 20 7b 0a 20 20 20 20 74 79 70 65 3a 20 67 65 74 54 79 70 65 28 76 61 6c 75 65 29 2c 0a 20 20 | n.{.....type:.getType(value),... |
2bda0 | 20 20 64 61 74 61 3a 20 67 65 74 42 75 66 66 65 72 28 76 61 6c 75 65 29 2c 0a 20 20 20 20 6c 65 | ..data:.getBuffer(value),.....le |
2bdc0 | 6e 67 74 68 3a 20 76 61 6c 75 65 2e 6c 65 6e 67 74 68 0a 20 20 7d 0a 7d 0a 0a 65 78 70 6f 72 74 | ngth:.value.length...}.}..export |
2bde0 | 73 2e 6d 65 74 61 54 6f 42 75 66 66 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 76 61 6c 75 65 | s.metaToBuffer.=.function.(value |
2be00 | 29 20 7b 0a 20 20 63 6f 6e 73 74 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 3d 20 74 79 70 65 64 41 | ).{...const.constructor.=.typedA |
2be20 | 72 72 61 79 73 5b 76 61 6c 75 65 2e 74 79 70 65 5d 0a 20 20 63 6f 6e 73 74 20 64 61 74 61 20 3d | rrays[value.type]...const.data.= |
2be40 | 20 67 65 74 42 75 66 66 65 72 28 76 61 6c 75 65 2e 64 61 74 61 29 0a 0a 20 20 69 66 20 28 63 6f | .getBuffer(value.data)....if.(co |
2be60 | 6e 73 74 72 75 63 74 6f 72 20 3d 3d 3d 20 42 75 66 66 65 72 29 20 7b 0a 20 20 20 20 72 65 74 75 | nstructor.===.Buffer).{.....retu |
2be80 | 72 6e 20 64 61 74 61 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 63 6f 6e 73 74 72 75 63 74 6f 72 | rn.data...}.else.if.(constructor |
2bea0 | 20 3d 3d 3d 20 41 72 72 61 79 42 75 66 66 65 72 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 64 | .===.ArrayBuffer).{.....return.d |
2bec0 | 61 74 61 2e 62 75 66 66 65 72 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 63 6f 6e 73 74 72 75 63 | ata.buffer...}.else.if.(construc |
2bee0 | 74 6f 72 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 6e 65 77 20 63 6f 6e 73 74 72 75 63 74 6f | tor).{.....return.new.constructo |
2bf00 | 72 28 64 61 74 61 2e 62 75 66 66 65 72 2c 20 64 61 74 61 2e 62 79 74 65 4f 66 66 73 65 74 2c 20 | r(data.buffer,.data.byteOffset,. |
2bf20 | 76 61 6c 75 65 2e 6c 65 6e 67 74 68 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 72 65 74 | value.length)...}.else.{.....ret |
2bf40 | 75 72 6e 20 64 61 74 61 0a 20 20 7d 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e | urn.data...}.}.'use.strict'..con |
2bf60 | 73 74 20 62 69 6e 64 69 6e 67 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 | st.binding.=.process.atomBinding |
2bf80 | 28 27 63 72 61 73 68 5f 72 65 70 6f 72 74 65 72 27 29 0a 0a 63 6c 61 73 73 20 43 72 61 73 68 52 | ('crash_reporter')..class.CrashR |
2bfa0 | 65 70 6f 72 74 65 72 20 7b 0a 20 20 63 6f 6e 74 72 75 63 74 6f 72 20 28 29 20 7b 0a 20 20 20 20 | eporter.{...contructor.().{..... |
2bfc0 | 74 68 69 73 2e 70 72 6f 64 75 63 74 4e 61 6d 65 20 3d 20 6e 75 6c 6c 0a 20 20 20 20 74 68 69 73 | this.productName.=.null.....this |
2bfe0 | 2e 63 72 61 73 68 65 73 44 69 72 65 63 74 6f 72 79 20 3d 20 6e 75 6c 6c 0a 20 20 7d 0a 0a 20 20 | .crashesDirectory.=.null...}.... |
2c000 | 69 6e 69 74 20 28 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 | init.(options).{.....throw.new.E |
2c020 | 72 72 6f 72 28 27 4e 6f 74 20 69 6d 70 6c 65 6d 65 6e 74 65 64 27 29 0a 20 20 7d 0a 0a 20 20 73 | rror('Not.implemented')...}....s |
2c040 | 74 61 72 74 20 28 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 69 66 20 28 6f 70 74 69 6f 6e 73 | tart.(options).{.....if.(options |
2c060 | 20 3d 3d 20 6e 75 6c 6c 29 20 6f 70 74 69 6f 6e 73 20 3d 20 7b 7d 0a 0a 20 20 20 20 6c 65 74 20 | .==.null).options.=.{}......let. |
2c080 | 7b 0a 20 20 20 20 20 20 70 72 6f 64 75 63 74 4e 61 6d 65 2c 0a 20 20 20 20 20 20 63 6f 6d 70 61 | {.......productName,.......compa |
2c0a0 | 6e 79 4e 61 6d 65 2c 0a 20 20 20 20 20 20 65 78 74 72 61 2c 0a 20 20 20 20 20 20 69 67 6e 6f 72 | nyName,.......extra,.......ignor |
2c0c0 | 65 53 79 73 74 65 6d 43 72 61 73 68 48 61 6e 64 6c 65 72 2c 0a 20 20 20 20 20 20 73 75 62 6d 69 | eSystemCrashHandler,.......submi |
2c0e0 | 74 55 52 4c 2c 0a 20 20 20 20 20 20 75 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 0a 20 20 20 20 7d | tURL,.......uploadToServer.....} |
2c100 | 20 3d 20 6f 70 74 69 6f 6e 73 0a 0a 20 20 20 20 69 66 20 28 75 70 6c 6f 61 64 54 6f 53 65 72 76 | .=.options......if.(uploadToServ |
2c120 | 65 72 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 75 70 6c 6f 61 64 54 6f 53 65 72 76 | er.==.null).{.......uploadToServ |
2c140 | 65 72 20 3d 20 74 72 75 65 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 69 67 6e 6f 72 65 53 | er.=.true.....}......if.(ignoreS |
2c160 | 79 73 74 65 6d 43 72 61 73 68 48 61 6e 64 6c 65 72 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 | ystemCrashHandler.==.null).{.... |
2c180 | 20 20 20 69 67 6e 6f 72 65 53 79 73 74 65 6d 43 72 61 73 68 48 61 6e 64 6c 65 72 20 3d 20 66 61 | ...ignoreSystemCrashHandler.=.fa |
2c1a0 | 6c 73 65 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 63 6f 6d 70 61 6e 79 4e 61 6d 65 20 3d | lse.....}......if.(companyName.= |
2c1c0 | 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 | =.null).{.......throw.new.Error( |
2c1e0 | 27 63 6f 6d 70 61 6e 79 4e 61 6d 65 20 69 73 20 61 20 72 65 71 75 69 72 65 64 20 6f 70 74 69 6f | 'companyName.is.a.required.optio |
2c200 | 6e 20 74 6f 20 63 72 61 73 68 52 65 70 6f 72 74 65 72 2e 73 74 61 72 74 27 29 0a 20 20 20 20 7d | n.to.crashReporter.start').....} |
2c220 | 0a 20 20 20 20 69 66 20 28 73 75 62 6d 69 74 55 52 4c 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 | .....if.(submitURL.==.null).{... |
2c240 | 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 73 75 62 6d 69 74 55 52 4c 20 69 | ....throw.new.Error('submitURL.i |
2c260 | 73 20 61 20 72 65 71 75 69 72 65 64 20 6f 70 74 69 6f 6e 20 74 6f 20 63 72 61 73 68 52 65 70 6f | s.a.required.option.to.crashRepo |
2c280 | 72 74 65 72 2e 73 74 61 72 74 27 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 72 65 | rter.start').....}......const.re |
2c2a0 | 74 20 3d 20 74 68 69 73 2e 69 6e 69 74 28 7b 0a 20 20 20 20 20 20 73 75 62 6d 69 74 55 52 4c 2c | t.=.this.init({.......submitURL, |
2c2c0 | 0a 20 20 20 20 20 20 70 72 6f 64 75 63 74 4e 61 6d 65 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 74 | .......productName.....})......t |
2c2e0 | 68 69 73 2e 70 72 6f 64 75 63 74 4e 61 6d 65 20 3d 20 72 65 74 2e 70 72 6f 64 75 63 74 4e 61 6d | his.productName.=.ret.productNam |
2c300 | 65 0a 20 20 20 20 74 68 69 73 2e 63 72 61 73 68 65 73 44 69 72 65 63 74 6f 72 79 20 3d 20 72 65 | e.....this.crashesDirectory.=.re |
2c320 | 74 2e 63 72 61 73 68 65 73 44 69 72 65 63 74 6f 72 79 0a 20 20 20 20 74 68 69 73 2e 63 72 61 73 | t.crashesDirectory.....this.cras |
2c340 | 68 53 65 72 76 69 63 65 50 69 64 20 3d 20 72 65 74 2e 63 72 61 73 68 53 65 72 76 69 63 65 50 69 | hServicePid.=.ret.crashServicePi |
2c360 | 64 0a 0a 20 20 20 20 69 66 20 28 65 78 74 72 61 20 3d 3d 20 6e 75 6c 6c 29 20 65 78 74 72 61 20 | d......if.(extra.==.null).extra. |
2c380 | 3d 20 7b 7d 0a 20 20 20 20 69 66 20 28 65 78 74 72 61 2e 5f 70 72 6f 64 75 63 74 4e 61 6d 65 20 | =.{}.....if.(extra._productName. |
2c3a0 | 3d 3d 20 6e 75 6c 6c 29 20 65 78 74 72 61 2e 5f 70 72 6f 64 75 63 74 4e 61 6d 65 20 3d 20 72 65 | ==.null).extra._productName.=.re |
2c3c0 | 74 2e 70 72 6f 64 75 63 74 4e 61 6d 65 0a 20 20 20 20 69 66 20 28 65 78 74 72 61 2e 5f 63 6f 6d | t.productName.....if.(extra._com |
2c3e0 | 70 61 6e 79 4e 61 6d 65 20 3d 3d 20 6e 75 6c 6c 29 20 65 78 74 72 61 2e 5f 63 6f 6d 70 61 6e 79 | panyName.==.null).extra._company |
2c400 | 4e 61 6d 65 20 3d 20 63 6f 6d 70 61 6e 79 4e 61 6d 65 0a 20 20 20 20 69 66 20 28 65 78 74 72 61 | Name.=.companyName.....if.(extra |
2c420 | 2e 5f 76 65 72 73 69 6f 6e 20 3d 3d 20 6e 75 6c 6c 29 20 65 78 74 72 61 2e 5f 76 65 72 73 69 6f | ._version.==.null).extra._versio |
2c440 | 6e 20 3d 20 72 65 74 2e 61 70 70 56 65 72 73 69 6f 6e 0a 0a 20 20 20 20 62 69 6e 64 69 6e 67 2e | n.=.ret.appVersion......binding. |
2c460 | 73 74 61 72 74 28 72 65 74 2e 70 72 6f 64 75 63 74 4e 61 6d 65 2c 20 63 6f 6d 70 61 6e 79 4e 61 | start(ret.productName,.companyNa |
2c480 | 6d 65 2c 20 73 75 62 6d 69 74 55 52 4c 2c 20 72 65 74 2e 63 72 61 73 68 65 73 44 69 72 65 63 74 | me,.submitURL,.ret.crashesDirect |
2c4a0 | 6f 72 79 2c 20 75 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 2c 20 69 67 6e 6f 72 65 53 79 73 74 65 | ory,.uploadToServer,.ignoreSyste |
2c4c0 | 6d 43 72 61 73 68 48 61 6e 64 6c 65 72 2c 20 65 78 74 72 61 29 0a 20 20 7d 0a 0a 20 20 67 65 74 | mCrashHandler,.extra)...}....get |
2c4e0 | 4c 61 73 74 43 72 61 73 68 52 65 70 6f 72 74 20 28 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 72 | LastCrashReport.().{.....const.r |
2c500 | 65 70 6f 72 74 73 20 3d 20 74 68 69 73 2e 67 65 74 55 70 6c 6f 61 64 65 64 52 65 70 6f 72 74 73 | eports.=.this.getUploadedReports |
2c520 | 28 29 0a 20 20 20 20 20 20 2e 73 6f 72 74 28 28 61 2c 20 62 29 20 3d 3e 20 7b 0a 20 20 20 20 20 | ()........sort((a,.b).=>.{...... |
2c540 | 20 20 20 63 6f 6e 73 74 20 61 74 73 20 3d 20 28 61 20 26 26 20 61 2e 64 61 74 65 29 20 3f 20 6e | ...const.ats.=.(a.&&.a.date).?.n |
2c560 | 65 77 20 44 61 74 65 28 61 2e 64 61 74 65 29 2e 67 65 74 54 69 6d 65 28 29 20 3a 20 30 0a 20 20 | ew.Date(a.date).getTime().:.0... |
2c580 | 20 20 20 20 20 20 63 6f 6e 73 74 20 62 74 73 20 3d 20 28 62 20 26 26 20 62 2e 64 61 74 65 29 20 | ......const.bts.=.(b.&&.b.date). |
2c5a0 | 3f 20 6e 65 77 20 44 61 74 65 28 62 2e 64 61 74 65 29 2e 67 65 74 54 69 6d 65 28 29 20 3a 20 30 | ?.new.Date(b.date).getTime().:.0 |
2c5c0 | 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 62 74 73 20 2d 20 61 74 73 0a 20 20 20 20 20 20 | .........return.bts.-.ats....... |
2c5e0 | 7d 29 0a 0a 20 20 20 20 72 65 74 75 72 6e 20 28 72 65 70 6f 72 74 73 2e 6c 65 6e 67 74 68 20 3e | })......return.(reports.length.> |
2c600 | 20 30 29 20 3f 20 72 65 70 6f 72 74 73 5b 30 5d 20 3a 20 6e 75 6c 6c 0a 20 20 7d 0a 0a 20 20 67 | .0).?.reports[0].:.null...}....g |
2c620 | 65 74 55 70 6c 6f 61 64 65 64 52 65 70 6f 72 74 73 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 | etUploadedReports.().{.....retur |
2c640 | 6e 20 62 69 6e 64 69 6e 67 2e 67 65 74 55 70 6c 6f 61 64 65 64 52 65 70 6f 72 74 73 28 74 68 69 | n.binding.getUploadedReports(thi |
2c660 | 73 2e 67 65 74 43 72 61 73 68 65 73 44 69 72 65 63 74 6f 72 79 28 29 29 0a 20 20 7d 0a 0a 20 20 | s.getCrashesDirectory())...}.... |
2c680 | 67 65 74 43 72 61 73 68 65 73 44 69 72 65 63 74 6f 72 79 20 28 29 20 7b 0a 20 20 20 20 72 65 74 | getCrashesDirectory.().{.....ret |
2c6a0 | 75 72 6e 20 74 68 69 73 2e 63 72 61 73 68 65 73 44 69 72 65 63 74 6f 72 79 0a 20 20 7d 0a 0a 20 | urn.this.crashesDirectory...}... |
2c6c0 | 20 67 65 74 50 72 6f 64 75 63 74 4e 61 6d 65 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 | .getProductName.().{.....return. |
2c6e0 | 74 68 69 73 2e 70 72 6f 64 75 63 74 4e 61 6d 65 0a 20 20 7d 0a 0a 20 20 67 65 74 55 70 6c 6f 61 | this.productName...}....getUploa |
2c700 | 64 54 6f 53 65 72 76 65 72 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 74 | dToServer.().{.....if.(process.t |
2c720 | 79 70 65 20 3d 3d 3d 20 27 62 72 6f 77 73 65 72 27 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 | ype.===.'browser').{.......retur |
2c740 | 6e 20 62 69 6e 64 69 6e 67 2e 67 65 74 55 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 28 29 0a 20 20 | n.binding.getUploadToServer()... |
2c760 | 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 | ..}.else.{.......throw.new.Error |
2c780 | 28 27 67 65 74 55 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 20 63 61 6e 20 6f 6e 6c 79 20 62 65 20 | ('getUploadToServer.can.only.be. |
2c7a0 | 63 61 6c 6c 65 64 20 66 72 6f 6d 20 74 68 65 20 6d 61 69 6e 20 70 72 6f 63 65 73 73 27 29 0a 20 | called.from.the.main.process').. |
2c7c0 | 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 73 65 74 55 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 20 28 75 | ...}...}....setUploadToServer.(u |
2c7e0 | 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 29 20 7b 0a 20 20 20 20 69 66 20 28 70 72 6f 63 65 73 73 | ploadToServer).{.....if.(process |
2c800 | 2e 74 79 70 65 20 3d 3d 3d 20 27 62 72 6f 77 73 65 72 27 29 20 7b 0a 20 20 20 20 20 20 72 65 74 | .type.===.'browser').{.......ret |
2c820 | 75 72 6e 20 62 69 6e 64 69 6e 67 2e 73 65 74 55 70 6c 6f 61 64 54 6f 53 65 72 76 65 72 28 75 70 | urn.binding.setUploadToServer(up |
2c840 | 6c 6f 61 64 54 6f 53 65 72 76 65 72 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 | loadToServer).....}.else.{...... |
2c860 | 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 73 65 74 55 70 6c 6f 61 64 54 6f 53 65 72 | .throw.new.Error('setUploadToSer |
2c880 | 76 65 72 20 63 61 6e 20 6f 6e 6c 79 20 62 65 20 63 61 6c 6c 65 64 20 66 72 6f 6d 20 74 68 65 20 | ver.can.only.be.called.from.the. |
2c8a0 | 6d 61 69 6e 20 70 72 6f 63 65 73 73 27 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 61 64 64 45 | main.process').....}...}....addE |
2c8c0 | 78 74 72 61 50 61 72 61 6d 65 74 65 72 20 28 6b 65 79 2c 20 76 61 6c 75 65 29 20 7b 0a 20 20 20 | xtraParameter.(key,.value).{.... |
2c8e0 | 20 62 69 6e 64 69 6e 67 2e 61 64 64 45 78 74 72 61 50 61 72 61 6d 65 74 65 72 28 6b 65 79 2c 20 | .binding.addExtraParameter(key,. |
2c900 | 76 61 6c 75 65 29 0a 20 20 7d 0a 0a 20 20 72 65 6d 6f 76 65 45 78 74 72 61 50 61 72 61 6d 65 74 | value)...}....removeExtraParamet |
2c920 | 65 72 20 28 6b 65 79 29 20 7b 0a 20 20 20 20 62 69 6e 64 69 6e 67 2e 72 65 6d 6f 76 65 45 78 74 | er.(key).{.....binding.removeExt |
2c940 | 72 61 50 61 72 61 6d 65 74 65 72 28 6b 65 79 29 0a 20 20 7d 0a 0a 20 20 67 65 74 50 61 72 61 6d | raParameter(key)...}....getParam |
2c960 | 65 74 65 72 73 20 28 6b 65 79 2c 20 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 | eters.(key,.value).{.....return. |
2c980 | 62 69 6e 64 69 6e 67 2e 67 65 74 50 61 72 61 6d 65 74 65 72 73 28 29 0a 20 20 7d 0a 7d 0a 0a 6d | binding.getParameters()...}.}..m |
2c9a0 | 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 43 72 61 73 68 52 65 70 6f 72 74 65 72 0a 27 75 | odule.exports.=.CrashReporter.'u |
2c9c0 | 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 20 3d | se.strict'..const.constructors.= |
2c9e0 | 20 6e 65 77 20 4d 61 70 28 5b 0a 20 20 5b 45 72 72 6f 72 2e 6e 61 6d 65 2c 20 45 72 72 6f 72 5d | .new.Map([...[Error.name,.Error] |
2ca00 | 2c 0a 20 20 5b 45 76 61 6c 45 72 72 6f 72 2e 6e 61 6d 65 2c 20 45 76 61 6c 45 72 72 6f 72 5d 2c | ,...[EvalError.name,.EvalError], |
2ca20 | 0a 20 20 5b 52 61 6e 67 65 45 72 72 6f 72 2e 6e 61 6d 65 2c 20 52 61 6e 67 65 45 72 72 6f 72 5d | ...[RangeError.name,.RangeError] |
2ca40 | 2c 0a 20 20 5b 52 65 66 65 72 65 6e 63 65 45 72 72 6f 72 2e 6e 61 6d 65 2c 20 52 65 66 65 72 65 | ,...[ReferenceError.name,.Refere |
2ca60 | 6e 63 65 45 72 72 6f 72 5d 2c 0a 20 20 5b 53 79 6e 74 61 78 45 72 72 6f 72 2e 6e 61 6d 65 2c 20 | nceError],...[SyntaxError.name,. |
2ca80 | 53 79 6e 74 61 78 45 72 72 6f 72 5d 2c 0a 20 20 5b 54 79 70 65 45 72 72 6f 72 2e 6e 61 6d 65 2c | SyntaxError],...[TypeError.name, |
2caa0 | 20 54 79 70 65 45 72 72 6f 72 5d 2c 0a 20 20 5b 55 52 49 45 72 72 6f 72 2e 6e 61 6d 65 2c 20 55 | .TypeError],...[URIError.name,.U |
2cac0 | 52 49 45 72 72 6f 72 5d 0a 5d 29 0a 0a 65 78 70 6f 72 74 73 2e 64 65 73 65 72 69 61 6c 69 7a 65 | RIError].])..exports.deserialize |
2cae0 | 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 69 66 20 28 65 72 72 6f | .=.function.(error).{...if.(erro |
2cb00 | 72 20 26 26 20 65 72 72 6f 72 2e 5f 5f 45 4c 45 43 54 52 4f 4e 5f 53 45 52 49 41 4c 49 5a 45 44 | r.&&.error.__ELECTRON_SERIALIZED |
2cb20 | 5f 45 52 52 4f 52 5f 5f 20 26 26 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 2e 68 61 73 28 65 72 72 | _ERROR__.&&.constructors.has(err |
2cb40 | 6f 72 2e 6e 61 6d 65 29 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 6f 6e 73 74 72 75 63 74 6f | or.name)).{.....const.constructo |
2cb60 | 72 20 3d 20 63 6f 6e 73 74 72 75 63 74 6f 72 73 2e 67 65 74 28 65 72 72 6f 72 2e 6e 61 6d 65 29 | r.=.constructors.get(error.name) |
2cb80 | 0a 20 20 20 20 63 6f 6e 73 74 20 64 65 73 65 72 69 61 6c 69 7a 65 64 45 72 72 6f 72 20 3d 20 6e | .....const.deserializedError.=.n |
2cba0 | 65 77 20 63 6f 6e 73 74 72 75 63 74 6f 72 28 65 72 72 6f 72 2e 6d 65 73 73 61 67 65 29 0a 20 20 | ew.constructor(error.message)... |
2cbc0 | 20 20 64 65 73 65 72 69 61 6c 69 7a 65 64 45 72 72 6f 72 2e 73 74 61 63 6b 20 3d 20 65 72 72 6f | ..deserializedError.stack.=.erro |
2cbe0 | 72 2e 73 74 61 63 6b 0a 20 20 20 20 64 65 73 65 72 69 61 6c 69 7a 65 64 45 72 72 6f 72 2e 66 72 | r.stack.....deserializedError.fr |
2cc00 | 6f 6d 20 3d 20 65 72 72 6f 72 2e 66 72 6f 6d 0a 20 20 20 20 64 65 73 65 72 69 61 6c 69 7a 65 64 | om.=.error.from.....deserialized |
2cc20 | 45 72 72 6f 72 2e 63 61 75 73 65 20 3d 20 65 78 70 6f 72 74 73 2e 64 65 73 65 72 69 61 6c 69 7a | Error.cause.=.exports.deserializ |
2cc40 | 65 28 65 72 72 6f 72 2e 63 61 75 73 65 29 0a 20 20 20 20 72 65 74 75 72 6e 20 64 65 73 65 72 69 | e(error.cause).....return.deseri |
2cc60 | 61 6c 69 7a 65 64 45 72 72 6f 72 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 65 72 72 6f 72 0a 7d | alizedError...}...return.error.} |
2cc80 | 0a 0a 65 78 70 6f 72 74 73 2e 73 65 72 69 61 6c 69 7a 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 | ..exports.serialize.=.function.( |
2cca0 | 65 72 72 6f 72 29 20 7b 0a 20 20 69 66 20 28 65 72 72 6f 72 20 69 6e 73 74 61 6e 63 65 6f 66 20 | error).{...if.(error.instanceof. |
2ccc0 | 45 72 72 6f 72 29 20 7b 0a 20 20 20 20 2f 2f 20 45 72 72 6f 72 73 20 67 65 74 20 6c 6f 73 74 2c | Error).{.....//.Errors.get.lost, |
2cce0 | 20 62 65 63 61 75 73 65 3a 20 4a 53 4f 4e 2e 73 74 72 69 6e 67 69 66 79 28 6e 65 77 20 45 72 72 | .because:.JSON.stringify(new.Err |
2cd00 | 6f 72 28 27 4d 65 73 73 61 67 65 27 29 29 20 3d 3d 3d 20 7b 7d 0a 20 20 20 20 2f 2f 20 54 61 6b | or('Message')).===.{}.....//.Tak |
2cd20 | 65 20 74 68 65 20 73 65 72 69 61 6c 69 7a 61 62 6c 65 20 70 72 6f 70 65 72 74 69 65 73 20 61 6e | e.the.serializable.properties.an |
2cd40 | 64 20 63 6f 6e 73 74 72 75 63 74 20 61 20 67 65 6e 65 72 69 63 20 6f 62 6a 65 63 74 0a 20 20 20 | d.construct.a.generic.object.... |
2cd60 | 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 6d 65 73 73 61 67 65 3a 20 65 72 72 6f 72 2e 6d | .return.{.......message:.error.m |
2cd80 | 65 73 73 61 67 65 2c 0a 20 20 20 20 20 20 73 74 61 63 6b 3a 20 65 72 72 6f 72 2e 73 74 61 63 6b | essage,.......stack:.error.stack |
2cda0 | 2c 0a 20 20 20 20 20 20 6e 61 6d 65 3a 20 65 72 72 6f 72 2e 6e 61 6d 65 2c 0a 20 20 20 20 20 20 | ,.......name:.error.name,....... |
2cdc0 | 66 72 6f 6d 3a 20 70 72 6f 63 65 73 73 2e 74 79 70 65 2c 0a 20 20 20 20 20 20 63 61 75 73 65 3a | from:.process.type,.......cause: |
2cde0 | 20 65 78 70 6f 72 74 73 2e 73 65 72 69 61 6c 69 7a 65 28 65 72 72 6f 72 2e 63 61 75 73 65 29 2c | .exports.serialize(error.cause), |
2ce00 | 0a 20 20 20 20 20 20 5f 5f 45 4c 45 43 54 52 4f 4e 5f 53 45 52 49 41 4c 49 5a 45 44 5f 45 52 52 | .......__ELECTRON_SERIALIZED_ERR |
2ce20 | 4f 52 5f 5f 3a 20 74 72 75 65 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 65 72 | OR__:.true.....}...}...return.er |
2ce40 | 72 6f 72 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 74 69 6d 65 72 73 | ror.}.'use.strict'..const.timers |
2ce60 | 20 3d 20 72 65 71 75 69 72 65 28 27 74 69 6d 65 72 73 27 29 0a 63 6f 6e 73 74 20 75 74 69 6c 20 | .=.require('timers').const.util. |
2ce80 | 3d 20 72 65 71 75 69 72 65 28 27 75 74 69 6c 27 29 0a 0a 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 | =.require('util')..process.atomB |
2cea0 | 69 6e 64 69 6e 67 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 | inding.=.require('@electron/inte |
2cec0 | 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 61 74 6f 6d 2d 62 69 6e 64 69 6e 67 2d 73 65 74 75 70 27 29 | rnal/common/atom-binding-setup') |
2cee0 | 28 70 72 6f 63 65 73 73 2e 62 69 6e 64 69 6e 67 2c 20 70 72 6f 63 65 73 73 2e 74 79 70 65 29 0a | (process.binding,.process.type). |
2cf00 | 0a 2f 2f 20 73 65 74 49 6d 6d 65 64 69 61 74 65 20 61 6e 64 20 70 72 6f 63 65 73 73 2e 6e 65 78 | .//.setImmediate.and.process.nex |
2cf20 | 74 54 69 63 6b 20 6d 61 6b 65 73 20 75 73 65 20 6f 66 20 75 76 5f 63 68 65 63 6b 20 61 6e 64 20 | tTick.makes.use.of.uv_check.and. |
2cf40 | 75 76 5f 70 72 65 70 61 72 65 20 74 6f 0a 2f 2f 20 72 75 6e 20 74 68 65 20 63 61 6c 6c 62 61 63 | uv_prepare.to.//.run.the.callbac |
2cf60 | 6b 73 2c 20 68 6f 77 65 76 65 72 20 73 69 6e 63 65 20 77 65 20 6f 6e 6c 79 20 72 75 6e 20 75 76 | ks,.however.since.we.only.run.uv |
2cf80 | 20 6c 6f 6f 70 20 6f 6e 20 72 65 71 75 65 73 74 73 2c 20 74 68 65 0a 2f 2f 20 63 61 6c 6c 62 61 | .loop.on.requests,.the.//.callba |
2cfa0 | 63 6b 73 20 77 6f 75 6c 64 6e 27 74 20 62 65 20 63 61 6c 6c 65 64 20 75 6e 74 69 6c 20 73 6f 6d | cks.wouldn't.be.called.until.som |
2cfc0 | 65 74 68 69 6e 67 20 65 6c 73 65 20 61 63 74 69 76 61 74 65 64 20 74 68 65 20 75 76 20 6c 6f 6f | ething.else.activated.the.uv.loo |
2cfe0 | 70 2c 0a 2f 2f 20 77 68 69 63 68 20 77 6f 75 6c 64 20 64 65 6c 61 79 20 74 68 65 20 63 61 6c 6c | p,.//.which.would.delay.the.call |
2d000 | 62 61 63 6b 73 20 66 6f 72 20 61 72 62 69 74 72 61 72 79 20 6c 6f 6e 67 20 74 69 6d 65 2e 20 53 | backs.for.arbitrary.long.time..S |
2d020 | 6f 20 77 65 20 73 68 6f 75 6c 64 0a 2f 2f 20 69 6e 69 74 69 61 74 69 76 65 6c 79 20 61 63 74 69 | o.we.should.//.initiatively.acti |
2d040 | 76 61 74 65 20 74 68 65 20 75 76 20 6c 6f 6f 70 20 6f 6e 63 65 20 73 65 74 49 6d 6d 65 64 69 61 | vate.the.uv.loop.once.setImmedia |
2d060 | 74 65 20 61 6e 64 20 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 20 69 73 0a 2f 2f 20 63 61 | te.and.process.nextTick.is.//.ca |
2d080 | 6c 6c 65 64 2e 0a 63 6f 6e 73 74 20 77 72 61 70 57 69 74 68 41 63 74 69 76 61 74 65 55 76 4c 6f | lled..const.wrapWithActivateUvLo |
2d0a0 | 6f 70 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 66 75 6e 63 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 | op.=.function.(func).{...return. |
2d0c0 | 77 72 61 70 28 66 75 6e 63 2c 20 66 75 6e 63 74 69 6f 6e 20 28 66 75 6e 63 29 20 7b 0a 20 20 20 | wrap(func,.function.(func).{.... |
2d0e0 | 20 72 65 74 75 72 6e 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 70 72 6f 63 | .return.function.().{.......proc |
2d100 | 65 73 73 2e 61 63 74 69 76 61 74 65 55 76 4c 6f 6f 70 28 29 0a 20 20 20 20 20 20 72 65 74 75 72 | ess.activateUvLoop().......retur |
2d120 | 6e 20 66 75 6e 63 2e 61 70 70 6c 79 28 74 68 69 73 2c 20 61 72 67 75 6d 65 6e 74 73 29 0a 20 20 | n.func.apply(this,.arguments)... |
2d140 | 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 77 72 61 70 20 28 66 75 6e 63 2c | ..}...}).}..function.wrap.(func, |
2d160 | 20 77 72 61 70 70 65 72 29 20 7b 0a 20 20 63 6f 6e 73 74 20 77 72 61 70 70 65 64 20 3d 20 77 72 | .wrapper).{...const.wrapped.=.wr |
2d180 | 61 70 70 65 72 28 66 75 6e 63 29 0a 20 20 69 66 20 28 66 75 6e 63 5b 75 74 69 6c 2e 70 72 6f 6d | apper(func)...if.(func[util.prom |
2d1a0 | 69 73 69 66 79 2e 63 75 73 74 6f 6d 5d 29 20 7b 0a 20 20 20 20 77 72 61 70 70 65 64 5b 75 74 69 | isify.custom]).{.....wrapped[uti |
2d1c0 | 6c 2e 70 72 6f 6d 69 73 69 66 79 2e 63 75 73 74 6f 6d 5d 20 3d 20 77 72 61 70 70 65 72 28 66 75 | l.promisify.custom].=.wrapper(fu |
2d1e0 | 6e 63 5b 75 74 69 6c 2e 70 72 6f 6d 69 73 69 66 79 2e 63 75 73 74 6f 6d 5d 29 0a 20 20 7d 0a 20 | nc[util.promisify.custom])...}.. |
2d200 | 20 72 65 74 75 72 6e 20 77 72 61 70 70 65 64 0a 7d 0a 0a 70 72 6f 63 65 73 73 2e 6e 65 78 74 54 | .return.wrapped.}..process.nextT |
2d220 | 69 63 6b 20 3d 20 77 72 61 70 57 69 74 68 41 63 74 69 76 61 74 65 55 76 4c 6f 6f 70 28 70 72 6f | ick.=.wrapWithActivateUvLoop(pro |
2d240 | 63 65 73 73 2e 6e 65 78 74 54 69 63 6b 29 0a 0a 67 6c 6f 62 61 6c 2e 73 65 74 49 6d 6d 65 64 69 | cess.nextTick)..global.setImmedi |
2d260 | 61 74 65 20 3d 20 74 69 6d 65 72 73 2e 73 65 74 49 6d 6d 65 64 69 61 74 65 20 3d 20 77 72 61 70 | ate.=.timers.setImmediate.=.wrap |
2d280 | 57 69 74 68 41 63 74 69 76 61 74 65 55 76 4c 6f 6f 70 28 74 69 6d 65 72 73 2e 73 65 74 49 6d 6d | WithActivateUvLoop(timers.setImm |
2d2a0 | 65 64 69 61 74 65 29 0a 67 6c 6f 62 61 6c 2e 63 6c 65 61 72 49 6d 6d 65 64 69 61 74 65 20 3d 20 | ediate).global.clearImmediate.=. |
2d2c0 | 74 69 6d 65 72 73 2e 63 6c 65 61 72 49 6d 6d 65 64 69 61 74 65 0a 0a 2f 2f 20 73 65 74 54 69 6d | timers.clearImmediate..//.setTim |
2d2e0 | 65 6f 75 74 20 6e 65 65 64 73 20 74 6f 20 75 70 64 61 74 65 20 74 68 65 20 70 6f 6c 6c 69 6e 67 | eout.needs.to.update.the.polling |
2d300 | 20 74 69 6d 65 6f 75 74 20 6f 66 20 74 68 65 20 65 76 65 6e 74 20 6c 6f 6f 70 2c 20 77 68 65 6e | .timeout.of.the.event.loop,.when |
2d320 | 0a 2f 2f 20 63 61 6c 6c 65 64 20 75 6e 64 65 72 20 43 68 72 6f 6d 69 75 6d 27 73 20 65 76 65 6e | .//.called.under.Chromium's.even |
2d340 | 74 20 6c 6f 6f 70 20 74 68 65 20 6e 6f 64 65 27 73 20 65 76 65 6e 74 20 6c 6f 6f 70 20 77 6f 6e | t.loop.the.node's.event.loop.won |
2d360 | 27 74 20 67 65 74 20 61 20 63 68 61 6e 63 65 0a 2f 2f 20 74 6f 20 75 70 64 61 74 65 20 74 68 65 | 't.get.a.chance.//.to.update.the |
2d380 | 20 74 69 6d 65 6f 75 74 2c 20 73 6f 20 77 65 20 68 61 76 65 20 74 6f 20 66 6f 72 63 65 20 74 68 | .timeout,.so.we.have.to.force.th |
2d3a0 | 65 20 6e 6f 64 65 27 73 20 65 76 65 6e 74 20 6c 6f 6f 70 20 74 6f 0a 2f 2f 20 72 65 63 61 6c 63 | e.node's.event.loop.to.//.recalc |
2d3c0 | 75 6c 61 74 65 20 74 68 65 20 74 69 6d 65 6f 75 74 20 69 6e 20 62 72 6f 77 73 65 72 20 70 72 6f | ulate.the.timeout.in.browser.pro |
2d3e0 | 63 65 73 73 2e 0a 74 69 6d 65 72 73 2e 73 65 74 54 69 6d 65 6f 75 74 20 3d 20 77 72 61 70 57 69 | cess..timers.setTimeout.=.wrapWi |
2d400 | 74 68 41 63 74 69 76 61 74 65 55 76 4c 6f 6f 70 28 74 69 6d 65 72 73 2e 73 65 74 54 69 6d 65 6f | thActivateUvLoop(timers.setTimeo |
2d420 | 75 74 29 0a 74 69 6d 65 72 73 2e 73 65 74 49 6e 74 65 72 76 61 6c 20 3d 20 77 72 61 70 57 69 74 | ut).timers.setInterval.=.wrapWit |
2d440 | 68 41 63 74 69 76 61 74 65 55 76 4c 6f 6f 70 28 74 69 6d 65 72 73 2e 73 65 74 49 6e 74 65 72 76 | hActivateUvLoop(timers.setInterv |
2d460 | 61 6c 29 0a 0a 2f 2f 20 4f 6e 6c 79 20 6f 76 65 72 72 69 64 65 20 74 68 65 20 67 6c 6f 62 61 6c | al)..//.Only.override.the.global |
2d480 | 20 73 65 74 54 69 6d 65 6f 75 74 2f 73 65 74 49 6e 74 65 72 76 61 6c 20 69 6d 70 6c 73 20 69 6e | .setTimeout/setInterval.impls.in |
2d4a0 | 20 74 68 65 20 62 72 6f 77 73 65 72 20 70 72 6f 63 65 73 73 0a 69 66 20 28 70 72 6f 63 65 73 73 | .the.browser.process.if.(process |
2d4c0 | 2e 74 79 70 65 20 3d 3d 3d 20 27 62 72 6f 77 73 65 72 27 29 20 7b 0a 20 20 67 6c 6f 62 61 6c 2e | .type.===.'browser').{...global. |
2d4e0 | 73 65 74 54 69 6d 65 6f 75 74 20 3d 20 74 69 6d 65 72 73 2e 73 65 74 54 69 6d 65 6f 75 74 0a 20 | setTimeout.=.timers.setTimeout.. |
2d500 | 20 67 6c 6f 62 61 6c 2e 73 65 74 49 6e 74 65 72 76 61 6c 20 3d 20 74 69 6d 65 72 73 2e 73 65 74 | .global.setInterval.=.timers.set |
2d520 | 49 6e 74 65 72 76 61 6c 0a 7d 0a 0a 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 66 6f 72 6d | Interval.}..if.(process.platform |
2d540 | 20 3d 3d 3d 20 27 77 69 6e 33 32 27 29 20 7b 0a 20 20 2f 2f 20 41 6c 77 61 79 73 20 72 65 74 75 | .===.'win32').{...//.Always.retu |
2d560 | 72 6e 73 20 45 4f 46 20 66 6f 72 20 73 74 64 69 6e 20 73 74 72 65 61 6d 2e 0a 20 20 63 6f 6e 73 | rns.EOF.for.stdin.stream....cons |
2d580 | 74 20 7b 20 52 65 61 64 61 62 6c 65 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 73 74 72 65 61 6d | t.{.Readable.}.=.require('stream |
2d5a0 | 27 29 0a 20 20 63 6f 6e 73 74 20 73 74 64 69 6e 20 3d 20 6e 65 77 20 52 65 61 64 61 62 6c 65 28 | ')...const.stdin.=.new.Readable( |
2d5c0 | 29 0a 20 20 73 74 64 69 6e 2e 70 75 73 68 28 6e 75 6c 6c 29 0a 20 20 70 72 6f 63 65 73 73 2e 5f | )...stdin.push(null)...process._ |
2d5e0 | 5f 64 65 66 69 6e 65 47 65 74 74 65 72 5f 5f 28 27 73 74 64 69 6e 27 2c 20 66 75 6e 63 74 69 6f | _defineGetter__('stdin',.functio |
2d600 | 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 73 74 64 69 6e 0a 20 20 7d 29 0a 7d 0a 27 | n.().{.....return.stdin...}).}.' |
2d620 | 75 73 65 20 73 74 72 69 63 74 27 0a 0a 2f 2f 20 70 61 72 73 65 73 20 61 20 66 65 61 74 75 72 65 | use.strict'..//.parses.a.feature |
2d640 | 20 73 74 72 69 6e 67 20 74 68 61 74 20 68 61 73 20 74 68 65 20 66 6f 72 6d 61 74 20 75 73 65 64 | .string.that.has.the.format.used |
2d660 | 20 69 6e 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 28 29 0a 2f 2f 20 2d 20 60 66 65 61 74 75 72 65 73 | .in.window.open().//.-.`features |
2d680 | 60 20 69 6e 70 75 74 20 73 74 72 69 6e 67 0a 2f 2f 20 2d 20 60 65 6d 69 74 60 20 66 75 6e 63 74 | `.input.string.//.-.`emit`.funct |
2d6a0 | 69 6f 6e 28 6b 65 79 2c 20 76 61 6c 75 65 29 20 2d 20 63 61 6c 6c 65 64 20 66 6f 72 20 65 61 63 | ion(key,.value).-.called.for.eac |
2d6c0 | 68 20 70 61 72 73 65 64 20 4b 56 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 66 75 6e | h.parsed.KV.module.exports.=.fun |
2d6e0 | 63 74 69 6f 6e 20 70 61 72 73 65 46 65 61 74 75 72 65 73 53 74 72 69 6e 67 20 28 66 65 61 74 75 | ction.parseFeaturesString.(featu |
2d700 | 72 65 73 2c 20 65 6d 69 74 29 20 7b 0a 20 20 66 65 61 74 75 72 65 73 20 3d 20 60 24 7b 66 65 61 | res,.emit).{...features.=.`${fea |
2d720 | 74 75 72 65 73 7d 60 0a 20 20 2f 2f 20 73 70 6c 69 74 20 74 68 65 20 73 74 72 69 6e 67 20 62 79 | tures}`...//.split.the.string.by |
2d740 | 20 27 2c 27 0a 20 20 66 65 61 74 75 72 65 73 2e 73 70 6c 69 74 28 2f 2c 5c 73 2a 2f 29 2e 66 6f | .','...features.split(/,\s*/).fo |
2d760 | 72 45 61 63 68 28 28 66 65 61 74 75 72 65 29 20 3d 3e 20 7b 0a 20 20 20 20 2f 2f 20 65 78 70 65 | rEach((feature).=>.{.....//.expe |
2d780 | 63 74 65 64 20 66 6f 72 6d 20 69 73 20 65 69 74 68 65 72 20 61 20 6b 65 79 20 62 79 20 69 74 73 | cted.form.is.either.a.key.by.its |
2d7a0 | 65 6c 66 20 6f 72 20 61 20 6b 65 79 2f 76 61 6c 75 65 20 70 61 69 72 20 69 6e 20 74 68 65 20 66 | elf.or.a.key/value.pair.in.the.f |
2d7c0 | 6f 72 6d 20 6f 66 0a 20 20 20 20 2f 2f 20 27 6b 65 79 3d 76 61 6c 75 65 27 0a 20 20 20 20 6c 65 | orm.of.....//.'key=value'.....le |
2d7e0 | 74 20 5b 6b 65 79 2c 20 76 61 6c 75 65 5d 20 3d 20 66 65 61 74 75 72 65 2e 73 70 6c 69 74 28 2f | t.[key,.value].=.feature.split(/ |
2d800 | 5c 73 2a 3d 2f 29 0a 20 20 20 20 69 66 20 28 21 6b 65 79 29 20 72 65 74 75 72 6e 0a 0a 20 20 20 | \s*=/).....if.(!key).return..... |
2d820 | 20 2f 2f 20 69 6e 74 65 72 70 72 65 74 20 74 68 65 20 76 61 6c 75 65 20 61 73 20 61 20 62 6f 6f | .//.interpret.the.value.as.a.boo |
2d840 | 6c 65 61 6e 2c 20 69 66 20 70 6f 73 73 69 62 6c 65 0a 20 20 20 20 76 61 6c 75 65 20 3d 20 28 76 | lean,.if.possible.....value.=.(v |
2d860 | 61 6c 75 65 20 3d 3d 3d 20 27 79 65 73 27 20 7c 7c 20 76 61 6c 75 65 20 3d 3d 3d 20 27 31 27 29 | alue.===.'yes'.||.value.===.'1') |
2d880 | 20 3f 20 74 72 75 65 20 3a 20 28 76 61 6c 75 65 20 3d 3d 3d 20 27 6e 6f 27 20 7c 7c 20 76 61 6c | .?.true.:.(value.===.'no'.||.val |
2d8a0 | 75 65 20 3d 3d 3d 20 27 30 27 29 20 3f 20 66 61 6c 73 65 20 3a 20 76 61 6c 75 65 0a 0a 20 20 20 | ue.===.'0').?.false.:.value..... |
2d8c0 | 20 2f 2f 20 65 6d 69 74 20 74 68 65 20 70 61 72 73 65 64 20 70 61 69 72 0a 20 20 20 20 65 6d 69 | .//.emit.the.parsed.pair.....emi |
2d8e0 | 74 28 6b 65 79 2c 20 76 61 6c 75 65 29 0a 20 20 7d 29 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 | t(key,.value)...}).}.'use.strict |
2d900 | 27 0a 0a 63 6f 6e 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 74 68 27 29 0a | '..const.path.=.require('path'). |
2d920 | 63 6f 6e 73 74 20 4d 6f 64 75 6c 65 20 3d 20 72 65 71 75 69 72 65 28 27 6d 6f 64 75 6c 65 27 29 | const.Module.=.require('module') |
2d940 | 0a 0a 2f 2f 20 43 6c 65 61 72 20 4e 6f 64 65 27 73 20 67 6c 6f 62 61 6c 20 73 65 61 72 63 68 20 | ..//.Clear.Node's.global.search. |
2d960 | 70 61 74 68 73 2e 0a 4d 6f 64 75 6c 65 2e 67 6c 6f 62 61 6c 50 61 74 68 73 2e 6c 65 6e 67 74 68 | paths..Module.globalPaths.length |
2d980 | 20 3d 20 30 0a 0a 2f 2f 20 43 6c 65 61 72 20 63 75 72 72 65 6e 74 20 61 6e 64 20 70 61 72 65 6e | .=.0..//.Clear.current.and.paren |
2d9a0 | 74 28 69 6e 69 74 2e 6a 73 29 27 73 20 73 65 61 72 63 68 20 70 61 74 68 73 2e 0a 6d 6f 64 75 6c | t(init.js)'s.search.paths..modul |
2d9c0 | 65 2e 70 61 74 68 73 20 3d 20 5b 5d 0a 6d 6f 64 75 6c 65 2e 70 61 72 65 6e 74 2e 70 61 74 68 73 | e.paths.=.[].module.parent.paths |
2d9e0 | 20 3d 20 5b 5d 0a 0a 2f 2f 20 50 72 65 76 65 6e 74 20 4e 6f 64 65 20 66 72 6f 6d 20 61 64 64 69 | .=.[]..//.Prevent.Node.from.addi |
2da00 | 6e 67 20 70 61 74 68 73 20 6f 75 74 73 69 64 65 20 74 68 69 73 20 61 70 70 20 74 6f 20 73 65 61 | ng.paths.outside.this.app.to.sea |
2da20 | 72 63 68 20 70 61 74 68 73 2e 0a 63 6f 6e 73 74 20 72 65 73 6f 75 72 63 65 73 50 61 74 68 57 69 | rch.paths..const.resourcesPathWi |
2da40 | 74 68 54 72 61 69 6c 69 6e 67 53 6c 61 73 68 20 3d 20 70 72 6f 63 65 73 73 2e 72 65 73 6f 75 72 | thTrailingSlash.=.process.resour |
2da60 | 63 65 73 50 61 74 68 20 2b 20 70 61 74 68 2e 73 65 70 0a 63 6f 6e 73 74 20 6f 72 69 67 69 6e 61 | cesPath.+.path.sep.const.origina |
2da80 | 6c 4e 6f 64 65 4d 6f 64 75 6c 65 50 61 74 68 73 20 3d 20 4d 6f 64 75 6c 65 2e 5f 6e 6f 64 65 4d | lNodeModulePaths.=.Module._nodeM |
2daa0 | 6f 64 75 6c 65 50 61 74 68 73 0a 4d 6f 64 75 6c 65 2e 5f 6e 6f 64 65 4d 6f 64 75 6c 65 50 61 74 | odulePaths.Module._nodeModulePat |
2dac0 | 68 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 66 72 6f 6d 29 20 7b 0a 20 20 63 6f 6e 73 74 20 70 | hs.=.function.(from).{...const.p |
2dae0 | 61 74 68 73 20 3d 20 6f 72 69 67 69 6e 61 6c 4e 6f 64 65 4d 6f 64 75 6c 65 50 61 74 68 73 28 66 | aths.=.originalNodeModulePaths(f |
2db00 | 72 6f 6d 29 0a 20 20 63 6f 6e 73 74 20 66 72 6f 6d 50 61 74 68 20 3d 20 70 61 74 68 2e 72 65 73 | rom)...const.fromPath.=.path.res |
2db20 | 6f 6c 76 65 28 66 72 6f 6d 29 20 2b 20 70 61 74 68 2e 73 65 70 0a 20 20 2f 2f 20 49 66 20 22 66 | olve(from).+.path.sep...//.If."f |
2db40 | 72 6f 6d 22 20 69 73 20 6f 75 74 73 69 64 65 20 74 68 65 20 61 70 70 20 74 68 65 6e 20 77 65 20 | rom".is.outside.the.app.then.we. |
2db60 | 64 6f 20 6e 6f 74 68 69 6e 67 2e 0a 20 20 69 66 20 28 66 72 6f 6d 50 61 74 68 2e 73 74 61 72 74 | do.nothing....if.(fromPath.start |
2db80 | 73 57 69 74 68 28 72 65 73 6f 75 72 63 65 73 50 61 74 68 57 69 74 68 54 72 61 69 6c 69 6e 67 53 | sWith(resourcesPathWithTrailingS |
2dba0 | 6c 61 73 68 29 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 70 61 74 68 73 2e 66 69 6c 74 65 72 | lash)).{.....return.paths.filter |
2dbc0 | 28 66 75 6e 63 74 69 6f 6e 20 28 63 61 6e 64 69 64 61 74 65 29 20 7b 0a 20 20 20 20 20 20 72 65 | (function.(candidate).{.......re |
2dbe0 | 74 75 72 6e 20 63 61 6e 64 69 64 61 74 65 2e 73 74 61 72 74 73 57 69 74 68 28 72 65 73 6f 75 72 | turn.candidate.startsWith(resour |
2dc00 | 63 65 73 50 61 74 68 57 69 74 68 54 72 61 69 6c 69 6e 67 53 6c 61 73 68 29 0a 20 20 20 20 7d 29 | cesPathWithTrailingSlash).....}) |
2dc20 | 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 70 61 74 68 73 0a 20 20 7d | ...}.else.{.....return.paths...} |
2dc40 | 0a 7d 0a 0a 63 6f 6e 73 74 20 42 41 53 45 5f 49 4e 54 45 52 4e 41 4c 5f 50 41 54 48 20 3d 20 70 | .}..const.BASE_INTERNAL_PATH.=.p |
2dc60 | 61 74 68 2e 72 65 73 6f 6c 76 65 28 5f 5f 64 69 72 6e 61 6d 65 2c 20 27 2e 2e 27 29 0a 63 6f 6e | ath.resolve(__dirname,.'..').con |
2dc80 | 73 74 20 49 4e 54 45 52 4e 41 4c 5f 4d 4f 44 55 4c 45 5f 50 52 45 46 49 58 20 3d 20 27 40 65 6c | st.INTERNAL_MODULE_PREFIX.=.'@el |
2dca0 | 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 27 0a 0a 2f 2f 20 50 61 74 63 68 20 4d 6f 64 75 | ectron/internal/'..//.Patch.Modu |
2dcc0 | 6c 65 2e 5f 72 65 73 6f 6c 76 65 46 69 6c 65 6e 61 6d 65 20 74 6f 20 61 6c 77 61 79 73 20 72 65 | le._resolveFilename.to.always.re |
2dce0 | 71 75 69 72 65 20 74 68 65 20 45 6c 65 63 74 72 6f 6e 20 41 50 49 20 77 68 65 6e 0a 2f 2f 20 72 | quire.the.Electron.API.when.//.r |
2dd00 | 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 20 69 73 20 64 6f 6e 65 2e 0a 63 6f 6e 73 | equire('electron').is.done..cons |
2dd20 | 74 20 65 6c 65 63 74 72 6f 6e 50 61 74 68 20 3d 20 70 61 74 68 2e 6a 6f 69 6e 28 5f 5f 64 69 72 | t.electronPath.=.path.join(__dir |
2dd40 | 6e 61 6d 65 2c 20 27 2e 2e 27 2c 20 70 72 6f 63 65 73 73 2e 74 79 70 65 2c 20 27 61 70 69 27 2c | name,.'..',.process.type,.'api', |
2dd60 | 20 27 65 78 70 6f 72 74 73 27 2c 20 27 65 6c 65 63 74 72 6f 6e 2e 6a 73 27 29 0a 63 6f 6e 73 74 | .'exports',.'electron.js').const |
2dd80 | 20 6f 72 69 67 69 6e 61 6c 52 65 73 6f 6c 76 65 46 69 6c 65 6e 61 6d 65 20 3d 20 4d 6f 64 75 6c | .originalResolveFilename.=.Modul |
2dda0 | 65 2e 5f 72 65 73 6f 6c 76 65 46 69 6c 65 6e 61 6d 65 0a 4d 6f 64 75 6c 65 2e 5f 72 65 73 6f 6c | e._resolveFilename.Module._resol |
2ddc0 | 76 65 46 69 6c 65 6e 61 6d 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 72 65 71 75 65 73 74 2c 20 | veFilename.=.function.(request,. |
2dde0 | 70 61 72 65 6e 74 2c 20 69 73 4d 61 69 6e 29 20 7b 0a 20 20 69 66 20 28 72 65 71 75 65 73 74 20 | parent,.isMain).{...if.(request. |
2de00 | 3d 3d 3d 20 27 65 6c 65 63 74 72 6f 6e 27 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 65 6c 65 | ===.'electron').{.....return.ele |
2de20 | 63 74 72 6f 6e 50 61 74 68 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 72 65 71 75 65 73 74 2e 73 | ctronPath...}.else.if.(request.s |
2de40 | 74 61 72 74 73 57 69 74 68 28 49 4e 54 45 52 4e 41 4c 5f 4d 4f 44 55 4c 45 5f 50 52 45 46 49 58 | tartsWith(INTERNAL_MODULE_PREFIX |
2de60 | 29 20 26 26 20 72 65 71 75 65 73 74 2e 6c 65 6e 67 74 68 20 3e 20 49 4e 54 45 52 4e 41 4c 5f 4d | ).&&.request.length.>.INTERNAL_M |
2de80 | 4f 44 55 4c 45 5f 50 52 45 46 49 58 2e 6c 65 6e 67 74 68 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 | ODULE_PREFIX.length).{.....const |
2dea0 | 20 73 6c 69 63 65 64 52 65 71 75 65 73 74 20 3d 20 72 65 71 75 65 73 74 2e 73 6c 69 63 65 28 49 | .slicedRequest.=.request.slice(I |
2dec0 | 4e 54 45 52 4e 41 4c 5f 4d 4f 44 55 4c 45 5f 50 52 45 46 49 58 2e 6c 65 6e 67 74 68 29 0a 20 20 | NTERNAL_MODULE_PREFIX.length)... |
2dee0 | 20 20 72 65 74 75 72 6e 20 70 61 74 68 2e 72 65 73 6f 6c 76 65 28 42 41 53 45 5f 49 4e 54 45 52 | ..return.path.resolve(BASE_INTER |
2df00 | 4e 41 4c 5f 50 41 54 48 2c 20 60 24 7b 73 6c 69 63 65 64 52 65 71 75 65 73 74 7d 24 7b 73 6c 69 | NAL_PATH,.`${slicedRequest}${sli |
2df20 | 63 65 64 52 65 71 75 65 73 74 2e 65 6e 64 73 57 69 74 68 28 27 2e 6a 73 27 29 20 3f 20 27 27 20 | cedRequest.endsWith('.js').?.''. |
2df40 | 3a 20 27 2e 6a 73 27 7d 60 29 0a 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 72 65 74 75 72 6e | :.'.js'}`)...}.else.{.....return |
2df60 | 20 6f 72 69 67 69 6e 61 6c 52 65 73 6f 6c 76 65 46 69 6c 65 6e 61 6d 65 28 72 65 71 75 65 73 74 | .originalResolveFilename(request |
2df80 | 2c 20 70 61 72 65 6e 74 2c 20 69 73 4d 61 69 6e 29 0a 20 20 7d 0a 7d 0a 27 75 73 65 20 73 74 72 | ,.parent,.isMain)...}.}.'use.str |
2dfa0 | 69 63 74 27 0a 0a 2f 2f 20 50 75 62 6c 69 63 2d 66 61 63 69 6e 67 20 41 50 49 20 6d 65 74 68 6f | ict'..//.Public-facing.API.metho |
2dfc0 | 64 73 2e 0a 65 78 70 6f 72 74 73 2e 73 79 6e 63 4d 65 74 68 6f 64 73 20 3d 20 6e 65 77 20 53 65 | ds..exports.syncMethods.=.new.Se |
2dfe0 | 74 28 5b 0a 20 20 27 67 65 74 55 52 4c 27 2c 0a 20 20 27 6c 6f 61 64 55 52 4c 27 2c 0a 20 20 27 | t([...'getURL',...'loadURL',...' |
2e000 | 67 65 74 54 69 74 6c 65 27 2c 0a 20 20 27 69 73 4c 6f 61 64 69 6e 67 27 2c 0a 20 20 27 69 73 4c | getTitle',...'isLoading',...'isL |
2e020 | 6f 61 64 69 6e 67 4d 61 69 6e 46 72 61 6d 65 27 2c 0a 20 20 27 69 73 57 61 69 74 69 6e 67 46 6f | oadingMainFrame',...'isWaitingFo |
2e040 | 72 52 65 73 70 6f 6e 73 65 27 2c 0a 20 20 27 73 74 6f 70 27 2c 0a 20 20 27 72 65 6c 6f 61 64 27 | rResponse',...'stop',...'reload' |
2e060 | 2c 0a 20 20 27 72 65 6c 6f 61 64 49 67 6e 6f 72 69 6e 67 43 61 63 68 65 27 2c 0a 20 20 27 63 61 | ,...'reloadIgnoringCache',...'ca |
2e080 | 6e 47 6f 42 61 63 6b 27 2c 0a 20 20 27 63 61 6e 47 6f 46 6f 72 77 61 72 64 27 2c 0a 20 20 27 63 | nGoBack',...'canGoForward',...'c |
2e0a0 | 61 6e 47 6f 54 6f 4f 66 66 73 65 74 27 2c 0a 20 20 27 63 6c 65 61 72 48 69 73 74 6f 72 79 27 2c | anGoToOffset',...'clearHistory', |
2e0c0 | 0a 20 20 27 67 6f 42 61 63 6b 27 2c 0a 20 20 27 67 6f 46 6f 72 77 61 72 64 27 2c 0a 20 20 27 67 | ...'goBack',...'goForward',...'g |
2e0e0 | 6f 54 6f 49 6e 64 65 78 27 2c 0a 20 20 27 67 6f 54 6f 4f 66 66 73 65 74 27 2c 0a 20 20 27 69 73 | oToIndex',...'goToOffset',...'is |
2e100 | 43 72 61 73 68 65 64 27 2c 0a 20 20 27 73 65 74 55 73 65 72 41 67 65 6e 74 27 2c 0a 20 20 27 67 | Crashed',...'setUserAgent',...'g |
2e120 | 65 74 55 73 65 72 41 67 65 6e 74 27 2c 0a 20 20 27 6f 70 65 6e 44 65 76 54 6f 6f 6c 73 27 2c 0a | etUserAgent',...'openDevTools',. |
2e140 | 20 20 27 63 6c 6f 73 65 44 65 76 54 6f 6f 6c 73 27 2c 0a 20 20 27 69 73 44 65 76 54 6f 6f 6c 73 | ..'closeDevTools',...'isDevTools |
2e160 | 4f 70 65 6e 65 64 27 2c 0a 20 20 27 69 73 44 65 76 54 6f 6f 6c 73 46 6f 63 75 73 65 64 27 2c 0a | Opened',...'isDevToolsFocused',. |
2e180 | 20 20 27 69 6e 73 70 65 63 74 45 6c 65 6d 65 6e 74 27 2c 0a 20 20 27 73 65 74 41 75 64 69 6f 4d | ..'inspectElement',...'setAudioM |
2e1a0 | 75 74 65 64 27 2c 0a 20 20 27 69 73 41 75 64 69 6f 4d 75 74 65 64 27 2c 0a 20 20 27 69 73 43 75 | uted',...'isAudioMuted',...'isCu |
2e1c0 | 72 72 65 6e 74 6c 79 41 75 64 69 62 6c 65 27 2c 0a 20 20 27 75 6e 64 6f 27 2c 0a 20 20 27 72 65 | rrentlyAudible',...'undo',...'re |
2e1e0 | 64 6f 27 2c 0a 20 20 27 63 75 74 27 2c 0a 20 20 27 63 6f 70 79 27 2c 0a 20 20 27 70 61 73 74 65 | do',...'cut',...'copy',...'paste |
2e200 | 27 2c 0a 20 20 27 70 61 73 74 65 41 6e 64 4d 61 74 63 68 53 74 79 6c 65 27 2c 0a 20 20 27 64 65 | ',...'pasteAndMatchStyle',...'de |
2e220 | 6c 65 74 65 27 2c 0a 20 20 27 73 65 6c 65 63 74 41 6c 6c 27 2c 0a 20 20 27 75 6e 73 65 6c 65 63 | lete',...'selectAll',...'unselec |
2e240 | 74 27 2c 0a 20 20 27 72 65 70 6c 61 63 65 27 2c 0a 20 20 27 72 65 70 6c 61 63 65 4d 69 73 73 70 | t',...'replace',...'replaceMissp |
2e260 | 65 6c 6c 69 6e 67 27 2c 0a 20 20 27 66 69 6e 64 49 6e 50 61 67 65 27 2c 0a 20 20 27 73 74 6f 70 | elling',...'findInPage',...'stop |
2e280 | 46 69 6e 64 49 6e 50 61 67 65 27 2c 0a 20 20 27 64 6f 77 6e 6c 6f 61 64 55 52 4c 27 2c 0a 20 20 | FindInPage',...'downloadURL',... |
2e2a0 | 27 69 6e 73 70 65 63 74 53 65 72 76 69 63 65 57 6f 72 6b 65 72 27 2c 0a 20 20 27 73 68 6f 77 44 | 'inspectServiceWorker',...'showD |
2e2c0 | 65 66 69 6e 69 74 69 6f 6e 46 6f 72 53 65 6c 65 63 74 69 6f 6e 27 2c 0a 20 20 27 73 65 74 5a 6f | efinitionForSelection',...'setZo |
2e2e0 | 6f 6d 46 61 63 74 6f 72 27 2c 0a 20 20 27 73 65 74 5a 6f 6f 6d 4c 65 76 65 6c 27 0a 5d 29 0a 0a | omFactor',...'setZoomLevel'.]).. |
2e300 | 65 78 70 6f 72 74 73 2e 61 73 79 6e 63 43 61 6c 6c 62 61 63 6b 4d 65 74 68 6f 64 73 20 3d 20 6e | exports.asyncCallbackMethods.=.n |
2e320 | 65 77 20 53 65 74 28 5b 0a 20 20 27 69 6e 73 65 72 74 43 53 53 27 2c 0a 20 20 27 69 6e 73 65 72 | ew.Set([...'insertCSS',...'inser |
2e340 | 74 54 65 78 74 27 2c 0a 20 20 27 73 65 6e 64 27 2c 0a 20 20 27 73 65 6e 64 49 6e 70 75 74 45 76 | tText',...'send',...'sendInputEv |
2e360 | 65 6e 74 27 2c 0a 20 20 27 73 65 74 4c 61 79 6f 75 74 5a 6f 6f 6d 4c 65 76 65 6c 4c 69 6d 69 74 | ent',...'setLayoutZoomLevelLimit |
2e380 | 73 27 2c 0a 20 20 27 73 65 74 56 69 73 75 61 6c 5a 6f 6f 6d 4c 65 76 65 6c 4c 69 6d 69 74 73 27 | s',...'setVisualZoomLevelLimits' |
2e3a0 | 2c 0a 20 20 27 67 65 74 5a 6f 6f 6d 46 61 63 74 6f 72 27 2c 0a 20 20 27 67 65 74 5a 6f 6f 6d 4c | ,...'getZoomFactor',...'getZoomL |
2e3c0 | 65 76 65 6c 27 2c 0a 20 20 27 70 72 69 6e 74 27 2c 0a 20 20 27 70 72 69 6e 74 54 6f 50 44 46 27 | evel',...'print',...'printToPDF' |
2e3e0 | 0a 5d 29 0a 0a 65 78 70 6f 72 74 73 2e 61 73 79 6e 63 50 72 6f 6d 69 73 65 4d 65 74 68 6f 64 73 | .])..exports.asyncPromiseMethods |
2e400 | 20 3d 20 6e 65 77 20 53 65 74 28 5b 0a 20 20 27 63 61 70 74 75 72 65 50 61 67 65 27 2c 0a 20 20 | .=.new.Set([...'capturePage',... |
2e420 | 27 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 27 0a 5d 29 0a 27 75 73 65 20 73 74 72 69 | 'executeJavaScript'.]).'use.stri |
2e440 | 63 74 27 0a 0a 63 6f 6e 73 74 20 43 72 61 73 68 52 65 70 6f 72 74 65 72 20 3d 20 72 65 71 75 69 | ct'..const.CrashReporter.=.requi |
2e460 | 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 63 72 | re('@electron/internal/common/cr |
2e480 | 61 73 68 2d 72 65 70 6f 72 74 65 72 27 29 0a 63 6f 6e 73 74 20 69 70 63 52 65 6e 64 65 72 65 72 | ash-reporter').const.ipcRenderer |
2e4a0 | 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 | .=.require('@electron/internal/r |
2e4c0 | 65 6e 64 65 72 65 72 2f 69 70 63 2d 72 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 6e 61 6c 27 29 0a | enderer/ipc-renderer-internal'). |
2e4e0 | 63 6f 6e 73 74 20 65 72 72 6f 72 55 74 69 6c 73 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 | const.errorUtils.=.require('@ele |
2e500 | 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 65 72 72 6f 72 2d 75 74 69 6c | ctron/internal/common/error-util |
2e520 | 73 27 29 0a 0a 63 6f 6e 73 74 20 69 6e 76 6f 6b 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 6f | s')..const.invoke.=.function.(co |
2e540 | 6d 6d 61 6e 64 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 5b 20 65 72 72 6f | mmand,....args).{...const.[.erro |
2e560 | 72 2c 20 72 65 73 75 6c 74 20 5d 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 | r,.result.].=.ipcRenderer.sendSy |
2e580 | 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 2e 2e 2e 61 72 67 73 29 0a 0a 20 20 69 66 20 28 65 72 72 6f | nc(command,....args)....if.(erro |
2e5a0 | 72 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 65 72 72 6f 72 55 74 69 6c 73 2e 64 65 73 65 72 69 | r).{.....throw.errorUtils.deseri |
2e5c0 | 61 6c 69 7a 65 28 65 72 72 6f 72 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 72 65 73 75 6c | alize(error)...}....return.resul |
2e5e0 | 74 0a 7d 0a 0a 63 6c 61 73 73 20 43 72 61 73 68 52 65 70 6f 72 74 65 72 52 65 6e 64 65 72 65 72 | t.}..class.CrashReporterRenderer |
2e600 | 20 65 78 74 65 6e 64 73 20 43 72 61 73 68 52 65 70 6f 72 74 65 72 20 7b 0a 20 20 69 6e 69 74 20 | .extends.CrashReporter.{...init. |
2e620 | 28 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 69 6e 76 6f 6b 65 28 27 45 | (options).{.....return.invoke('E |
2e640 | 4c 45 43 54 52 4f 4e 5f 43 52 41 53 48 5f 52 45 50 4f 52 54 45 52 5f 49 4e 49 54 27 2c 20 6f 70 | LECTRON_CRASH_REPORTER_INIT',.op |
2e660 | 74 69 6f 6e 73 29 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 6e | tions)...}.}..module.exports.=.n |
2e680 | 65 77 20 43 72 61 73 68 52 65 70 6f 72 74 65 72 52 65 6e 64 65 72 65 72 28 29 0a 27 75 73 65 20 | ew.CrashReporterRenderer().'use. |
2e6a0 | 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 6e 61 74 69 76 65 49 6d 61 67 65 20 7d 20 3d | strict'..const.{.nativeImage.}.= |
2e6c0 | 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 69 70 63 52 65 | .require('electron').const.ipcRe |
2e6e0 | 6e 64 65 72 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 | nderer.=.require('@electron/inte |
2e700 | 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 69 70 63 2d 72 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 | rnal/renderer/ipc-renderer-inter |
2e720 | 6e 61 6c 27 29 0a 0a 63 6f 6e 73 74 20 69 6e 63 6c 75 64 65 73 20 3d 20 5b 5d 2e 69 6e 63 6c 75 | nal')..const.includes.=.[].inclu |
2e740 | 64 65 73 0a 6c 65 74 20 63 75 72 72 65 6e 74 49 64 20 3d 20 30 0a 0a 63 6f 6e 73 74 20 69 6e 63 | des.let.currentId.=.0..const.inc |
2e760 | 72 65 6d 65 6e 74 49 64 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 63 75 72 72 65 6e 74 49 64 20 2b | rementId.=.().=>.{...currentId.+ |
2e780 | 3d 20 31 0a 20 20 72 65 74 75 72 6e 20 63 75 72 72 65 6e 74 49 64 0a 7d 0a 0a 2f 2f 20 7c 6f 70 | =.1...return.currentId.}..//.|op |
2e7a0 | 74 69 6f 6e 73 2e 74 79 70 65 73 7c 20 63 61 6e 27 74 20 62 65 20 65 6d 70 74 79 20 61 6e 64 20 | tions.types|.can't.be.empty.and. |
2e7c0 | 6d 75 73 74 20 62 65 20 61 6e 20 61 72 72 61 79 0a 66 75 6e 63 74 69 6f 6e 20 69 73 56 61 6c 69 | must.be.an.array.function.isVali |
2e7e0 | 64 20 28 6f 70 74 69 6f 6e 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 74 79 70 65 73 20 3d 20 6f 70 | d.(options).{...const.types.=.op |
2e800 | 74 69 6f 6e 73 20 3f 20 6f 70 74 69 6f 6e 73 2e 74 79 70 65 73 20 3a 20 75 6e 64 65 66 69 6e 65 | tions.?.options.types.:.undefine |
2e820 | 64 0a 20 20 72 65 74 75 72 6e 20 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 74 79 70 65 73 29 0a | d...return.Array.isArray(types). |
2e840 | 7d 0a 0a 65 78 70 6f 72 74 73 2e 67 65 74 53 6f 75 72 63 65 73 20 3d 20 66 75 6e 63 74 69 6f 6e | }..exports.getSources.=.function |
2e860 | 20 28 6f 70 74 69 6f 6e 73 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 69 66 20 28 21 69 73 | .(options,.callback).{...if.(!is |
2e880 | 56 61 6c 69 64 28 6f 70 74 69 6f 6e 73 29 29 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 | Valid(options)).return.callback( |
2e8a0 | 6e 65 77 20 45 72 72 6f 72 28 27 49 6e 76 61 6c 69 64 20 6f 70 74 69 6f 6e 73 27 29 29 0a 20 20 | new.Error('Invalid.options'))... |
2e8c0 | 63 6f 6e 73 74 20 63 61 70 74 75 72 65 57 69 6e 64 6f 77 20 3d 20 69 6e 63 6c 75 64 65 73 2e 63 | const.captureWindow.=.includes.c |
2e8e0 | 61 6c 6c 28 6f 70 74 69 6f 6e 73 2e 74 79 70 65 73 2c 20 27 77 69 6e 64 6f 77 27 29 0a 20 20 63 | all(options.types,.'window')...c |
2e900 | 6f 6e 73 74 20 63 61 70 74 75 72 65 53 63 72 65 65 6e 20 3d 20 69 6e 63 6c 75 64 65 73 2e 63 61 | onst.captureScreen.=.includes.ca |
2e920 | 6c 6c 28 6f 70 74 69 6f 6e 73 2e 74 79 70 65 73 2c 20 27 73 63 72 65 65 6e 27 29 0a 0a 20 20 69 | ll(options.types,.'screen')....i |
2e940 | 66 20 28 6f 70 74 69 6f 6e 73 2e 74 68 75 6d 62 6e 61 69 6c 53 69 7a 65 20 3d 3d 20 6e 75 6c 6c | f.(options.thumbnailSize.==.null |
2e960 | 29 20 7b 0a 20 20 20 20 6f 70 74 69 6f 6e 73 2e 74 68 75 6d 62 6e 61 69 6c 53 69 7a 65 20 3d 20 | ).{.....options.thumbnailSize.=. |
2e980 | 7b 0a 20 20 20 20 20 20 77 69 64 74 68 3a 20 31 35 30 2c 0a 20 20 20 20 20 20 68 65 69 67 68 74 | {.......width:.150,.......height |
2e9a0 | 3a 20 31 35 30 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 69 64 20 3d 20 69 6e | :.150.....}...}....const.id.=.in |
2e9c0 | 63 72 65 6d 65 6e 74 49 64 28 29 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 | crementId()...ipcRenderer.send(' |
2e9e0 | 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 44 45 53 4b 54 4f 50 5f 43 41 50 54 55 52 45 | ELECTRON_BROWSER_DESKTOP_CAPTURE |
2ea00 | 52 5f 47 45 54 5f 53 4f 55 52 43 45 53 27 2c 20 63 61 70 74 75 72 65 57 69 6e 64 6f 77 2c 20 63 | R_GET_SOURCES',.captureWindow,.c |
2ea20 | 61 70 74 75 72 65 53 63 72 65 65 6e 2c 20 6f 70 74 69 6f 6e 73 2e 74 68 75 6d 62 6e 61 69 6c 53 | aptureScreen,.options.thumbnailS |
2ea40 | 69 7a 65 2c 20 69 64 29 0a 20 20 72 65 74 75 72 6e 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e | ize,.id)...return.ipcRenderer.on |
2ea60 | 63 65 28 60 45 4c 45 43 54 52 4f 4e 5f 52 45 4e 44 45 52 45 52 5f 44 45 53 4b 54 4f 50 5f 43 41 | ce(`ELECTRON_RENDERER_DESKTOP_CA |
2ea80 | 50 54 55 52 45 52 5f 52 45 53 55 4c 54 5f 24 7b 69 64 7d 60 2c 20 28 65 76 65 6e 74 2c 20 73 6f | PTURER_RESULT_${id}`,.(event,.so |
2eaa0 | 75 72 63 65 73 29 20 3d 3e 20 7b 0a 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 6e 75 6c 6c 2c 20 28 | urces).=>.{.....callback(null,.( |
2eac0 | 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 73 75 6c 74 73 20 3d 20 5b 5d | ().=>.{.......const.results.=.[] |
2eae0 | 0a 20 20 20 20 20 20 73 6f 75 72 63 65 73 2e 66 6f 72 45 61 63 68 28 73 6f 75 72 63 65 20 3d 3e | .......sources.forEach(source.=> |
2eb00 | 20 7b 0a 20 20 20 20 20 20 20 20 72 65 73 75 6c 74 73 2e 70 75 73 68 28 7b 0a 20 20 20 20 20 20 | .{.........results.push({....... |
2eb20 | 20 20 20 20 69 64 3a 20 73 6f 75 72 63 65 2e 69 64 2c 0a 20 20 20 20 20 20 20 20 20 20 6e 61 6d | ....id:.source.id,...........nam |
2eb40 | 65 3a 20 73 6f 75 72 63 65 2e 6e 61 6d 65 2c 0a 20 20 20 20 20 20 20 20 20 20 74 68 75 6d 62 6e | e:.source.name,...........thumbn |
2eb60 | 61 69 6c 3a 20 6e 61 74 69 76 65 49 6d 61 67 65 2e 63 72 65 61 74 65 46 72 6f 6d 44 61 74 61 55 | ail:.nativeImage.createFromDataU |
2eb80 | 52 4c 28 73 6f 75 72 63 65 2e 74 68 75 6d 62 6e 61 69 6c 29 2c 0a 20 20 20 20 20 20 20 20 20 20 | RL(source.thumbnail),........... |
2eba0 | 64 69 73 70 6c 61 79 5f 69 64 3a 20 73 6f 75 72 63 65 2e 64 69 73 70 6c 61 79 5f 69 64 0a 20 20 | display_id:.source.display_id... |
2ebc0 | 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 72 | ......}).......}).......return.r |
2ebe0 | 65 73 75 6c 74 73 0a 20 20 20 20 7d 29 28 29 29 0a 20 20 7d 29 0a 7d 0a 27 75 73 65 20 73 74 72 | esults.....})())...}).}.'use.str |
2ec00 | 69 63 74 27 0a 0a 63 6f 6e 73 74 20 63 6f 6d 6d 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 | ict'..const.common.=.require('@e |
2ec20 | 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 61 70 69 2f 65 78 70 6f | lectron/internal/common/api/expo |
2ec40 | 72 74 73 2f 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 6d 6f 64 75 6c 65 4c 69 73 74 20 | rts/electron').const.moduleList. |
2ec60 | 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 | =.require('@electron/internal/re |
2ec80 | 6e 64 65 72 65 72 2f 61 70 69 2f 6d 6f 64 75 6c 65 2d 6c 69 73 74 27 29 0a 0a 2f 2f 20 49 6d 70 | nderer/api/module-list')..//.Imp |
2eca0 | 6f 72 74 20 63 6f 6d 6d 6f 6e 20 6d 6f 64 75 6c 65 73 2e 0a 63 6f 6d 6d 6f 6e 2e 64 65 66 69 6e | ort.common.modules..common.defin |
2ecc0 | 65 50 72 6f 70 65 72 74 69 65 73 28 65 78 70 6f 72 74 73 29 0a 0a 66 6f 72 20 28 63 6f 6e 73 74 | eProperties(exports)..for.(const |
2ece0 | 20 7b 0a 20 20 6e 61 6d 65 2c 0a 20 20 66 69 6c 65 2c 0a 20 20 65 6e 61 62 6c 65 64 20 3d 20 74 | .{...name,...file,...enabled.=.t |
2ed00 | 72 75 65 2c 0a 20 20 70 72 69 76 61 74 65 3a 20 69 73 50 72 69 76 61 74 65 20 3d 20 66 61 6c 73 | rue,...private:.isPrivate.=.fals |
2ed20 | 65 0a 7d 20 6f 66 20 6d 6f 64 75 6c 65 4c 69 73 74 29 20 7b 0a 20 20 69 66 20 28 21 65 6e 61 62 | e.}.of.moduleList).{...if.(!enab |
2ed40 | 6c 65 64 29 20 7b 0a 20 20 20 20 63 6f 6e 74 69 6e 75 65 0a 20 20 7d 0a 0a 20 20 4f 62 6a 65 63 | led).{.....continue...}....Objec |
2ed60 | 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 65 78 70 6f 72 74 73 2c 20 6e 61 6d 65 2c 20 | t.defineProperty(exports,.name,. |
2ed80 | 7b 0a 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 21 69 73 50 72 69 76 61 74 65 2c 0a 20 20 | {.....enumerable:.!isPrivate,... |
2eda0 | 20 20 67 65 74 3a 20 63 6f 6d 6d 6f 6e 2e 6d 65 6d 6f 69 7a 65 64 47 65 74 74 65 72 28 28 29 20 | ..get:.common.memoizedGetter((). |
2edc0 | 3d 3e 20 72 65 71 75 69 72 65 28 60 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 | =>.require(`@electron/internal/r |
2ede0 | 65 6e 64 65 72 65 72 2f 61 70 69 2f 24 7b 66 69 6c 65 7d 60 29 29 0a 20 20 7d 29 0a 7d 0a 27 75 | enderer/api/${file}`))...}).}.'u |
2ee00 | 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 62 69 6e 64 69 6e 67 20 3d 20 70 72 6f 63 | se.strict'..const.binding.=.proc |
2ee20 | 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 69 70 63 27 29 0a 63 6f 6e 73 74 20 76 38 55 | ess.atomBinding('ipc').const.v8U |
2ee40 | 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 | til.=.process.atomBinding('v8_ut |
2ee60 | 69 6c 27 29 0a 0a 2f 2f 20 43 72 65 61 74 65 64 20 62 79 20 69 6e 69 74 2e 6a 73 2e 0a 63 6f 6e | il')..//.Created.by.init.js..con |
2ee80 | 73 74 20 69 70 63 52 65 6e 64 65 72 65 72 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 | st.ipcRenderer.=.v8Util.getHidde |
2eea0 | 6e 56 61 6c 75 65 28 67 6c 6f 62 61 6c 2c 20 27 69 70 63 27 29 0a 63 6f 6e 73 74 20 69 6e 74 65 | nValue(global,.'ipc').const.inte |
2eec0 | 72 6e 61 6c 20 3d 20 66 61 6c 73 65 0a 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 20 3d | rnal.=.false..ipcRenderer.send.= |
2eee0 | 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 62 | .function.(...args).{...return.b |
2ef00 | 69 6e 64 69 6e 67 2e 73 65 6e 64 28 27 69 70 63 2d 6d 65 73 73 61 67 65 27 2c 20 61 72 67 73 29 | inding.send('ipc-message',.args) |
2ef20 | 0a 7d 0a 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 20 3d 20 66 75 6e 63 74 | .}..ipcRenderer.sendSync.=.funct |
2ef40 | 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 | ion.(...args).{...return.binding |
2ef60 | 2e 73 65 6e 64 53 79 6e 63 28 27 69 70 63 2d 6d 65 73 73 61 67 65 2d 73 79 6e 63 27 2c 20 61 72 | .sendSync('ipc-message-sync',.ar |
2ef80 | 67 73 29 5b 30 5d 0a 7d 0a 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 54 6f 48 6f 73 74 | gs)[0].}..ipcRenderer.sendToHost |
2efa0 | 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 72 65 74 75 72 6e | .=.function.(...args).{...return |
2efc0 | 20 62 69 6e 64 69 6e 67 2e 73 65 6e 64 28 27 69 70 63 2d 6d 65 73 73 61 67 65 2d 68 6f 73 74 27 | .binding.send('ipc-message-host' |
2efe0 | 2c 20 61 72 67 73 29 0a 7d 0a 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 54 6f 20 3d 20 | ,.args).}..ipcRenderer.sendTo.=. |
2f000 | 66 75 6e 63 74 69 6f 6e 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 2c 20 63 68 61 6e 6e 65 6c | function.(webContentsId,.channel |
2f020 | 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 73 65 | ,....args).{...return.binding.se |
2f040 | 6e 64 54 6f 28 69 6e 74 65 72 6e 61 6c 2c 20 66 61 6c 73 65 2c 20 77 65 62 43 6f 6e 74 65 6e 74 | ndTo(internal,.false,.webContent |
2f060 | 73 49 64 2c 20 63 68 61 6e 6e 65 6c 2c 20 61 72 67 73 29 0a 7d 0a 0a 69 70 63 52 65 6e 64 65 72 | sId,.channel,.args).}..ipcRender |
2f080 | 65 72 2e 73 65 6e 64 54 6f 41 6c 6c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 65 62 43 6f 6e 74 | er.sendToAll.=.function.(webCont |
2f0a0 | 65 6e 74 73 49 64 2c 20 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 72 65 | entsId,.channel,....args).{...re |
2f0c0 | 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 73 65 6e 64 54 6f 28 69 6e 74 65 72 6e 61 6c 2c 20 74 72 | turn.binding.sendTo(internal,.tr |
2f0e0 | 75 65 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 2c 20 63 68 61 6e 6e 65 6c 2c 20 61 72 67 73 | ue,.webContentsId,.channel,.args |
2f100 | 29 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 69 70 63 52 65 6e 64 65 72 65 | ).}..module.exports.=.ipcRendere |
2f120 | 72 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 66 65 61 74 75 72 65 73 20 3d | r.'use.strict'..const.features.= |
2f140 | 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 66 65 61 74 75 72 65 73 27 29 | .process.atomBinding('features') |
2f160 | 0a 63 6f 6e 73 74 20 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 | .const.v8Util.=.process.atomBind |
2f180 | 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 29 0a 0a 63 6f 6e 73 74 20 65 6e 61 62 6c 65 52 65 6d 6f | ing('v8_util')..const.enableRemo |
2f1a0 | 74 65 4d 6f 64 75 6c 65 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 | teModule.=.v8Util.getHiddenValue |
2f1c0 | 28 67 6c 6f 62 61 6c 2c 20 27 65 6e 61 62 6c 65 52 65 6d 6f 74 65 4d 6f 64 75 6c 65 27 29 0a 0a | (global,.'enableRemoteModule').. |
2f1e0 | 2f 2f 20 52 65 6e 64 65 72 65 72 20 73 69 64 65 20 6d 6f 64 75 6c 65 73 2c 20 70 6c 65 61 73 65 | //.Renderer.side.modules,.please |
2f200 | 20 73 6f 72 74 20 61 6c 70 68 61 62 65 74 69 63 61 6c 6c 79 2e 0a 2f 2f 20 41 20 6d 6f 64 75 6c | .sort.alphabetically..//.A.modul |
2f220 | 65 20 69 73 20 60 65 6e 61 62 6c 65 64 60 20 69 66 20 74 68 65 72 65 20 69 73 20 6e 6f 20 65 78 | e.is.`enabled`.if.there.is.no.ex |
2f240 | 70 6c 69 63 69 74 20 63 6f 6e 64 69 74 69 6f 6e 20 64 65 66 69 6e 65 64 2e 0a 6d 6f 64 75 6c 65 | plicit.condition.defined..module |
2f260 | 2e 65 78 70 6f 72 74 73 20 3d 20 5b 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 63 72 61 73 68 52 65 70 | .exports.=.[...{.name:.'crashRep |
2f280 | 6f 72 74 65 72 27 2c 20 66 69 6c 65 3a 20 27 63 72 61 73 68 2d 72 65 70 6f 72 74 65 72 27 2c 20 | orter',.file:.'crash-reporter',. |
2f2a0 | 65 6e 61 62 6c 65 64 3a 20 74 72 75 65 20 7d 2c 0a 20 20 7b 0a 20 20 20 20 6e 61 6d 65 3a 20 27 | enabled:.true.},...{.....name:.' |
2f2c0 | 64 65 73 6b 74 6f 70 43 61 70 74 75 72 65 72 27 2c 0a 20 20 20 20 66 69 6c 65 3a 20 27 64 65 73 | desktopCapturer',.....file:.'des |
2f2e0 | 6b 74 6f 70 2d 63 61 70 74 75 72 65 72 27 2c 0a 20 20 20 20 65 6e 61 62 6c 65 64 3a 20 66 65 61 | ktop-capturer',.....enabled:.fea |
2f300 | 74 75 72 65 73 2e 69 73 44 65 73 6b 74 6f 70 43 61 70 74 75 72 65 72 45 6e 61 62 6c 65 64 28 29 | tures.isDesktopCapturerEnabled() |
2f320 | 0a 20 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a 20 27 69 70 63 52 65 6e 64 65 72 65 72 27 2c 20 66 | ...},...{.name:.'ipcRenderer',.f |
2f340 | 69 6c 65 3a 20 27 69 70 63 2d 72 65 6e 64 65 72 65 72 27 20 7d 2c 0a 20 20 7b 20 6e 61 6d 65 3a | ile:.'ipc-renderer'.},...{.name: |
2f360 | 20 27 72 65 6d 6f 74 65 27 2c 20 66 69 6c 65 3a 20 27 72 65 6d 6f 74 65 27 2c 20 65 6e 61 62 6c | .'remote',.file:.'remote',.enabl |
2f380 | 65 64 3a 20 65 6e 61 62 6c 65 52 65 6d 6f 74 65 4d 6f 64 75 6c 65 20 7d 2c 0a 20 20 7b 20 6e 61 | ed:.enableRemoteModule.},...{.na |
2f3a0 | 6d 65 3a 20 27 73 63 72 65 65 6e 27 2c 20 66 69 6c 65 3a 20 27 73 63 72 65 65 6e 27 20 7d 2c 0a | me:.'screen',.file:.'screen'.},. |
2f3c0 | 20 20 7b 20 6e 61 6d 65 3a 20 27 77 65 62 46 72 61 6d 65 27 2c 20 66 69 6c 65 3a 20 27 77 65 62 | ..{.name:.'webFrame',.file:.'web |
2f3e0 | 2d 66 72 61 6d 65 27 20 7d 0a 5d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 | -frame'.}.].'use.strict'..const. |
2f400 | 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 | v8Util.=.process.atomBinding('v8 |
2f420 | 5f 75 74 69 6c 27 29 0a 63 6f 6e 73 74 20 7b 20 69 73 50 72 6f 6d 69 73 65 20 7d 20 3d 20 72 65 | _util').const.{.isPromise.}.=.re |
2f440 | 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 72 65 73 6f 6c 76 65 50 | quire('electron').const.resolveP |
2f460 | 72 6f 6d 69 73 65 20 3d 20 50 72 6f 6d 69 73 65 2e 72 65 73 6f 6c 76 65 2e 62 69 6e 64 28 50 72 | romise.=.Promise.resolve.bind(Pr |
2f480 | 6f 6d 69 73 65 29 0a 0a 63 6f 6e 73 74 20 43 61 6c 6c 62 61 63 6b 73 52 65 67 69 73 74 72 79 20 | omise)..const.CallbacksRegistry. |
2f4a0 | 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 | =.require('@electron/internal/re |
2f4c0 | 6e 64 65 72 65 72 2f 63 61 6c 6c 62 61 63 6b 73 2d 72 65 67 69 73 74 72 79 27 29 0a 63 6f 6e 73 | nderer/callbacks-registry').cons |
2f4e0 | 74 20 62 75 66 66 65 72 55 74 69 6c 73 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 | t.bufferUtils.=.require('@electr |
2f500 | 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 62 75 66 66 65 72 2d 75 74 69 6c 73 27 | on/internal/common/buffer-utils' |
2f520 | 29 0a 63 6f 6e 73 74 20 65 72 72 6f 72 55 74 69 6c 73 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 | ).const.errorUtils.=.require('@e |
2f540 | 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 65 72 72 6f 72 2d 75 74 | lectron/internal/common/error-ut |
2f560 | 69 6c 73 27 29 0a 63 6f 6e 73 74 20 69 70 63 52 65 6e 64 65 72 65 72 20 3d 20 72 65 71 75 69 72 | ils').const.ipcRenderer.=.requir |
2f580 | 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 69 | e('@electron/internal/renderer/i |
2f5a0 | 70 63 2d 72 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 0a 63 6f 6e 73 74 20 63 61 | pc-renderer-internal')..const.ca |
2f5c0 | 6c 6c 62 61 63 6b 73 52 65 67 69 73 74 72 79 20 3d 20 6e 65 77 20 43 61 6c 6c 62 61 63 6b 73 52 | llbacksRegistry.=.new.CallbacksR |
2f5e0 | 65 67 69 73 74 72 79 28 29 0a 63 6f 6e 73 74 20 72 65 6d 6f 74 65 4f 62 6a 65 63 74 43 61 63 68 | egistry().const.remoteObjectCach |
2f600 | 65 20 3d 20 76 38 55 74 69 6c 2e 63 72 65 61 74 65 49 44 57 65 61 6b 4d 61 70 28 29 0a 0a 2f 2f | e.=.v8Util.createIDWeakMap()..// |
2f620 | 20 41 6e 20 75 6e 69 71 75 65 20 49 44 20 74 68 61 74 20 63 61 6e 20 72 65 70 72 65 73 65 6e 74 | .An.unique.ID.that.can.represent |
2f640 | 20 63 75 72 72 65 6e 74 20 63 6f 6e 74 65 78 74 2e 0a 63 6f 6e 73 74 20 63 6f 6e 74 65 78 74 49 | .current.context..const.contextI |
2f660 | 64 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 67 6c 6f 62 61 6c | d.=.v8Util.getHiddenValue(global |
2f680 | 2c 20 27 63 6f 6e 74 65 78 74 49 64 27 29 0a 0a 2f 2f 20 4e 6f 74 69 66 79 20 74 68 65 20 6d 61 | ,.'contextId')..//.Notify.the.ma |
2f6a0 | 69 6e 20 70 72 6f 63 65 73 73 20 77 68 65 6e 20 63 75 72 72 65 6e 74 20 63 6f 6e 74 65 78 74 20 | in.process.when.current.context. |
2f6c0 | 69 73 20 67 6f 69 6e 67 20 74 6f 20 62 65 20 72 65 6c 65 61 73 65 64 2e 0a 2f 2f 20 4e 6f 74 65 | is.going.to.be.released..//.Note |
2f6e0 | 20 74 68 61 74 20 77 68 65 6e 20 74 68 65 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 73 20 | .that.when.the.renderer.process. |
2f700 | 69 73 20 64 65 73 74 72 6f 79 65 64 2c 20 74 68 65 20 6d 65 73 73 61 67 65 20 6d 61 79 20 6e 6f | is.destroyed,.the.message.may.no |
2f720 | 74 20 62 65 0a 2f 2f 20 73 65 6e 74 2c 20 77 65 20 61 6c 73 6f 20 6c 69 73 74 65 6e 20 74 6f 20 | t.be.//.sent,.we.also.listen.to. |
2f740 | 74 68 65 20 22 72 65 6e 64 65 72 2d 76 69 65 77 2d 64 65 6c 65 74 65 64 22 20 65 76 65 6e 74 20 | the."render-view-deleted".event. |
2f760 | 69 6e 20 74 68 65 20 6d 61 69 6e 20 70 72 6f 63 65 73 73 0a 2f 2f 20 74 6f 20 67 75 61 72 64 20 | in.the.main.process.//.to.guard. |
2f780 | 74 68 61 74 20 73 69 74 75 61 74 69 6f 6e 2e 0a 70 72 6f 63 65 73 73 2e 6f 6e 28 27 65 78 69 74 | that.situation..process.on('exit |
2f7a0 | 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c | ',.().=>.{...const.command.=.'EL |
2f7c0 | 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 43 4f 4e 54 45 58 54 5f 52 45 4c 45 41 53 45 27 0a | ECTRON_BROWSER_CONTEXT_RELEASE'. |
2f7e0 | 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 | ..ipcRenderer.sendSync(command,. |
2f800 | 63 6f 6e 74 65 78 74 49 64 29 0a 7d 29 0a 0a 2f 2f 20 43 6f 6e 76 65 72 74 20 74 68 65 20 61 72 | contextId).})..//.Convert.the.ar |
2f820 | 67 75 6d 65 6e 74 73 20 6f 62 6a 65 63 74 20 69 6e 74 6f 20 61 6e 20 61 72 72 61 79 20 6f 66 20 | guments.object.into.an.array.of. |
2f840 | 6d 65 74 61 20 64 61 74 61 2e 0a 66 75 6e 63 74 69 6f 6e 20 77 72 61 70 41 72 67 73 20 28 61 72 | meta.data..function.wrapArgs.(ar |
2f860 | 67 73 2c 20 76 69 73 69 74 65 64 20 3d 20 6e 65 77 20 53 65 74 28 29 29 20 7b 0a 20 20 63 6f 6e | gs,.visited.=.new.Set()).{...con |
2f880 | 73 74 20 76 61 6c 75 65 54 6f 4d 65 74 61 20 3d 20 28 76 61 6c 75 65 29 20 3d 3e 20 7b 0a 20 20 | st.valueToMeta.=.(value).=>.{... |
2f8a0 | 20 20 2f 2f 20 43 68 65 63 6b 20 66 6f 72 20 63 69 72 63 75 6c 61 72 20 72 65 66 65 72 65 6e 63 | ..//.Check.for.circular.referenc |
2f8c0 | 65 2e 0a 20 20 20 20 69 66 20 28 76 69 73 69 74 65 64 2e 68 61 73 28 76 61 6c 75 65 29 29 20 7b | e......if.(visited.has(value)).{ |
2f8e0 | 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 76 | .......return.{.........type:.'v |
2f900 | 61 6c 75 65 27 2c 0a 20 20 20 20 20 20 20 20 76 61 6c 75 65 3a 20 6e 75 6c 6c 0a 20 20 20 20 20 | alue',.........value:.null...... |
2f920 | 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 | .}.....}......if.(Array.isArray( |
2f940 | 76 61 6c 75 65 29 29 20 7b 0a 20 20 20 20 20 20 76 69 73 69 74 65 64 2e 61 64 64 28 76 61 6c 75 | value)).{.......visited.add(valu |
2f960 | 65 29 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d 20 7b 0a 20 20 20 20 20 20 20 20 | e).......const.meta.=.{......... |
2f980 | 74 79 70 65 3a 20 27 61 72 72 61 79 27 2c 0a 20 20 20 20 20 20 20 20 76 61 6c 75 65 3a 20 77 72 | type:.'array',.........value:.wr |
2f9a0 | 61 70 41 72 67 73 28 76 61 6c 75 65 2c 20 76 69 73 69 74 65 64 29 0a 20 20 20 20 20 20 7d 0a 20 | apArgs(value,.visited).......}.. |
2f9c0 | 20 20 20 20 20 76 69 73 69 74 65 64 2e 64 65 6c 65 74 65 28 76 61 6c 75 65 29 0a 20 20 20 20 20 | .....visited.delete(value)...... |
2f9e0 | 20 72 65 74 75 72 6e 20 6d 65 74 61 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 62 75 66 66 | .return.meta.....}.else.if.(buff |
2fa00 | 65 72 55 74 69 6c 73 2e 69 73 42 75 66 66 65 72 28 76 61 6c 75 65 29 29 20 7b 0a 20 20 20 20 20 | erUtils.isBuffer(value)).{...... |
2fa20 | 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 62 75 66 66 65 72 27 | .return.{.........type:.'buffer' |
2fa40 | 2c 0a 20 20 20 20 20 20 20 20 76 61 6c 75 65 3a 20 62 75 66 66 65 72 55 74 69 6c 73 2e 62 75 66 | ,.........value:.bufferUtils.buf |
2fa60 | 66 65 72 54 6f 4d 65 74 61 28 76 61 6c 75 65 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 20 65 | ferToMeta(value).......}.....}.e |
2fa80 | 6c 73 65 20 69 66 20 28 76 61 6c 75 65 20 69 6e 73 74 61 6e 63 65 6f 66 20 44 61 74 65 29 20 7b | lse.if.(value.instanceof.Date).{ |
2faa0 | 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 64 | .......return.{.........type:.'d |
2fac0 | 61 74 65 27 2c 0a 20 20 20 20 20 20 20 20 76 61 6c 75 65 3a 20 76 61 6c 75 65 2e 67 65 74 54 69 | ate',.........value:.value.getTi |
2fae0 | 6d 65 28 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 28 76 61 6c | me().......}.....}.else.if.((val |
2fb00 | 75 65 20 21 3d 20 6e 75 6c 6c 29 20 26 26 20 74 79 70 65 6f 66 20 76 61 6c 75 65 20 3d 3d 3d 20 | ue.!=.null).&&.typeof.value.===. |
2fb20 | 27 6f 62 6a 65 63 74 27 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 69 73 50 72 6f 6d 69 73 65 28 | 'object').{.......if.(isPromise( |
2fb40 | 76 61 6c 75 65 29 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 | value)).{.........return.{...... |
2fb60 | 20 20 20 20 20 74 79 70 65 3a 20 27 70 72 6f 6d 69 73 65 27 2c 0a 20 20 20 20 20 20 20 20 20 20 | .....type:.'promise',........... |
2fb80 | 74 68 65 6e 3a 20 76 61 6c 75 65 54 6f 4d 65 74 61 28 66 75 6e 63 74 69 6f 6e 20 28 6f 6e 46 75 | then:.valueToMeta(function.(onFu |
2fba0 | 6c 66 69 6c 6c 65 64 2c 20 6f 6e 52 65 6a 65 63 74 65 64 29 20 7b 0a 20 20 20 20 20 20 20 20 20 | lfilled,.onRejected).{.......... |
2fbc0 | 20 20 20 76 61 6c 75 65 2e 74 68 65 6e 28 6f 6e 46 75 6c 66 69 6c 6c 65 64 2c 20 6f 6e 52 65 6a | ...value.then(onFulfilled,.onRej |
2fbe0 | 65 63 74 65 64 29 0a 20 20 20 20 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 | ected)...........}).........}... |
2fc00 | 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 | ....}.else.if.(v8Util.getHiddenV |
2fc20 | 61 6c 75 65 28 76 61 6c 75 65 2c 20 27 61 74 6f 6d 49 64 27 29 29 20 7b 0a 20 20 20 20 20 20 20 | alue(value,.'atomId')).{........ |
2fc40 | 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 72 65 6d 6f 74 | .return.{...........type:.'remot |
2fc60 | 65 2d 6f 62 6a 65 63 74 27 2c 0a 20 20 20 20 20 20 20 20 20 20 69 64 3a 20 76 38 55 74 69 6c 2e | e-object',...........id:.v8Util. |
2fc80 | 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 76 61 6c 75 65 2c 20 27 61 74 6f 6d 49 64 27 29 0a | getHiddenValue(value,.'atomId'). |
2fca0 | 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 6d | ........}.......}........const.m |
2fcc0 | 65 74 61 20 3d 20 7b 0a 20 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 6f 62 6a 65 63 74 27 2c 0a | eta.=.{.........type:.'object',. |
2fce0 | 20 20 20 20 20 20 20 20 6e 61 6d 65 3a 20 76 61 6c 75 65 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 | ........name:.value.constructor. |
2fd00 | 3f 20 76 61 6c 75 65 2e 63 6f 6e 73 74 72 75 63 74 6f 72 2e 6e 61 6d 65 20 3a 20 27 27 2c 0a 20 | ?.value.constructor.name.:.'',.. |
2fd20 | 20 20 20 20 20 20 20 6d 65 6d 62 65 72 73 3a 20 5b 5d 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 | .......members:.[].......}...... |
2fd40 | 20 76 69 73 69 74 65 64 2e 61 64 64 28 76 61 6c 75 65 29 0a 20 20 20 20 20 20 66 6f 72 20 28 63 | .visited.add(value).......for.(c |
2fd60 | 6f 6e 73 74 20 70 72 6f 70 20 69 6e 20 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 20 20 6d 65 | onst.prop.in.value).{.........me |
2fd80 | 74 61 2e 6d 65 6d 62 65 72 73 2e 70 75 73 68 28 7b 0a 20 20 20 20 20 20 20 20 20 20 6e 61 6d 65 | ta.members.push({...........name |
2fda0 | 3a 20 70 72 6f 70 2c 0a 20 20 20 20 20 20 20 20 20 20 76 61 6c 75 65 3a 20 76 61 6c 75 65 54 6f | :.prop,...........value:.valueTo |
2fdc0 | 4d 65 74 61 28 76 61 6c 75 65 5b 70 72 6f 70 5d 29 0a 20 20 20 20 20 20 20 20 7d 29 0a 20 20 20 | Meta(value[prop]).........}).... |
2fde0 | 20 20 20 7d 0a 20 20 20 20 20 20 76 69 73 69 74 65 64 2e 64 65 6c 65 74 65 28 76 61 6c 75 65 29 | ...}.......visited.delete(value) |
2fe00 | 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 6d 65 74 61 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 | .......return.meta.....}.else.if |
2fe20 | 20 28 74 79 70 65 6f 66 20 76 61 6c 75 65 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 20 26 26 | .(typeof.value.===.'function'.&& |
2fe40 | 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 76 61 6c 75 65 2c 20 27 72 | .v8Util.getHiddenValue(value,.'r |
2fe60 | 65 74 75 72 6e 56 61 6c 75 65 27 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 | eturnValue')).{.......return.{.. |
2fe80 | 20 20 20 20 20 20 20 74 79 70 65 3a 20 27 66 75 6e 63 74 69 6f 6e 2d 77 69 74 68 2d 72 65 74 75 | .......type:.'function-with-retu |
2fea0 | 72 6e 2d 76 61 6c 75 65 27 2c 0a 20 20 20 20 20 20 20 20 76 61 6c 75 65 3a 20 76 61 6c 75 65 54 | rn-value',.........value:.valueT |
2fec0 | 6f 4d 65 74 61 28 76 61 6c 75 65 28 29 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 20 65 6c 73 | oMeta(value()).......}.....}.els |
2fee0 | 65 20 69 66 20 28 74 79 70 65 6f 66 20 76 61 6c 75 65 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e | e.if.(typeof.value.===.'function |
2ff00 | 27 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 20 20 74 79 70 65 | ').{.......return.{.........type |
2ff20 | 3a 20 27 66 75 6e 63 74 69 6f 6e 27 2c 0a 20 20 20 20 20 20 20 20 69 64 3a 20 63 61 6c 6c 62 61 | :.'function',.........id:.callba |
2ff40 | 63 6b 73 52 65 67 69 73 74 72 79 2e 61 64 64 28 76 61 6c 75 65 29 2c 0a 20 20 20 20 20 20 20 20 | cksRegistry.add(value),......... |
2ff60 | 6c 6f 63 61 74 69 6f 6e 3a 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 | location:.v8Util.getHiddenValue( |
2ff80 | 76 61 6c 75 65 2c 20 27 6c 6f 63 61 74 69 6f 6e 27 29 2c 0a 20 20 20 20 20 20 20 20 6c 65 6e 67 | value,.'location'),.........leng |
2ffa0 | 74 68 3a 20 76 61 6c 75 65 2e 6c 65 6e 67 74 68 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 20 65 | th:.value.length.......}.....}.e |
2ffc0 | 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 20 20 20 20 74 79 70 | lse.{.......return.{.........typ |
2ffe0 | 65 3a 20 27 76 61 6c 75 65 27 2c 0a 20 20 20 20 20 20 20 20 76 61 6c 75 65 3a 20 76 61 6c 75 65 | e:.'value',.........value:.value |
30000 | 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 61 72 67 73 | .......}.....}...}...return.args |
30020 | 2e 6d 61 70 28 76 61 6c 75 65 54 6f 4d 65 74 61 29 0a 7d 0a 0a 2f 2f 20 50 6f 70 75 6c 61 74 65 | .map(valueToMeta).}..//.Populate |
30040 | 20 6f 62 6a 65 63 74 27 73 20 6d 65 6d 62 65 72 73 20 66 72 6f 6d 20 64 65 73 63 72 69 70 74 6f | .object's.members.from.descripto |
30060 | 72 73 2e 0a 2f 2f 20 54 68 65 20 7c 72 65 66 7c 20 77 69 6c 6c 20 62 65 20 6b 65 70 74 20 72 65 | rs..//.The.|ref|.will.be.kept.re |
30080 | 66 65 72 65 6e 63 65 64 20 62 79 20 7c 6d 65 6d 62 65 72 73 7c 2e 0a 2f 2f 20 54 68 69 73 20 6d | ferenced.by.|members|..//.This.m |
300a0 | 61 74 63 68 65 73 20 7c 67 65 74 4f 62 6a 65 63 74 4d 65 6d 65 62 65 72 73 7c 20 69 6e 20 72 70 | atches.|getObjectMemebers|.in.rp |
300c0 | 63 2d 73 65 72 76 65 72 2e 0a 66 75 6e 63 74 69 6f 6e 20 73 65 74 4f 62 6a 65 63 74 4d 65 6d 62 | c-server..function.setObjectMemb |
300e0 | 65 72 73 20 28 72 65 66 2c 20 6f 62 6a 65 63 74 2c 20 6d 65 74 61 49 64 2c 20 6d 65 6d 62 65 72 | ers.(ref,.object,.metaId,.member |
30100 | 73 29 20 7b 0a 20 20 69 66 20 28 21 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 6d 65 6d 62 65 72 | s).{...if.(!Array.isArray(member |
30120 | 73 29 29 20 72 65 74 75 72 6e 0a 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 6d 65 6d 62 65 72 20 | s)).return....for.(const.member. |
30140 | 6f 66 20 6d 65 6d 62 65 72 73 29 20 7b 0a 20 20 20 20 69 66 20 28 6f 62 6a 65 63 74 2e 68 61 73 | of.members).{.....if.(object.has |
30160 | 4f 77 6e 50 72 6f 70 65 72 74 79 28 6d 65 6d 62 65 72 2e 6e 61 6d 65 29 29 20 63 6f 6e 74 69 6e | OwnProperty(member.name)).contin |
30180 | 75 65 0a 0a 20 20 20 20 63 6f 6e 73 74 20 64 65 73 63 72 69 70 74 6f 72 20 3d 20 7b 20 65 6e 75 | ue......const.descriptor.=.{.enu |
301a0 | 6d 65 72 61 62 6c 65 3a 20 6d 65 6d 62 65 72 2e 65 6e 75 6d 65 72 61 62 6c 65 20 7d 0a 20 20 20 | merable:.member.enumerable.}.... |
301c0 | 20 69 66 20 28 6d 65 6d 62 65 72 2e 74 79 70 65 20 3d 3d 3d 20 27 6d 65 74 68 6f 64 27 29 20 7b | .if.(member.type.===.'method').{ |
301e0 | 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 6d 6f 74 65 4d 65 6d 62 65 72 46 75 6e 63 74 69 6f | .......const.remoteMemberFunctio |
30200 | 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 20 | n.=.function.(...args).{........ |
30220 | 20 6c 65 74 20 63 6f 6d 6d 61 6e 64 0a 20 20 20 20 20 20 20 20 69 66 20 28 74 68 69 73 20 26 26 | .let.command.........if.(this.&& |
30240 | 20 74 68 69 73 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 3d 3d 3d 20 72 65 6d 6f 74 65 4d 65 6d 62 | .this.constructor.===.remoteMemb |
30260 | 65 72 46 75 6e 63 74 69 6f 6e 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6d 6d 61 6e 64 20 | erFunction).{...........command. |
30280 | 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 4d 45 4d 42 45 52 5f 43 4f 4e 53 54 | =.'ELECTRON_BROWSER_MEMBER_CONST |
302a0 | 52 55 43 54 4f 52 27 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 | RUCTOR'.........}.else.{........ |
302c0 | 20 20 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 4d | ...command.=.'ELECTRON_BROWSER_M |
302e0 | 45 4d 42 45 52 5f 43 41 4c 4c 27 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 63 6f | EMBER_CALL'.........}.........co |
30300 | 6e 73 74 20 72 65 74 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 | nst.ret.=.ipcRenderer.sendSync(c |
30320 | 6f 6d 6d 61 6e 64 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 6d 65 74 61 49 64 2c 20 6d 65 6d 62 65 | ommand,.contextId,.metaId,.membe |
30340 | 72 2e 6e 61 6d 65 2c 20 77 72 61 70 41 72 67 73 28 61 72 67 73 29 29 0a 20 20 20 20 20 20 20 20 | r.name,.wrapArgs(args))......... |
30360 | 72 65 74 75 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 72 65 74 29 0a 20 20 20 20 20 20 7d 0a | return.metaToValue(ret).......}. |
30380 | 0a 20 20 20 20 20 20 6c 65 74 20 64 65 73 63 72 69 70 74 6f 72 46 75 6e 63 74 69 6f 6e 20 3d 20 | .......let.descriptorFunction.=. |
303a0 | 70 72 6f 78 79 46 75 6e 63 74 69 6f 6e 50 72 6f 70 65 72 74 69 65 73 28 72 65 6d 6f 74 65 4d 65 | proxyFunctionProperties(remoteMe |
303c0 | 6d 62 65 72 46 75 6e 63 74 69 6f 6e 2c 20 6d 65 74 61 49 64 2c 20 6d 65 6d 62 65 72 2e 6e 61 6d | mberFunction,.metaId,.member.nam |
303e0 | 65 29 0a 0a 20 20 20 20 20 20 64 65 73 63 72 69 70 74 6f 72 2e 67 65 74 20 3d 20 28 29 20 3d 3e | e)........descriptor.get.=.().=> |
30400 | 20 7b 0a 20 20 20 20 20 20 20 20 64 65 73 63 72 69 70 74 6f 72 46 75 6e 63 74 69 6f 6e 2e 72 65 | .{.........descriptorFunction.re |
30420 | 66 20 3d 20 72 65 66 20 2f 2f 20 54 68 65 20 6d 65 6d 62 65 72 20 73 68 6f 75 6c 64 20 72 65 66 | f.=.ref.//.The.member.should.ref |
30440 | 65 72 65 6e 63 65 20 69 74 73 20 6f 62 6a 65 63 74 2e 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 | erence.its.object..........retur |
30460 | 6e 20 64 65 73 63 72 69 70 74 6f 72 46 75 6e 63 74 69 6f 6e 0a 20 20 20 20 20 20 7d 0a 20 20 20 | n.descriptorFunction.......}.... |
30480 | 20 20 20 2f 2f 20 45 6e 61 62 6c 65 20 6d 6f 6e 6b 65 79 2d 70 61 74 63 68 20 74 68 65 20 6d 65 | ...//.Enable.monkey-patch.the.me |
304a0 | 74 68 6f 64 0a 20 20 20 20 20 20 64 65 73 63 72 69 70 74 6f 72 2e 73 65 74 20 3d 20 28 76 61 6c | thod.......descriptor.set.=.(val |
304c0 | 75 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 64 65 73 63 72 69 70 74 6f 72 46 75 6e 63 74 | ue).=>.{.........descriptorFunct |
304e0 | 69 6f 6e 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 76 61 6c 75 65 | ion.=.value.........return.value |
30500 | 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 64 65 73 63 72 69 70 74 6f 72 2e 63 6f 6e 66 69 67 | .......}.......descriptor.config |
30520 | 75 72 61 62 6c 65 20 3d 20 74 72 75 65 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 6d 65 6d | urable.=.true.....}.else.if.(mem |
30540 | 62 65 72 2e 74 79 70 65 20 3d 3d 3d 20 27 67 65 74 27 29 20 7b 0a 20 20 20 20 20 20 64 65 73 63 | ber.type.===.'get').{.......desc |
30560 | 72 69 70 74 6f 72 2e 67 65 74 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e | riptor.get.=.().=>.{.........con |
30580 | 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 4d | st.command.=.'ELECTRON_BROWSER_M |
305a0 | 45 4d 42 45 52 5f 47 45 54 27 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d 20 | EMBER_GET'.........const.meta.=. |
305c0 | 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 63 6f | ipcRenderer.sendSync(command,.co |
305e0 | 6e 74 65 78 74 49 64 2c 20 6d 65 74 61 49 64 2c 20 6d 65 6d 62 65 72 2e 6e 61 6d 65 29 0a 20 20 | ntextId,.metaId,.member.name)... |
30600 | 20 20 20 20 20 20 72 65 74 75 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 61 29 0a 20 | ......return.metaToValue(meta).. |
30620 | 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 69 66 20 28 6d 65 6d 62 65 72 2e 77 72 69 74 61 62 6c | .....}........if.(member.writabl |
30640 | 65 29 20 7b 0a 20 20 20 20 20 20 20 20 64 65 73 63 72 69 70 74 6f 72 2e 73 65 74 20 3d 20 28 76 | e).{.........descriptor.set.=.(v |
30660 | 61 6c 75 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 61 72 67 73 20 | alue).=>.{...........const.args. |
30680 | 3d 20 77 72 61 70 41 72 67 73 28 5b 76 61 6c 75 65 5d 29 0a 20 20 20 20 20 20 20 20 20 20 63 6f | =.wrapArgs([value])...........co |
306a0 | 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f | nst.command.=.'ELECTRON_BROWSER_ |
306c0 | 4d 45 4d 42 45 52 5f 53 45 54 27 0a 20 20 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 6d 65 74 61 | MEMBER_SET'...........const.meta |
306e0 | 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c | .=.ipcRenderer.sendSync(command, |
30700 | 20 63 6f 6e 74 65 78 74 49 64 2c 20 6d 65 74 61 49 64 2c 20 6d 65 6d 62 65 72 2e 6e 61 6d 65 2c | .contextId,.metaId,.member.name, |
30720 | 20 61 72 67 73 29 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 28 6d 65 74 61 20 21 3d 20 6e 75 6c | .args)...........if.(meta.!=.nul |
30740 | 6c 29 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 61 29 0a 20 20 20 20 20 20 20 20 20 20 72 | l).metaToValue(meta)...........r |
30760 | 65 74 75 72 6e 20 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 0a 20 20 | eturn.value.........}.......}... |
30780 | 20 20 7d 0a 0a 20 20 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 6f | ..}......Object.defineProperty(o |
307a0 | 62 6a 65 63 74 2c 20 6d 65 6d 62 65 72 2e 6e 61 6d 65 2c 20 64 65 73 63 72 69 70 74 6f 72 29 0a | bject,.member.name,.descriptor). |
307c0 | 20 20 7d 0a 7d 0a 0a 2f 2f 20 50 6f 70 75 6c 61 74 65 20 6f 62 6a 65 63 74 27 73 20 70 72 6f 74 | ..}.}..//.Populate.object's.prot |
307e0 | 6f 74 79 70 65 20 66 72 6f 6d 20 64 65 73 63 72 69 70 74 6f 72 2e 0a 2f 2f 20 54 68 69 73 20 6d | otype.from.descriptor..//.This.m |
30800 | 61 74 63 68 65 73 20 7c 67 65 74 4f 62 6a 65 63 74 50 72 6f 74 6f 74 79 70 65 7c 20 69 6e 20 72 | atches.|getObjectPrototype|.in.r |
30820 | 70 63 2d 73 65 72 76 65 72 2e 0a 66 75 6e 63 74 69 6f 6e 20 73 65 74 4f 62 6a 65 63 74 50 72 6f | pc-server..function.setObjectPro |
30840 | 74 6f 74 79 70 65 20 28 72 65 66 2c 20 6f 62 6a 65 63 74 2c 20 6d 65 74 61 49 64 2c 20 64 65 73 | totype.(ref,.object,.metaId,.des |
30860 | 63 72 69 70 74 6f 72 29 20 7b 0a 20 20 69 66 20 28 64 65 73 63 72 69 70 74 6f 72 20 3d 3d 3d 20 | criptor).{...if.(descriptor.===. |
30880 | 6e 75 6c 6c 29 20 72 65 74 75 72 6e 0a 20 20 63 6f 6e 73 74 20 70 72 6f 74 6f 20 3d 20 7b 7d 0a | null).return...const.proto.=.{}. |
308a0 | 20 20 73 65 74 4f 62 6a 65 63 74 4d 65 6d 62 65 72 73 28 72 65 66 2c 20 70 72 6f 74 6f 2c 20 6d | ..setObjectMembers(ref,.proto,.m |
308c0 | 65 74 61 49 64 2c 20 64 65 73 63 72 69 70 74 6f 72 2e 6d 65 6d 62 65 72 73 29 0a 20 20 73 65 74 | etaId,.descriptor.members)...set |
308e0 | 4f 62 6a 65 63 74 50 72 6f 74 6f 74 79 70 65 28 72 65 66 2c 20 70 72 6f 74 6f 2c 20 6d 65 74 61 | ObjectPrototype(ref,.proto,.meta |
30900 | 49 64 2c 20 64 65 73 63 72 69 70 74 6f 72 2e 70 72 6f 74 6f 29 0a 20 20 4f 62 6a 65 63 74 2e 73 | Id,.descriptor.proto)...Object.s |
30920 | 65 74 50 72 6f 74 6f 74 79 70 65 4f 66 28 6f 62 6a 65 63 74 2c 20 70 72 6f 74 6f 29 0a 7d 0a 0a | etPrototypeOf(object,.proto).}.. |
30940 | 2f 2f 20 57 72 61 70 20 66 75 6e 63 74 69 6f 6e 20 69 6e 20 50 72 6f 78 79 20 66 6f 72 20 61 63 | //.Wrap.function.in.Proxy.for.ac |
30960 | 63 65 73 73 69 6e 67 20 72 65 6d 6f 74 65 20 70 72 6f 70 65 72 74 69 65 73 0a 66 75 6e 63 74 69 | cessing.remote.properties.functi |
30980 | 6f 6e 20 70 72 6f 78 79 46 75 6e 63 74 69 6f 6e 50 72 6f 70 65 72 74 69 65 73 20 28 72 65 6d 6f | on.proxyFunctionProperties.(remo |
309a0 | 74 65 4d 65 6d 62 65 72 46 75 6e 63 74 69 6f 6e 2c 20 6d 65 74 61 49 64 2c 20 6e 61 6d 65 29 20 | teMemberFunction,.metaId,.name). |
309c0 | 7b 0a 20 20 6c 65 74 20 6c 6f 61 64 65 64 20 3d 20 66 61 6c 73 65 0a 0a 20 20 2f 2f 20 4c 61 7a | {...let.loaded.=.false....//.Laz |
309e0 | 69 6c 79 20 6c 6f 61 64 20 66 75 6e 63 74 69 6f 6e 20 70 72 6f 70 65 72 74 69 65 73 0a 20 20 63 | ily.load.function.properties...c |
30a00 | 6f 6e 73 74 20 6c 6f 61 64 52 65 6d 6f 74 65 50 72 6f 70 65 72 74 69 65 73 20 3d 20 28 29 20 3d | onst.loadRemoteProperties.=.().= |
30a20 | 3e 20 7b 0a 20 20 20 20 69 66 20 28 6c 6f 61 64 65 64 29 20 72 65 74 75 72 6e 0a 20 20 20 20 6c | >.{.....if.(loaded).return.....l |
30a40 | 6f 61 64 65 64 20 3d 20 74 72 75 65 0a 20 20 20 20 63 6f 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d | oaded.=.true.....const.command.= |
30a60 | 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 4d 45 4d 42 45 52 5f 47 45 54 27 0a 20 | .'ELECTRON_BROWSER_MEMBER_GET'.. |
30a80 | 20 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 | ...const.meta.=.ipcRenderer.send |
30aa0 | 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 6d 65 74 61 49 64 2c | Sync(command,.contextId,.metaId, |
30ac0 | 20 6e 61 6d 65 29 0a 20 20 20 20 73 65 74 4f 62 6a 65 63 74 4d 65 6d 62 65 72 73 28 72 65 6d 6f | .name).....setObjectMembers(remo |
30ae0 | 74 65 4d 65 6d 62 65 72 46 75 6e 63 74 69 6f 6e 2c 20 72 65 6d 6f 74 65 4d 65 6d 62 65 72 46 75 | teMemberFunction,.remoteMemberFu |
30b00 | 6e 63 74 69 6f 6e 2c 20 6d 65 74 61 2e 69 64 2c 20 6d 65 74 61 2e 6d 65 6d 62 65 72 73 29 0a 20 | nction,.meta.id,.meta.members).. |
30b20 | 20 7d 0a 0a 20 20 72 65 74 75 72 6e 20 6e 65 77 20 50 72 6f 78 79 28 72 65 6d 6f 74 65 4d 65 6d | .}....return.new.Proxy(remoteMem |
30b40 | 62 65 72 46 75 6e 63 74 69 6f 6e 2c 20 7b 0a 20 20 20 20 73 65 74 3a 20 28 74 61 72 67 65 74 2c | berFunction,.{.....set:.(target, |
30b60 | 20 70 72 6f 70 65 72 74 79 2c 20 76 61 6c 75 65 2c 20 72 65 63 65 69 76 65 72 29 20 3d 3e 20 7b | .property,.value,.receiver).=>.{ |
30b80 | 0a 20 20 20 20 20 20 69 66 20 28 70 72 6f 70 65 72 74 79 20 21 3d 3d 20 27 72 65 66 27 29 20 6c | .......if.(property.!==.'ref').l |
30ba0 | 6f 61 64 52 65 6d 6f 74 65 50 72 6f 70 65 72 74 69 65 73 28 29 0a 20 20 20 20 20 20 74 61 72 67 | oadRemoteProperties().......targ |
30bc0 | 65 74 5b 70 72 6f 70 65 72 74 79 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 20 20 72 65 74 75 72 | et[property].=.value.......retur |
30be0 | 6e 20 74 72 75 65 0a 20 20 20 20 7d 2c 0a 20 20 20 20 67 65 74 3a 20 28 74 61 72 67 65 74 2c 20 | n.true.....},.....get:.(target,. |
30c00 | 70 72 6f 70 65 72 74 79 2c 20 72 65 63 65 69 76 65 72 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 69 | property,.receiver).=>.{.......i |
30c20 | 66 20 28 21 74 61 72 67 65 74 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 70 72 6f 70 65 72 | f.(!target.hasOwnProperty(proper |
30c40 | 74 79 29 29 20 6c 6f 61 64 52 65 6d 6f 74 65 50 72 6f 70 65 72 74 69 65 73 28 29 0a 20 20 20 20 | ty)).loadRemoteProperties()..... |
30c60 | 20 20 63 6f 6e 73 74 20 76 61 6c 75 65 20 3d 20 74 61 72 67 65 74 5b 70 72 6f 70 65 72 74 79 5d | ..const.value.=.target[property] |
30c80 | 0a 20 20 20 20 20 20 69 66 20 28 70 72 6f 70 65 72 74 79 20 3d 3d 3d 20 27 74 6f 53 74 72 69 6e | .......if.(property.===.'toStrin |
30ca0 | 67 27 20 26 26 20 74 79 70 65 6f 66 20 76 61 6c 75 65 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e | g'.&&.typeof.value.===.'function |
30cc0 | 27 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 76 61 6c 75 65 2e 62 69 6e 64 28 74 | ').{.........return.value.bind(t |
30ce0 | 61 72 67 65 74 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 76 61 6c 75 | arget).......}.......return.valu |
30d00 | 65 0a 20 20 20 20 7d 2c 0a 20 20 20 20 6f 77 6e 4b 65 79 73 3a 20 28 74 61 72 67 65 74 29 20 3d | e.....},.....ownKeys:.(target).= |
30d20 | 3e 20 7b 0a 20 20 20 20 20 20 6c 6f 61 64 52 65 6d 6f 74 65 50 72 6f 70 65 72 74 69 65 73 28 29 | >.{.......loadRemoteProperties() |
30d40 | 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 65 | .......return.Object.getOwnPrope |
30d60 | 72 74 79 4e 61 6d 65 73 28 74 61 72 67 65 74 29 0a 20 20 20 20 7d 2c 0a 20 20 20 20 67 65 74 4f | rtyNames(target).....},.....getO |
30d80 | 77 6e 50 72 6f 70 65 72 74 79 44 65 73 63 72 69 70 74 6f 72 3a 20 28 74 61 72 67 65 74 2c 20 70 | wnPropertyDescriptor:.(target,.p |
30da0 | 72 6f 70 65 72 74 79 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 64 65 73 63 72 69 | roperty).=>.{.......const.descri |
30dc0 | 70 74 6f 72 20 3d 20 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 44 65 73 63 | ptor.=.Object.getOwnPropertyDesc |
30de0 | 72 69 70 74 6f 72 28 74 61 72 67 65 74 2c 20 70 72 6f 70 65 72 74 79 29 0a 20 20 20 20 20 20 69 | riptor(target,.property).......i |
30e00 | 66 20 28 64 65 73 63 72 69 70 74 6f 72 29 20 72 65 74 75 72 6e 20 64 65 73 63 72 69 70 74 6f 72 | f.(descriptor).return.descriptor |
30e20 | 0a 20 20 20 20 20 20 6c 6f 61 64 52 65 6d 6f 74 65 50 72 6f 70 65 72 74 69 65 73 28 29 0a 20 20 | .......loadRemoteProperties()... |
30e40 | 20 20 20 20 72 65 74 75 72 6e 20 4f 62 6a 65 63 74 2e 67 65 74 4f 77 6e 50 72 6f 70 65 72 74 79 | ....return.Object.getOwnProperty |
30e60 | 44 65 73 63 72 69 70 74 6f 72 28 74 61 72 67 65 74 2c 20 70 72 6f 70 65 72 74 79 29 0a 20 20 20 | Descriptor(target,.property).... |
30e80 | 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 2f 2f 20 43 6f 6e 76 65 72 74 20 6d 65 74 61 20 64 61 74 61 20 | .}...}).}..//.Convert.meta.data. |
30ea0 | 66 72 6f 6d 20 62 72 6f 77 73 65 72 20 69 6e 74 6f 20 72 65 61 6c 20 76 61 6c 75 65 2e 0a 66 75 | from.browser.into.real.value..fu |
30ec0 | 6e 63 74 69 6f 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 20 28 6d 65 74 61 29 20 7b 0a 20 20 63 6f | nction.metaToValue.(meta).{...co |
30ee0 | 6e 73 74 20 74 79 70 65 73 20 3d 20 7b 0a 20 20 20 20 76 61 6c 75 65 3a 20 28 29 20 3d 3e 20 6d | nst.types.=.{.....value:.().=>.m |
30f00 | 65 74 61 2e 76 61 6c 75 65 2c 0a 20 20 20 20 61 72 72 61 79 3a 20 28 29 20 3d 3e 20 6d 65 74 61 | eta.value,.....array:.().=>.meta |
30f20 | 2e 6d 65 6d 62 65 72 73 2e 6d 61 70 28 28 6d 65 6d 62 65 72 29 20 3d 3e 20 6d 65 74 61 54 6f 56 | .members.map((member).=>.metaToV |
30f40 | 61 6c 75 65 28 6d 65 6d 62 65 72 29 29 2c 0a 20 20 20 20 62 75 66 66 65 72 3a 20 28 29 20 3d 3e | alue(member)),.....buffer:.().=> |
30f60 | 20 62 75 66 66 65 72 55 74 69 6c 73 2e 6d 65 74 61 54 6f 42 75 66 66 65 72 28 6d 65 74 61 2e 76 | .bufferUtils.metaToBuffer(meta.v |
30f80 | 61 6c 75 65 29 2c 0a 20 20 20 20 70 72 6f 6d 69 73 65 3a 20 28 29 20 3d 3e 20 72 65 73 6f 6c 76 | alue),.....promise:.().=>.resolv |
30fa0 | 65 50 72 6f 6d 69 73 65 28 7b 20 74 68 65 6e 3a 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 | ePromise({.then:.metaToValue(met |
30fc0 | 61 2e 74 68 65 6e 29 20 7d 29 2c 0a 20 20 20 20 65 72 72 6f 72 3a 20 28 29 20 3d 3e 20 6d 65 74 | a.then).}),.....error:.().=>.met |
30fe0 | 61 54 6f 50 6c 61 69 6e 4f 62 6a 65 63 74 28 6d 65 74 61 29 2c 0a 20 20 20 20 64 61 74 65 3a 20 | aToPlainObject(meta),.....date:. |
31000 | 28 29 20 3d 3e 20 6e 65 77 20 44 61 74 65 28 6d 65 74 61 2e 76 61 6c 75 65 29 2c 0a 20 20 20 20 | ().=>.new.Date(meta.value),..... |
31020 | 65 78 63 65 70 74 69 6f 6e 3a 20 28 29 20 3d 3e 20 7b 20 74 68 72 6f 77 20 65 72 72 6f 72 55 74 | exception:.().=>.{.throw.errorUt |
31040 | 69 6c 73 2e 64 65 73 65 72 69 61 6c 69 7a 65 28 6d 65 74 61 2e 76 61 6c 75 65 29 20 7d 0a 20 20 | ils.deserialize(meta.value).}... |
31060 | 7d 0a 0a 20 20 69 66 20 28 6d 65 74 61 2e 74 79 70 65 20 69 6e 20 74 79 70 65 73 29 20 7b 0a 20 | }....if.(meta.type.in.types).{.. |
31080 | 20 20 20 72 65 74 75 72 6e 20 74 79 70 65 73 5b 6d 65 74 61 2e 74 79 70 65 5d 28 29 0a 20 20 7d | ...return.types[meta.type]()...} |
310a0 | 20 65 6c 73 65 20 7b 0a 20 20 20 20 6c 65 74 20 72 65 74 0a 20 20 20 20 69 66 20 28 72 65 6d 6f | .else.{.....let.ret.....if.(remo |
310c0 | 74 65 4f 62 6a 65 63 74 43 61 63 68 65 2e 68 61 73 28 6d 65 74 61 2e 69 64 29 29 20 7b 0a 20 20 | teObjectCache.has(meta.id)).{... |
310e0 | 20 20 20 20 72 65 74 75 72 6e 20 72 65 6d 6f 74 65 4f 62 6a 65 63 74 43 61 63 68 65 2e 67 65 74 | ....return.remoteObjectCache.get |
31100 | 28 6d 65 74 61 2e 69 64 29 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 41 20 73 68 61 64 6f 77 | (meta.id).....}......//.A.shadow |
31120 | 20 63 6c 61 73 73 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 74 68 65 20 72 65 6d 6f 74 65 20 66 | .class.to.represent.the.remote.f |
31140 | 75 6e 63 74 69 6f 6e 20 6f 62 6a 65 63 74 2e 0a 20 20 20 20 69 66 20 28 6d 65 74 61 2e 74 79 70 | unction.object......if.(meta.typ |
31160 | 65 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 | e.===.'function').{.......const. |
31180 | 72 65 6d 6f 74 65 46 75 6e 63 74 69 6f 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 | remoteFunction.=.function.(...ar |
311a0 | 67 73 29 20 7b 0a 20 20 20 20 20 20 20 20 6c 65 74 20 63 6f 6d 6d 61 6e 64 0a 20 20 20 20 20 20 | gs).{.........let.command....... |
311c0 | 20 20 69 66 20 28 74 68 69 73 20 26 26 20 74 68 69 73 2e 63 6f 6e 73 74 72 75 63 74 6f 72 20 3d | ..if.(this.&&.this.constructor.= |
311e0 | 3d 3d 20 72 65 6d 6f 74 65 46 75 6e 63 74 69 6f 6e 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 63 | ==.remoteFunction).{...........c |
31200 | 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 43 4f 4e 53 54 | ommand.=.'ELECTRON_BROWSER_CONST |
31220 | 52 55 43 54 4f 52 27 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 | RUCTOR'.........}.else.{........ |
31240 | 20 20 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 46 | ...command.=.'ELECTRON_BROWSER_F |
31260 | 55 4e 43 54 49 4f 4e 5f 43 41 4c 4c 27 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 | UNCTION_CALL'.........}......... |
31280 | 63 6f 6e 73 74 20 6f 62 6a 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 | const.obj.=.ipcRenderer.sendSync |
312a0 | 28 63 6f 6d 6d 61 6e 64 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 6d 65 74 61 2e 69 64 2c 20 77 72 | (command,.contextId,.meta.id,.wr |
312c0 | 61 70 41 72 67 73 28 61 72 67 73 29 29 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6d 65 74 | apArgs(args)).........return.met |
312e0 | 61 54 6f 56 61 6c 75 65 28 6f 62 6a 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 72 65 74 20 | aToValue(obj).......}.......ret. |
31300 | 3d 20 72 65 6d 6f 74 65 46 75 6e 63 74 69 6f 6e 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 | =.remoteFunction.....}.else.{... |
31320 | 20 20 20 20 72 65 74 20 3d 20 7b 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 73 65 74 4f 62 6a 65 63 | ....ret.=.{}.....}......setObjec |
31340 | 74 4d 65 6d 62 65 72 73 28 72 65 74 2c 20 72 65 74 2c 20 6d 65 74 61 2e 69 64 2c 20 6d 65 74 61 | tMembers(ret,.ret,.meta.id,.meta |
31360 | 2e 6d 65 6d 62 65 72 73 29 0a 20 20 20 20 73 65 74 4f 62 6a 65 63 74 50 72 6f 74 6f 74 79 70 65 | .members).....setObjectPrototype |
31380 | 28 72 65 74 2c 20 72 65 74 2c 20 6d 65 74 61 2e 69 64 2c 20 6d 65 74 61 2e 70 72 6f 74 6f 29 0a | (ret,.ret,.meta.id,.meta.proto). |
313a0 | 20 20 20 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 72 65 74 2e 63 6f | ....Object.defineProperty(ret.co |
313c0 | 6e 73 74 72 75 63 74 6f 72 2c 20 27 6e 61 6d 65 27 2c 20 7b 20 76 61 6c 75 65 3a 20 6d 65 74 61 | nstructor,.'name',.{.value:.meta |
313e0 | 2e 6e 61 6d 65 20 7d 29 0a 0a 20 20 20 20 2f 2f 20 54 72 61 63 6b 20 64 65 6c 65 67 61 74 65 20 | .name.})......//.Track.delegate. |
31400 | 6f 62 6a 27 73 20 6c 69 66 65 74 69 6d 65 20 26 20 74 65 6c 6c 20 62 72 6f 77 73 65 72 20 74 6f | obj's.lifetime.&.tell.browser.to |
31420 | 20 63 6c 65 61 6e 20 75 70 20 77 68 65 6e 20 6f 62 6a 65 63 74 20 69 73 20 47 43 65 64 2e 0a 20 | .clean.up.when.object.is.GCed... |
31440 | 20 20 20 76 38 55 74 69 6c 2e 73 65 74 52 65 6d 6f 74 65 4f 62 6a 65 63 74 46 72 65 65 72 28 72 | ...v8Util.setRemoteObjectFreer(r |
31460 | 65 74 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 6d 65 74 61 2e 69 64 29 0a 20 20 20 20 76 38 55 74 | et,.contextId,.meta.id).....v8Ut |
31480 | 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 72 65 74 2c 20 27 61 74 6f 6d 49 64 27 2c | il.setHiddenValue(ret,.'atomId', |
314a0 | 20 6d 65 74 61 2e 69 64 29 0a 20 20 20 20 72 65 6d 6f 74 65 4f 62 6a 65 63 74 43 61 63 68 65 2e | .meta.id).....remoteObjectCache. |
314c0 | 73 65 74 28 6d 65 74 61 2e 69 64 2c 20 72 65 74 29 0a 20 20 20 20 72 65 74 75 72 6e 20 72 65 74 | set(meta.id,.ret).....return.ret |
314e0 | 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 43 6f 6e 73 74 72 75 63 74 20 61 20 70 6c 61 69 6e 20 6f 62 6a | ...}.}..//.Construct.a.plain.obj |
31500 | 65 63 74 20 66 72 6f 6d 20 74 68 65 20 6d 65 74 61 2e 0a 66 75 6e 63 74 69 6f 6e 20 6d 65 74 61 | ect.from.the.meta..function.meta |
31520 | 54 6f 50 6c 61 69 6e 4f 62 6a 65 63 74 20 28 6d 65 74 61 29 20 7b 0a 20 20 63 6f 6e 73 74 20 6f | ToPlainObject.(meta).{...const.o |
31540 | 62 6a 20 3d 20 28 28 29 20 3d 3e 20 6d 65 74 61 2e 74 79 70 65 20 3d 3d 3d 20 27 65 72 72 6f 72 | bj.=.(().=>.meta.type.===.'error |
31560 | 27 20 3f 20 6e 65 77 20 45 72 72 6f 72 28 29 20 3a 20 7b 7d 29 28 29 0a 20 20 66 6f 72 20 28 6c | '.?.new.Error().:.{})()...for.(l |
31580 | 65 74 20 69 20 3d 20 30 3b 20 69 20 3c 20 6d 65 74 61 2e 6d 65 6d 62 65 72 73 2e 6c 65 6e 67 74 | et.i.=.0;.i.<.meta.members.lengt |
315a0 | 68 3b 20 69 2b 2b 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 7b 20 6e 61 6d 65 2c 20 76 61 6c 75 | h;.i++).{.....const.{.name,.valu |
315c0 | 65 20 7d 20 3d 20 6d 65 74 61 2e 6d 65 6d 62 65 72 73 5b 69 5d 0a 20 20 20 20 6f 62 6a 5b 6e 61 | e.}.=.meta.members[i].....obj[na |
315e0 | 6d 65 5d 20 3d 20 76 61 6c 75 65 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 6f 62 6a 0a 7d 0a 0a | me].=.value...}...return.obj.}.. |
31600 | 66 75 6e 63 74 69 6f 6e 20 68 61 6e 64 6c 65 4d 65 73 73 61 67 65 20 28 63 68 61 6e 6e 65 6c 2c | function.handleMessage.(channel, |
31620 | 20 68 61 6e 64 6c 65 72 29 20 7b 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 63 68 61 | .handler).{...ipcRenderer.on(cha |
31640 | 6e 6e 65 6c 2c 20 28 65 76 65 6e 74 2c 20 70 61 73 73 65 64 43 6f 6e 74 65 78 74 49 64 2c 20 69 | nnel,.(event,.passedContextId,.i |
31660 | 64 2c 20 2e 2e 2e 61 72 67 73 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 70 61 73 73 65 64 43 | d,....args).=>.{.....if.(passedC |
31680 | 6f 6e 74 65 78 74 49 64 20 3d 3d 3d 20 63 6f 6e 74 65 78 74 49 64 29 20 7b 0a 20 20 20 20 20 20 | ontextId.===.contextId).{....... |
316a0 | 68 61 6e 64 6c 65 72 28 69 64 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 | handler(id,....args).....}.else. |
316c0 | 7b 0a 20 20 20 20 20 20 2f 2f 20 4d 65 73 73 61 67 65 20 73 65 6e 74 20 74 6f 20 61 6e 20 75 6e | {.......//.Message.sent.to.an.un |
316e0 | 2d 65 78 69 73 74 20 63 6f 6e 74 65 78 74 2c 20 6e 6f 74 69 66 79 20 74 68 65 20 65 72 72 6f 72 | -exist.context,.notify.the.error |
31700 | 20 74 6f 20 6d 61 69 6e 20 70 72 6f 63 65 73 73 2e 0a 20 20 20 20 20 20 69 70 63 52 65 6e 64 65 | .to.main.process........ipcRende |
31720 | 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 57 52 4f 4e 47 | rer.send('ELECTRON_BROWSER_WRONG |
31740 | 5f 43 4f 4e 54 45 58 54 5f 45 52 52 4f 52 27 2c 20 63 6f 6e 74 65 78 74 49 64 2c 20 70 61 73 73 | _CONTEXT_ERROR',.contextId,.pass |
31760 | 65 64 43 6f 6e 74 65 78 74 49 64 2c 20 69 64 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 2f | edContextId,.id).....}...}).}../ |
31780 | 2f 20 42 72 6f 77 73 65 72 20 63 61 6c 6c 73 20 61 20 63 61 6c 6c 62 61 63 6b 20 69 6e 20 72 65 | /.Browser.calls.a.callback.in.re |
317a0 | 6e 64 65 72 65 72 2e 0a 68 61 6e 64 6c 65 4d 65 73 73 61 67 65 28 27 45 4c 45 43 54 52 4f 4e 5f | nderer..handleMessage('ELECTRON_ |
317c0 | 52 45 4e 44 45 52 45 52 5f 43 41 4c 4c 42 41 43 4b 27 2c 20 28 69 64 2c 20 61 72 67 73 29 20 3d | RENDERER_CALLBACK',.(id,.args).= |
317e0 | 3e 20 7b 0a 20 20 63 61 6c 6c 62 61 63 6b 73 52 65 67 69 73 74 72 79 2e 61 70 70 6c 79 28 69 64 | >.{...callbacksRegistry.apply(id |
31800 | 2c 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 61 72 67 73 29 29 0a 7d 29 0a 0a 2f 2f 20 41 20 63 61 | ,.metaToValue(args)).})..//.A.ca |
31820 | 6c 6c 62 61 63 6b 20 69 6e 20 62 72 6f 77 73 65 72 20 69 73 20 72 65 6c 65 61 73 65 64 2e 0a 68 | llback.in.browser.is.released..h |
31840 | 61 6e 64 6c 65 4d 65 73 73 61 67 65 28 27 45 4c 45 43 54 52 4f 4e 5f 52 45 4e 44 45 52 45 52 5f | andleMessage('ELECTRON_RENDERER_ |
31860 | 52 45 4c 45 41 53 45 5f 43 41 4c 4c 42 41 43 4b 27 2c 20 28 69 64 29 20 3d 3e 20 7b 0a 20 20 63 | RELEASE_CALLBACK',.(id).=>.{...c |
31880 | 61 6c 6c 62 61 63 6b 73 52 65 67 69 73 74 72 79 2e 72 65 6d 6f 76 65 28 69 64 29 0a 7d 29 0a 0a | allbacksRegistry.remove(id).}).. |
318a0 | 65 78 70 6f 72 74 73 2e 72 65 71 75 69 72 65 20 3d 20 28 6d 6f 64 75 6c 65 29 20 3d 3e 20 7b 0a | exports.require.=.(module).=>.{. |
318c0 | 20 20 63 6f 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 | ..const.command.=.'ELECTRON_BROW |
318e0 | 53 45 52 5f 52 45 51 55 49 52 45 27 0a 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d 20 69 70 63 52 | SER_REQUIRE'...const.meta.=.ipcR |
31900 | 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 63 6f 6e 74 65 78 | enderer.sendSync(command,.contex |
31920 | 74 49 64 2c 20 6d 6f 64 75 6c 65 29 0a 20 20 72 65 74 75 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 | tId,.module)...return.metaToValu |
31940 | 65 28 6d 65 74 61 29 0a 7d 0a 0a 2f 2f 20 41 6c 69 61 73 20 74 6f 20 72 65 6d 6f 74 65 2e 72 65 | e(meta).}..//.Alias.to.remote.re |
31960 | 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 2e 78 78 78 2e 0a 65 78 70 6f 72 74 73 2e 67 | quire('electron').xxx..exports.g |
31980 | 65 74 42 75 69 6c 74 69 6e 20 3d 20 28 6d 6f 64 75 6c 65 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 | etBuiltin.=.(module).=>.{...cons |
319a0 | 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 47 45 | t.command.=.'ELECTRON_BROWSER_GE |
319c0 | 54 5f 42 55 49 4c 54 49 4e 27 0a 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d 20 69 70 63 52 65 6e | T_BUILTIN'...const.meta.=.ipcRen |
319e0 | 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 63 6f 6e 74 65 78 74 49 | derer.sendSync(command,.contextI |
31a00 | 64 2c 20 6d 6f 64 75 6c 65 29 0a 20 20 72 65 74 75 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 | d,.module)...return.metaToValue( |
31a20 | 6d 65 74 61 29 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 67 65 74 43 75 72 72 65 6e 74 57 69 6e 64 6f | meta).}..exports.getCurrentWindo |
31a40 | 77 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 | w.=.().=>.{...const.command.=.'E |
31a60 | 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 43 55 52 52 45 4e 54 5f 57 49 4e 44 4f 57 27 0a | LECTRON_BROWSER_CURRENT_WINDOW'. |
31a80 | 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 | ..const.meta.=.ipcRenderer.sendS |
31aa0 | 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 63 6f 6e 74 65 78 74 49 64 29 0a 20 20 72 65 74 75 72 6e | ync(command,.contextId)...return |
31ac0 | 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 61 29 0a 7d 0a 0a 2f 2f 20 47 65 74 20 63 75 72 | .metaToValue(meta).}..//.Get.cur |
31ae0 | 72 65 6e 74 20 57 65 62 43 6f 6e 74 65 6e 74 73 20 6f 62 6a 65 63 74 2e 0a 65 78 70 6f 72 74 73 | rent.WebContents.object..exports |
31b00 | 2e 67 65 74 43 75 72 72 65 6e 74 57 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 28 29 20 3d 3e 20 7b | .getCurrentWebContents.=.().=>.{ |
31b20 | 0a 20 20 72 65 74 75 72 6e 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 69 70 63 52 65 6e 64 65 72 65 | ...return.metaToValue(ipcRendere |
31b40 | 72 2e 73 65 6e 64 53 79 6e 63 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 43 55 52 | r.sendSync('ELECTRON_BROWSER_CUR |
31b60 | 52 45 4e 54 5f 57 45 42 5f 43 4f 4e 54 45 4e 54 53 27 2c 20 63 6f 6e 74 65 78 74 49 64 29 29 0a | RENT_WEB_CONTENTS',.contextId)). |
31b80 | 7d 0a 0a 2f 2f 20 47 65 74 20 61 20 67 6c 6f 62 61 6c 20 6f 62 6a 65 63 74 20 69 6e 20 62 72 6f | }..//.Get.a.global.object.in.bro |
31ba0 | 77 73 65 72 2e 0a 65 78 70 6f 72 74 73 2e 67 65 74 47 6c 6f 62 61 6c 20 3d 20 28 6e 61 6d 65 29 | wser..exports.getGlobal.=.(name) |
31bc0 | 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 63 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f | .=>.{...const.command.=.'ELECTRO |
31be0 | 4e 5f 42 52 4f 57 53 45 52 5f 47 4c 4f 42 41 4c 27 0a 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d | N_BROWSER_GLOBAL'...const.meta.= |
31c00 | 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 63 | .ipcRenderer.sendSync(command,.c |
31c20 | 6f 6e 74 65 78 74 49 64 2c 20 6e 61 6d 65 29 0a 20 20 72 65 74 75 72 6e 20 6d 65 74 61 54 6f 56 | ontextId,.name)...return.metaToV |
31c40 | 61 6c 75 65 28 6d 65 74 61 29 0a 7d 0a 0a 2f 2f 20 47 65 74 20 74 68 65 20 70 72 6f 63 65 73 73 | alue(meta).}..//.Get.the.process |
31c60 | 20 6f 62 6a 65 63 74 20 69 6e 20 62 72 6f 77 73 65 72 2e 0a 65 78 70 6f 72 74 73 2e 5f 5f 64 65 | .object.in.browser..exports.__de |
31c80 | 66 69 6e 65 47 65 74 74 65 72 5f 5f 28 27 70 72 6f 63 65 73 73 27 2c 20 28 29 20 3d 3e 20 65 78 | fineGetter__('process',.().=>.ex |
31ca0 | 70 6f 72 74 73 2e 67 65 74 47 6c 6f 62 61 6c 28 27 70 72 6f 63 65 73 73 27 29 29 0a 0a 2f 2f 20 | ports.getGlobal('process'))..//. |
31cc0 | 43 72 65 61 74 65 20 61 20 66 75 6e 63 74 69 6f 6e 20 74 68 61 74 20 77 69 6c 6c 20 72 65 74 75 | Create.a.function.that.will.retu |
31ce0 | 72 6e 20 74 68 65 20 73 70 65 63 69 66 69 65 64 20 76 61 6c 75 65 20 77 68 65 6e 20 63 61 6c 6c | rn.the.specified.value.when.call |
31d00 | 65 64 20 69 6e 20 62 72 6f 77 73 65 72 2e 0a 65 78 70 6f 72 74 73 2e 63 72 65 61 74 65 46 75 6e | ed.in.browser..exports.createFun |
31d20 | 63 74 69 6f 6e 57 69 74 68 52 65 74 75 72 6e 56 61 6c 75 65 20 3d 20 28 72 65 74 75 72 6e 56 61 | ctionWithReturnValue.=.(returnVa |
31d40 | 6c 75 65 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 66 75 6e 63 20 3d 20 28 29 20 3d 3e 20 72 | lue).=>.{...const.func.=.().=>.r |
31d60 | 65 74 75 72 6e 56 61 6c 75 65 0a 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c | eturnValue...v8Util.setHiddenVal |
31d80 | 75 65 28 66 75 6e 63 2c 20 27 72 65 74 75 72 6e 56 61 6c 75 65 27 2c 20 74 72 75 65 29 0a 20 20 | ue(func,.'returnValue',.true)... |
31da0 | 72 65 74 75 72 6e 20 66 75 6e 63 0a 7d 0a 0a 2f 2f 20 47 65 74 20 74 68 65 20 67 75 65 73 74 20 | return.func.}..//.Get.the.guest. |
31dc0 | 57 65 62 43 6f 6e 74 65 6e 74 73 20 66 72 6f 6d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 | WebContents.from.guestInstanceId |
31de0 | 2e 0a 65 78 70 6f 72 74 73 2e 67 65 74 47 75 65 73 74 57 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 | ..exports.getGuestWebContents.=. |
31e00 | 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 63 | (guestInstanceId).=>.{...const.c |
31e20 | 6f 6d 6d 61 6e 64 20 3d 20 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f 47 55 45 53 54 | ommand.=.'ELECTRON_BROWSER_GUEST |
31e40 | 5f 57 45 42 5f 43 4f 4e 54 45 4e 54 53 27 0a 20 20 63 6f 6e 73 74 20 6d 65 74 61 20 3d 20 69 70 | _WEB_CONTENTS'...const.meta.=.ip |
31e60 | 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 63 6f 6d 6d 61 6e 64 2c 20 63 6f 6e 74 | cRenderer.sendSync(command,.cont |
31e80 | 65 78 74 49 64 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 72 65 74 75 72 6e | extId,.guestInstanceId)...return |
31ea0 | 20 6d 65 74 61 54 6f 56 61 6c 75 65 28 6d 65 74 61 29 0a 7d 0a 0a 63 6f 6e 73 74 20 61 64 64 42 | .metaToValue(meta).}..const.addB |
31ec0 | 75 69 6c 74 69 6e 50 72 6f 70 65 72 74 79 20 3d 20 28 6e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 4f | uiltinProperty.=.(name).=>.{...O |
31ee0 | 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 65 78 70 6f 72 74 73 2c 20 6e 61 | bject.defineProperty(exports,.na |
31f00 | 6d 65 2c 20 7b 0a 20 20 20 20 67 65 74 3a 20 28 29 20 3d 3e 20 65 78 70 6f 72 74 73 2e 67 65 74 | me,.{.....get:.().=>.exports.get |
31f20 | 42 75 69 6c 74 69 6e 28 6e 61 6d 65 29 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 62 72 6f 77 | Builtin(name)...}).}..const.brow |
31f40 | 73 65 72 4d 6f 64 75 6c 65 73 20 3d 0a 20 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f | serModules.=...require('@electro |
31f60 | 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 61 70 69 2f 6d 6f 64 75 6c 65 2d 6c 69 73 | n/internal/common/api/module-lis |
31f80 | 74 27 29 2e 63 6f 6e 63 61 74 28 0a 20 20 20 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 | t').concat(.....require('@electr |
31fa0 | 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 62 72 6f 77 73 65 72 2f 61 70 69 2f 6d 6f 64 75 6c 65 2d 6c | on/internal/browser/api/module-l |
31fc0 | 69 73 74 27 29 29 0a 0a 2f 2f 20 41 6e 64 20 61 64 64 20 61 20 68 65 6c 70 65 72 20 72 65 63 65 | ist'))..//.And.add.a.helper.rece |
31fe0 | 69 76 65 72 20 66 6f 72 20 65 61 63 68 20 6f 6e 65 2e 0a 62 72 6f 77 73 65 72 4d 6f 64 75 6c 65 | iver.for.each.one..browserModule |
32000 | 73 0a 20 20 2e 66 69 6c 74 65 72 28 28 6d 29 20 3d 3e 20 21 6d 2e 70 72 69 76 61 74 65 29 0a 20 | s....filter((m).=>.!m.private).. |
32020 | 20 2e 6d 61 70 28 28 6d 29 20 3d 3e 20 6d 2e 6e 61 6d 65 29 0a 20 20 2e 66 6f 72 45 61 63 68 28 | ..map((m).=>.m.name)....forEach( |
32040 | 61 64 64 42 75 69 6c 74 69 6e 50 72 6f 70 65 72 74 79 29 0a 27 75 73 65 20 73 74 72 69 63 74 27 | addBuiltinProperty).'use.strict' |
32060 | 0a 0a 63 6f 6e 73 74 20 7b 20 67 65 74 52 65 6d 6f 74 65 46 6f 72 55 73 61 67 65 20 7d 20 3d 20 | ..const.{.getRemoteForUsage.}.=. |
32080 | 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 | require('@electron/internal/rend |
320a0 | 65 72 65 72 2f 72 65 6d 6f 74 65 27 29 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 67 | erer/remote').module.exports.=.g |
320c0 | 65 74 52 65 6d 6f 74 65 46 6f 72 55 73 61 67 65 28 27 73 63 72 65 65 6e 27 29 2e 73 63 72 65 65 | etRemoteForUsage('screen').scree |
320e0 | 6e 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d 69 | n.'use.strict'..const.{.EventEmi |
32100 | 74 74 65 72 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 | tter.}.=.require('events').const |
32120 | 20 62 69 6e 64 69 6e 67 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 | .binding.=.process.atomBinding(' |
32140 | 77 65 62 5f 66 72 61 6d 65 27 29 0a 0a 63 6c 61 73 73 20 57 65 62 46 72 61 6d 65 20 65 78 74 65 | web_frame')..class.WebFrame.exte |
32160 | 6e 64 73 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 | nds.EventEmitter.{...constructor |
32180 | 20 28 63 6f 6e 74 65 78 74 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 29 0a 0a 20 20 20 20 74 68 | .(context).{.....super()......th |
321a0 | 69 73 2e 63 6f 6e 74 65 78 74 20 3d 20 63 6f 6e 74 65 78 74 0a 20 20 20 20 2f 2f 20 4c 6f 74 73 | is.context.=.context.....//.Lots |
321c0 | 20 6f 66 20 77 65 62 76 69 65 77 20 77 6f 75 6c 64 20 73 75 62 73 63 72 69 62 65 20 74 6f 20 77 | .of.webview.would.subscribe.to.w |
321e0 | 65 62 46 72 61 6d 65 27 73 20 65 76 65 6e 74 73 2e 0a 20 20 20 20 74 68 69 73 2e 73 65 74 4d 61 | ebFrame's.events......this.setMa |
32200 | 78 4c 69 73 74 65 6e 65 72 73 28 30 29 0a 20 20 7d 0a 0a 20 20 66 69 6e 64 46 72 61 6d 65 42 79 | xListeners(0)...}....findFrameBy |
32220 | 52 6f 75 74 69 6e 67 49 64 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e | RoutingId.(...args).{.....return |
32240 | 20 67 65 74 57 65 62 46 72 61 6d 65 28 62 69 6e 64 69 6e 67 2e 5f 66 69 6e 64 46 72 61 6d 65 42 | .getWebFrame(binding._findFrameB |
32260 | 79 52 6f 75 74 69 6e 67 49 64 28 74 68 69 73 2e 63 6f 6e 74 65 78 74 2c 20 2e 2e 2e 61 72 67 73 | yRoutingId(this.context,....args |
32280 | 29 29 0a 20 20 7d 0a 0a 20 20 67 65 74 46 72 61 6d 65 46 6f 72 53 65 6c 65 63 74 6f 72 20 28 2e | ))...}....getFrameForSelector.(. |
322a0 | 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 67 65 74 57 65 62 46 72 61 6d 65 | ..args).{.....return.getWebFrame |
322c0 | 28 62 69 6e 64 69 6e 67 2e 5f 67 65 74 46 72 61 6d 65 46 6f 72 53 65 6c 65 63 74 6f 72 28 74 68 | (binding._getFrameForSelector(th |
322e0 | 69 73 2e 63 6f 6e 74 65 78 74 2c 20 2e 2e 2e 61 72 67 73 29 29 0a 20 20 7d 0a 0a 20 20 66 69 6e | is.context,....args))...}....fin |
32300 | 64 46 72 61 6d 65 42 79 4e 61 6d 65 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 72 65 74 | dFrameByName.(...args).{.....ret |
32320 | 75 72 6e 20 67 65 74 57 65 62 46 72 61 6d 65 28 62 69 6e 64 69 6e 67 2e 5f 66 69 6e 64 46 72 61 | urn.getWebFrame(binding._findFra |
32340 | 6d 65 42 79 4e 61 6d 65 28 74 68 69 73 2e 63 6f 6e 74 65 78 74 2c 20 2e 2e 2e 61 72 67 73 29 29 | meByName(this.context,....args)) |
32360 | 0a 20 20 7d 0a 0a 20 20 67 65 74 20 6f 70 65 6e 65 72 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 | ...}....get.opener.().{.....retu |
32380 | 72 6e 20 67 65 74 57 65 62 46 72 61 6d 65 28 62 69 6e 64 69 6e 67 2e 5f 67 65 74 4f 70 65 6e 65 | rn.getWebFrame(binding._getOpene |
323a0 | 72 28 74 68 69 73 2e 63 6f 6e 74 65 78 74 29 29 0a 20 20 7d 0a 0a 20 20 67 65 74 20 70 61 72 65 | r(this.context))...}....get.pare |
323c0 | 6e 74 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 67 65 74 57 65 62 46 72 61 6d 65 28 62 | nt.().{.....return.getWebFrame(b |
323e0 | 69 6e 64 69 6e 67 2e 5f 67 65 74 50 61 72 65 6e 74 28 74 68 69 73 2e 63 6f 6e 74 65 78 74 29 29 | inding._getParent(this.context)) |
32400 | 0a 20 20 7d 0a 0a 20 20 67 65 74 20 74 6f 70 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 | ...}....get.top.().{.....return. |
32420 | 67 65 74 57 65 62 46 72 61 6d 65 28 62 69 6e 64 69 6e 67 2e 5f 67 65 74 54 6f 70 28 74 68 69 73 | getWebFrame(binding._getTop(this |
32440 | 2e 63 6f 6e 74 65 78 74 29 29 0a 20 20 7d 0a 0a 20 20 67 65 74 20 66 69 72 73 74 43 68 69 6c 64 | .context))...}....get.firstChild |
32460 | 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 67 65 74 57 65 62 46 72 61 6d 65 28 62 69 6e | .().{.....return.getWebFrame(bin |
32480 | 64 69 6e 67 2e 5f 67 65 74 46 69 72 73 74 43 68 69 6c 64 28 74 68 69 73 2e 63 6f 6e 74 65 78 74 | ding._getFirstChild(this.context |
324a0 | 29 29 0a 20 20 7d 0a 0a 20 20 67 65 74 20 6e 65 78 74 53 69 62 6c 69 6e 67 20 28 29 20 7b 0a 20 | ))...}....get.nextSibling.().{.. |
324c0 | 20 20 20 72 65 74 75 72 6e 20 67 65 74 57 65 62 46 72 61 6d 65 28 62 69 6e 64 69 6e 67 2e 5f 67 | ...return.getWebFrame(binding._g |
324e0 | 65 74 4e 65 78 74 53 69 62 6c 69 6e 67 28 74 68 69 73 2e 63 6f 6e 74 65 78 74 29 29 0a 20 20 7d | etNextSibling(this.context))...} |
32500 | 0a 0a 20 20 67 65 74 20 72 6f 75 74 69 6e 67 49 64 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 | ....get.routingId.().{.....retur |
32520 | 6e 20 62 69 6e 64 69 6e 67 2e 5f 67 65 74 52 6f 75 74 69 6e 67 49 64 28 74 68 69 73 2e 63 6f 6e | n.binding._getRoutingId(this.con |
32540 | 74 65 78 74 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 50 6f 70 75 6c 61 74 65 20 74 68 65 20 6d 65 74 | text)...}.}..//.Populate.the.met |
32560 | 68 6f 64 73 2e 0a 66 6f 72 20 28 63 6f 6e 73 74 20 6e 61 6d 65 20 69 6e 20 62 69 6e 64 69 6e 67 | hods..for.(const.name.in.binding |
32580 | 29 20 7b 0a 20 20 69 66 20 28 21 6e 61 6d 65 2e 73 74 61 72 74 73 57 69 74 68 28 27 5f 27 29 29 | ).{...if.(!name.startsWith('_')) |
325a0 | 20 7b 20 2f 2f 20 73 6f 6d 65 20 6d 65 74 68 6f 64 73 20 61 72 65 20 6d 61 6e 75 6c 6c 79 20 70 | .{.//.some.methods.are.manully.p |
325c0 | 6f 70 75 6c 61 74 65 64 20 61 62 6f 76 65 0a 20 20 20 20 57 65 62 46 72 61 6d 65 2e 70 72 6f 74 | opulated.above.....WebFrame.prot |
325e0 | 6f 74 79 70 65 5b 6e 61 6d 65 5d 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 | otype[name].=.function.(...args) |
32600 | 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 5b 6e 61 6d 65 5d 28 74 68 | .{.......return.binding[name](th |
32620 | 69 73 2e 63 6f 6e 74 65 78 74 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d | is.context,....args).....}...}.} |
32640 | 0a 0a 2f 2f 20 48 65 6c 70 65 72 20 74 6f 20 72 65 74 75 72 6e 20 57 65 62 46 72 61 6d 65 20 6f | ..//.Helper.to.return.WebFrame.o |
32660 | 72 20 6e 75 6c 6c 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 63 6f 6e 74 65 78 74 2e 0a 2f 2f 20 | r.null.depending.on.context..//. |
32680 | 54 4f 44 4f 28 7a 63 62 65 6e 7a 29 3a 20 43 6f 6e 73 69 64 65 72 20 72 65 74 75 72 6e 69 6e 67 | TODO(zcbenz):.Consider.returning |
326a0 | 20 73 61 6d 65 20 57 65 62 46 72 61 6d 65 20 66 6f 72 20 74 68 65 20 73 61 6d 65 20 63 6f 6e 74 | .same.WebFrame.for.the.same.cont |
326c0 | 65 78 74 2e 0a 66 75 6e 63 74 69 6f 6e 20 67 65 74 57 65 62 46 72 61 6d 65 20 28 63 6f 6e 74 65 | ext..function.getWebFrame.(conte |
326e0 | 78 74 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 63 6f 6e 74 65 78 74 20 3f 20 6e 65 77 20 57 65 62 | xt).{...return.context.?.new.Web |
32700 | 46 72 61 6d 65 28 63 6f 6e 74 65 78 74 29 20 3a 20 6e 75 6c 6c 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e | Frame(context).:.null.}..module. |
32720 | 65 78 70 6f 72 74 73 20 3d 20 6e 65 77 20 57 65 62 46 72 61 6d 65 28 77 69 6e 64 6f 77 29 0a 27 | exports.=.new.WebFrame(window).' |
32740 | 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 | use.strict'..const.v8Util.=.proc |
32760 | 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 29 0a 0a 63 6c 61 73 | ess.atomBinding('v8_util')..clas |
32780 | 73 20 43 61 6c 6c 62 61 63 6b 73 52 65 67 69 73 74 72 79 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 | s.CallbacksRegistry.{...construc |
327a0 | 74 6f 72 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 6e 65 78 74 49 64 20 3d 20 30 0a 20 20 20 | tor.().{.....this.nextId.=.0.... |
327c0 | 20 74 68 69 73 2e 63 61 6c 6c 62 61 63 6b 73 20 3d 20 7b 7d 0a 20 20 7d 0a 0a 20 20 61 64 64 20 | .this.callbacks.=.{}...}....add. |
327e0 | 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 2f 2f 20 54 68 65 20 63 61 6c 6c 62 61 63 6b | (callback).{.....//.The.callback |
32800 | 20 69 73 20 61 6c 72 65 61 64 79 20 61 64 64 65 64 2e 0a 20 20 20 20 6c 65 74 20 69 64 20 3d 20 | .is.already.added......let.id.=. |
32820 | 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 63 61 6c 6c 62 61 63 6b 2c 20 | v8Util.getHiddenValue(callback,. |
32840 | 27 63 61 6c 6c 62 61 63 6b 49 64 27 29 0a 20 20 20 20 69 66 20 28 69 64 20 21 3d 20 6e 75 6c 6c | 'callbackId').....if.(id.!=.null |
32860 | 29 20 72 65 74 75 72 6e 20 69 64 0a 0a 20 20 20 20 69 64 20 3d 20 74 68 69 73 2e 6e 65 78 74 49 | ).return.id......id.=.this.nextI |
32880 | 64 20 2b 3d 20 31 0a 0a 20 20 20 20 2f 2f 20 43 61 70 74 75 72 65 20 74 68 65 20 6c 6f 63 61 74 | d.+=.1......//.Capture.the.locat |
328a0 | 69 6f 6e 20 6f 66 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 61 6e 64 20 70 75 74 20 69 74 20 69 | ion.of.the.function.and.put.it.i |
328c0 | 6e 20 74 68 65 20 49 44 20 73 74 72 69 6e 67 2c 0a 20 20 20 20 2f 2f 20 73 6f 20 74 68 61 74 20 | n.the.ID.string,.....//.so.that. |
328e0 | 72 65 6c 65 61 73 65 20 65 72 72 6f 72 73 20 63 61 6e 20 62 65 20 74 72 61 63 6b 65 64 20 64 6f | release.errors.can.be.tracked.do |
32900 | 77 6e 20 65 61 73 69 6c 79 2e 0a 20 20 20 20 63 6f 6e 73 74 20 72 65 67 65 78 70 20 3d 20 2f 61 | wn.easily......const.regexp.=./a |
32920 | 74 20 28 2e 2a 29 2f 67 69 0a 20 20 20 20 63 6f 6e 73 74 20 73 74 61 63 6b 53 74 72 69 6e 67 20 | t.(.*)/gi.....const.stackString. |
32940 | 3d 20 28 6e 65 77 20 45 72 72 6f 72 28 29 29 2e 73 74 61 63 6b 0a 0a 20 20 20 20 6c 65 74 20 66 | =.(new.Error()).stack......let.f |
32960 | 69 6c 65 6e 61 6d 65 41 6e 64 4c 69 6e 65 0a 20 20 20 20 6c 65 74 20 6d 61 74 63 68 0a 0a 20 20 | ilenameAndLine.....let.match.... |
32980 | 20 20 77 68 69 6c 65 20 28 28 6d 61 74 63 68 20 3d 20 72 65 67 65 78 70 2e 65 78 65 63 28 73 74 | ..while.((match.=.regexp.exec(st |
329a0 | 61 63 6b 53 74 72 69 6e 67 29 29 20 21 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 63 6f | ackString)).!==.null).{.......co |
329c0 | 6e 73 74 20 6c 6f 63 61 74 69 6f 6e 20 3d 20 6d 61 74 63 68 5b 31 5d 0a 20 20 20 20 20 20 69 66 | nst.location.=.match[1].......if |
329e0 | 20 28 6c 6f 63 61 74 69 6f 6e 2e 69 6e 63 6c 75 64 65 73 28 27 28 6e 61 74 69 76 65 29 27 29 29 | .(location.includes('(native)')) |
32a00 | 20 63 6f 6e 74 69 6e 75 65 0a 20 20 20 20 20 20 69 66 20 28 6c 6f 63 61 74 69 6f 6e 2e 69 6e 63 | .continue.......if.(location.inc |
32a20 | 6c 75 64 65 73 28 27 28 3c 61 6e 6f 6e 79 6d 6f 75 73 3e 29 27 29 29 20 63 6f 6e 74 69 6e 75 65 | ludes('(<anonymous>)')).continue |
32a40 | 0a 20 20 20 20 20 20 69 66 20 28 6c 6f 63 61 74 69 6f 6e 2e 69 6e 63 6c 75 64 65 73 28 27 65 6c | .......if.(location.includes('el |
32a60 | 65 63 74 72 6f 6e 2e 61 73 61 72 27 29 29 20 63 6f 6e 74 69 6e 75 65 0a 0a 20 20 20 20 20 20 63 | ectron.asar')).continue........c |
32a80 | 6f 6e 73 74 20 72 65 66 20 3d 20 2f 28 5b 5e 2f 5e 29 5d 2a 29 5c 29 3f 24 2f 67 69 2e 65 78 65 | onst.ref.=./([^/^)]*)\)?$/gi.exe |
32aa0 | 63 28 6c 6f 63 61 74 69 6f 6e 29 0a 20 20 20 20 20 20 66 69 6c 65 6e 61 6d 65 41 6e 64 4c 69 6e | c(location).......filenameAndLin |
32ac0 | 65 20 3d 20 72 65 66 5b 31 5d 0a 20 20 20 20 20 20 62 72 65 61 6b 0a 20 20 20 20 7d 0a 20 20 20 | e.=.ref[1].......break.....}.... |
32ae0 | 20 74 68 69 73 2e 63 61 6c 6c 62 61 63 6b 73 5b 69 64 5d 20 3d 20 63 61 6c 6c 62 61 63 6b 0a 20 | .this.callbacks[id].=.callback.. |
32b00 | 20 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 63 61 6c 6c 62 61 63 | ...v8Util.setHiddenValue(callbac |
32b20 | 6b 2c 20 27 63 61 6c 6c 62 61 63 6b 49 64 27 2c 20 69 64 29 0a 20 20 20 20 76 38 55 74 69 6c 2e | k,.'callbackId',.id).....v8Util. |
32b40 | 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 63 61 6c 6c 62 61 63 6b 2c 20 27 6c 6f 63 61 74 69 | setHiddenValue(callback,.'locati |
32b60 | 6f 6e 27 2c 20 66 69 6c 65 6e 61 6d 65 41 6e 64 4c 69 6e 65 29 0a 20 20 20 20 72 65 74 75 72 6e | on',.filenameAndLine).....return |
32b80 | 20 69 64 0a 20 20 7d 0a 0a 20 20 67 65 74 20 28 69 64 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e | .id...}....get.(id).{.....return |
32ba0 | 20 74 68 69 73 2e 63 61 6c 6c 62 61 63 6b 73 5b 69 64 5d 20 7c 7c 20 66 75 6e 63 74 69 6f 6e 20 | .this.callbacks[id].||.function. |
32bc0 | 28 29 20 7b 7d 0a 20 20 7d 0a 0a 20 20 61 70 70 6c 79 20 28 69 64 2c 20 2e 2e 2e 61 72 67 73 29 | ().{}...}....apply.(id,....args) |
32be0 | 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 67 65 74 28 69 64 29 2e 61 70 70 6c 79 | .{.....return.this.get(id).apply |
32c00 | 28 67 6c 6f 62 61 6c 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 0a 0a 20 20 72 65 6d 6f 76 65 20 | (global,....args)...}....remove. |
32c20 | 28 69 64 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 61 6c 6c 62 61 63 6b 20 3d 20 74 68 69 73 | (id).{.....const.callback.=.this |
32c40 | 2e 63 61 6c 6c 62 61 63 6b 73 5b 69 64 5d 0a 20 20 20 20 69 66 20 28 63 61 6c 6c 62 61 63 6b 29 | .callbacks[id].....if.(callback) |
32c60 | 20 7b 0a 20 20 20 20 20 20 76 38 55 74 69 6c 2e 64 65 6c 65 74 65 48 69 64 64 65 6e 56 61 6c 75 | .{.......v8Util.deleteHiddenValu |
32c80 | 65 28 63 61 6c 6c 62 61 63 6b 2c 20 27 63 61 6c 6c 62 61 63 6b 49 64 27 29 0a 20 20 20 20 20 20 | e(callback,.'callbackId')....... |
32ca0 | 64 65 6c 65 74 65 20 74 68 69 73 2e 63 61 6c 6c 62 61 63 6b 73 5b 69 64 5d 0a 20 20 20 20 7d 0a | delete.this.callbacks[id].....}. |
32cc0 | 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 43 61 6c 6c 62 61 63 6b | ..}.}..module.exports.=.Callback |
32ce0 | 73 52 65 67 69 73 74 72 79 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 69 70 | sRegistry.'use.strict'..const.ip |
32d00 | 63 52 65 6e 64 65 72 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 | cRenderer.=.require('@electron/i |
32d20 | 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 69 70 63 2d 72 65 6e 64 65 72 65 72 2d 69 6e | nternal/renderer/ipc-renderer-in |
32d40 | 74 65 72 6e 61 6c 27 29 0a 63 6f 6e 73 74 20 45 76 65 6e 74 20 3d 20 72 65 71 75 69 72 65 28 27 | ternal').const.Event.=.require(' |
32d60 | 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 65 78 74 65 | @electron/internal/renderer/exte |
32d80 | 6e 73 69 6f 6e 73 2f 65 76 65 6e 74 27 29 0a 63 6f 6e 73 74 20 75 72 6c 20 3d 20 72 65 71 75 69 | nsions/event').const.url.=.requi |
32da0 | 72 65 28 27 75 72 6c 27 29 0a 0a 63 6c 61 73 73 20 54 61 62 20 7b 0a 20 20 63 6f 6e 73 74 72 75 | re('url')..class.Tab.{...constru |
32dc0 | 63 74 6f 72 20 28 74 61 62 49 64 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 69 64 20 3d 20 74 61 62 | ctor.(tabId).{.....this.id.=.tab |
32de0 | 49 64 0a 20 20 7d 0a 7d 0a 0a 63 6c 61 73 73 20 4d 65 73 73 61 67 65 53 65 6e 64 65 72 20 7b 0a | Id...}.}..class.MessageSender.{. |
32e00 | 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 74 61 62 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 | ..constructor.(tabId,.extensionI |
32e20 | 64 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 74 61 62 20 3d 20 74 61 62 49 64 20 3f 20 6e 65 77 20 | d).{.....this.tab.=.tabId.?.new. |
32e40 | 54 61 62 28 74 61 62 49 64 29 20 3a 20 6e 75 6c 6c 0a 20 20 20 20 74 68 69 73 2e 69 64 20 3d 20 | Tab(tabId).:.null.....this.id.=. |
32e60 | 65 78 74 65 6e 73 69 6f 6e 49 64 0a 20 20 20 20 74 68 69 73 2e 75 72 6c 20 3d 20 60 63 68 72 6f | extensionId.....this.url.=.`chro |
32e80 | 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 3a 2f 2f 24 7b 65 78 74 65 6e 73 69 6f 6e 49 64 7d 60 0a 20 | me-extension://${extensionId}`.. |
32ea0 | 20 7d 0a 7d 0a 0a 63 6c 61 73 73 20 50 6f 72 74 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 | .}.}..class.Port.{...constructor |
32ec0 | 20 28 74 61 62 49 64 2c 20 70 6f 72 74 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6e 61 | .(tabId,.portId,.extensionId,.na |
32ee0 | 6d 65 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 74 61 62 49 64 20 3d 20 74 61 62 49 64 0a 20 20 20 | me).{.....this.tabId.=.tabId.... |
32f00 | 20 74 68 69 73 2e 70 6f 72 74 49 64 20 3d 20 70 6f 72 74 49 64 0a 20 20 20 20 74 68 69 73 2e 64 | .this.portId.=.portId.....this.d |
32f20 | 69 73 63 6f 6e 6e 65 63 74 65 64 20 3d 20 66 61 6c 73 65 0a 0a 20 20 20 20 74 68 69 73 2e 6e 61 | isconnected.=.false......this.na |
32f40 | 6d 65 20 3d 20 6e 61 6d 65 0a 20 20 20 20 74 68 69 73 2e 6f 6e 44 69 73 63 6f 6e 6e 65 63 74 20 | me.=.name.....this.onDisconnect. |
32f60 | 3d 20 6e 65 77 20 45 76 65 6e 74 28 29 0a 20 20 20 20 74 68 69 73 2e 6f 6e 4d 65 73 73 61 67 65 | =.new.Event().....this.onMessage |
32f80 | 20 3d 20 6e 65 77 20 45 76 65 6e 74 28 29 0a 20 20 20 20 74 68 69 73 2e 73 65 6e 64 65 72 20 3d | .=.new.Event().....this.sender.= |
32fa0 | 20 6e 65 77 20 4d 65 73 73 61 67 65 53 65 6e 64 65 72 28 74 61 62 49 64 2c 20 65 78 74 65 6e 73 | .new.MessageSender(tabId,.extens |
32fc0 | 69 6f 6e 49 64 29 0a 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 63 65 28 60 43 48 | ionId)......ipcRenderer.once(`CH |
32fe0 | 52 4f 4d 45 5f 50 4f 52 54 5f 44 49 53 43 4f 4e 4e 45 43 54 5f 24 7b 70 6f 72 74 49 64 7d 60 2c | ROME_PORT_DISCONNECT_${portId}`, |
33000 | 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 5f 6f 6e 44 69 73 63 6f 6e 6e 65 63 | .().=>.{.......this._onDisconnec |
33020 | 74 28 29 0a 20 20 20 20 7d 29 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 43 | t().....}).....ipcRenderer.on(`C |
33040 | 48 52 4f 4d 45 5f 50 4f 52 54 5f 50 4f 53 54 4d 45 53 53 41 47 45 5f 24 7b 70 6f 72 74 49 64 7d | HROME_PORT_POSTMESSAGE_${portId} |
33060 | 60 2c 20 28 65 76 65 6e 74 2c 20 6d 65 73 73 61 67 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 63 | `,.(event,.message).=>.{.......c |
33080 | 6f 6e 73 74 20 73 65 6e 64 52 65 73 70 6f 6e 73 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 | onst.sendResponse.=.function.(). |
330a0 | 7b 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 27 73 65 6e 64 52 65 73 70 6f 6e 73 65 20 69 73 | {.console.error('sendResponse.is |
330c0 | 20 6e 6f 74 20 69 6d 70 6c 65 6d 65 6e 74 65 64 27 29 20 7d 0a 20 20 20 20 20 20 74 68 69 73 2e | .not.implemented').}.......this. |
330e0 | 6f 6e 4d 65 73 73 61 67 65 2e 65 6d 69 74 28 6d 65 73 73 61 67 65 2c 20 74 68 69 73 2e 73 65 6e | onMessage.emit(message,.this.sen |
33100 | 64 65 72 2c 20 73 65 6e 64 52 65 73 70 6f 6e 73 65 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 | der,.sendResponse).....})...}... |
33120 | 20 64 69 73 63 6f 6e 6e 65 63 74 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 64 69 | .disconnect.().{.....if.(this.di |
33140 | 73 63 6f 6e 6e 65 63 74 65 64 29 20 72 65 74 75 72 6e 0a 0a 20 20 20 20 69 70 63 52 65 6e 64 65 | sconnected).return......ipcRende |
33160 | 72 65 72 2e 73 65 6e 64 54 6f 41 6c 6c 28 74 68 69 73 2e 74 61 62 49 64 2c 20 60 43 48 52 4f 4d | rer.sendToAll(this.tabId,.`CHROM |
33180 | 45 5f 50 4f 52 54 5f 44 49 53 43 4f 4e 4e 45 43 54 5f 24 7b 74 68 69 73 2e 70 6f 72 74 49 64 7d | E_PORT_DISCONNECT_${this.portId} |
331a0 | 60 29 0a 20 20 20 20 74 68 69 73 2e 5f 6f 6e 44 69 73 63 6f 6e 6e 65 63 74 28 29 0a 20 20 7d 0a | `).....this._onDisconnect()...}. |
331c0 | 0a 20 20 70 6f 73 74 4d 65 73 73 61 67 65 20 28 6d 65 73 73 61 67 65 29 20 7b 0a 20 20 20 20 69 | ...postMessage.(message).{.....i |
331e0 | 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 54 6f 41 6c 6c 28 74 68 69 73 2e 74 61 62 49 64 2c | pcRenderer.sendToAll(this.tabId, |
33200 | 20 60 43 48 52 4f 4d 45 5f 50 4f 52 54 5f 50 4f 53 54 4d 45 53 53 41 47 45 5f 24 7b 74 68 69 73 | .`CHROME_PORT_POSTMESSAGE_${this |
33220 | 2e 70 6f 72 74 49 64 7d 60 2c 20 6d 65 73 73 61 67 65 29 0a 20 20 7d 0a 0a 20 20 5f 6f 6e 44 69 | .portId}`,.message)...}...._onDi |
33240 | 73 63 6f 6e 6e 65 63 74 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 64 69 73 63 6f 6e 6e 65 63 | sconnect.().{.....this.disconnec |
33260 | 74 65 64 20 3d 20 74 72 75 65 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 72 65 6d 6f 76 | ted.=.true.....ipcRenderer.remov |
33280 | 65 41 6c 6c 4c 69 73 74 65 6e 65 72 73 28 60 43 48 52 4f 4d 45 5f 50 4f 52 54 5f 50 4f 53 54 4d | eAllListeners(`CHROME_PORT_POSTM |
332a0 | 45 53 53 41 47 45 5f 24 7b 74 68 69 73 2e 70 6f 72 74 49 64 7d 60 29 0a 20 20 20 20 74 68 69 73 | ESSAGE_${this.portId}`).....this |
332c0 | 2e 6f 6e 44 69 73 63 6f 6e 6e 65 63 74 2e 65 6d 69 74 28 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 49 | .onDisconnect.emit()...}.}..//.I |
332e0 | 6e 6a 65 63 74 20 63 68 72 6f 6d 65 20 41 50 49 20 74 6f 20 74 68 65 20 7c 63 6f 6e 74 65 78 74 | nject.chrome.API.to.the.|context |
33300 | 7c 0a 65 78 70 6f 72 74 73 2e 69 6e 6a 65 63 74 54 6f 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 | |.exports.injectTo.=.function.(e |
33320 | 78 74 65 6e 73 69 6f 6e 49 64 2c 20 69 73 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 2c 20 63 6f | xtensionId,.isBackgroundPage,.co |
33340 | 6e 74 65 78 74 29 20 7b 0a 20 20 63 6f 6e 73 74 20 63 68 72 6f 6d 65 20 3d 20 63 6f 6e 74 65 78 | ntext).{...const.chrome.=.contex |
33360 | 74 2e 63 68 72 6f 6d 65 20 3d 20 63 6f 6e 74 65 78 74 2e 63 68 72 6f 6d 65 20 7c 7c 20 7b 7d 0a | t.chrome.=.context.chrome.||.{}. |
33380 | 20 20 6c 65 74 20 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 20 3d 20 31 0a 0a 20 20 69 70 63 52 | ..let.originResultID.=.1....ipcR |
333a0 | 65 6e 64 65 72 65 72 2e 6f 6e 28 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 4f 4e 43 4f 4e | enderer.on(`CHROME_RUNTIME_ONCON |
333c0 | 4e 45 43 54 5f 24 7b 65 78 74 65 6e 73 69 6f 6e 49 64 7d 60 2c 20 28 65 76 65 6e 74 2c 20 74 61 | NECT_${extensionId}`,.(event,.ta |
333e0 | 62 49 64 2c 20 70 6f 72 74 49 64 2c 20 63 6f 6e 6e 65 63 74 49 6e 66 6f 29 20 3d 3e 20 7b 0a 20 | bId,.portId,.connectInfo).=>.{.. |
33400 | 20 20 20 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 2e 6f 6e 43 6f 6e 6e 65 63 74 2e 65 6d 69 74 | ...chrome.runtime.onConnect.emit |
33420 | 28 6e 65 77 20 50 6f 72 74 28 74 61 62 49 64 2c 20 70 6f 72 74 49 64 2c 20 65 78 74 65 6e 73 69 | (new.Port(tabId,.portId,.extensi |
33440 | 6f 6e 49 64 2c 20 63 6f 6e 6e 65 63 74 49 6e 66 6f 2e 6e 61 6d 65 29 29 0a 20 20 7d 29 0a 0a 20 | onId,.connectInfo.name))...})... |
33460 | 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f | .ipcRenderer.on(`CHROME_RUNTIME_ |
33480 | 4f 4e 4d 45 53 53 41 47 45 5f 24 7b 65 78 74 65 6e 73 69 6f 6e 49 64 7d 60 2c 20 28 65 76 65 6e | ONMESSAGE_${extensionId}`,.(even |
334a0 | 74 2c 20 74 61 62 49 64 2c 20 6d 65 73 73 61 67 65 2c 20 72 65 73 75 6c 74 49 44 29 20 3d 3e 20 | t,.tabId,.message,.resultID).=>. |
334c0 | 7b 0a 20 20 20 20 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 2e 6f 6e 4d 65 73 73 61 67 65 2e 65 | {.....chrome.runtime.onMessage.e |
334e0 | 6d 69 74 28 6d 65 73 73 61 67 65 2c 20 6e 65 77 20 4d 65 73 73 61 67 65 53 65 6e 64 65 72 28 74 | mit(message,.new.MessageSender(t |
33500 | 61 62 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 29 2c 20 28 6d 65 73 73 61 67 65 52 65 73 75 | abId,.extensionId),.(messageResu |
33520 | 6c 74 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 | lt).=>.{.......ipcRenderer.send( |
33540 | 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 4f 4e 4d 45 53 53 41 47 45 5f 52 45 53 55 4c 54 | `CHROME_RUNTIME_ONMESSAGE_RESULT |
33560 | 5f 24 7b 72 65 73 75 6c 74 49 44 7d 60 2c 20 6d 65 73 73 61 67 65 52 65 73 75 6c 74 29 0a 20 20 | _${resultID}`,.messageResult)... |
33580 | 20 20 7d 29 0a 20 20 7d 29 0a 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 43 48 52 | ..})...})....ipcRenderer.on('CHR |
335a0 | 4f 4d 45 5f 54 41 42 53 5f 4f 4e 43 52 45 41 54 45 44 27 2c 20 28 65 76 65 6e 74 2c 20 74 61 62 | OME_TABS_ONCREATED',.(event,.tab |
335c0 | 49 64 29 20 3d 3e 20 7b 0a 20 20 20 20 63 68 72 6f 6d 65 2e 74 61 62 73 2e 6f 6e 43 72 65 61 74 | Id).=>.{.....chrome.tabs.onCreat |
335e0 | 65 64 2e 65 6d 69 74 28 6e 65 77 20 54 61 62 28 74 61 62 49 64 29 29 0a 20 20 7d 29 0a 0a 20 20 | ed.emit(new.Tab(tabId))...}).... |
33600 | 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 4f 4e 52 45 | ipcRenderer.on('CHROME_TABS_ONRE |
33620 | 4d 4f 56 45 44 27 2c 20 28 65 76 65 6e 74 2c 20 74 61 62 49 64 29 20 3d 3e 20 7b 0a 20 20 20 20 | MOVED',.(event,.tabId).=>.{..... |
33640 | 63 68 72 6f 6d 65 2e 74 61 62 73 2e 6f 6e 52 65 6d 6f 76 65 64 2e 65 6d 69 74 28 74 61 62 49 64 | chrome.tabs.onRemoved.emit(tabId |
33660 | 29 0a 20 20 7d 29 0a 0a 20 20 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 20 3d 20 7b 0a 20 20 20 | )...})....chrome.runtime.=.{.... |
33680 | 20 69 64 3a 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 0a 0a 20 20 20 20 67 65 74 55 52 4c 3a 20 66 | .id:.extensionId,......getURL:.f |
336a0 | 75 6e 63 74 69 6f 6e 20 28 70 61 74 68 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 75 72 | unction.(path).{.......return.ur |
336c0 | 6c 2e 66 6f 72 6d 61 74 28 7b 0a 20 20 20 20 20 20 20 20 70 72 6f 74 6f 63 6f 6c 3a 20 27 63 68 | l.format({.........protocol:.'ch |
336e0 | 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 27 2c 0a 20 20 20 20 20 20 20 20 73 6c 61 73 68 65 73 | rome-extension',.........slashes |
33700 | 3a 20 74 72 75 65 2c 0a 20 20 20 20 20 20 20 20 68 6f 73 74 6e 61 6d 65 3a 20 65 78 74 65 6e 73 | :.true,.........hostname:.extens |
33720 | 69 6f 6e 49 64 2c 0a 20 20 20 20 20 20 20 20 70 61 74 68 6e 61 6d 65 3a 20 70 61 74 68 0a 20 20 | ionId,.........pathname:.path... |
33740 | 20 20 20 20 7d 29 0a 20 20 20 20 7d 2c 0a 0a 20 20 20 20 63 6f 6e 6e 65 63 74 20 28 2e 2e 2e 61 | ....}).....},......connect.(...a |
33760 | 72 67 73 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 69 73 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 | rgs).{.......if.(isBackgroundPag |
33780 | 65 29 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 27 63 68 72 6f | e).{.........console.error('chro |
337a0 | 6d 65 2e 72 75 6e 74 69 6d 65 2e 63 6f 6e 6e 65 63 74 20 69 73 20 6e 6f 74 20 73 75 70 70 6f 72 | me.runtime.connect.is.not.suppor |
337c0 | 74 65 64 20 69 6e 20 62 61 63 6b 67 72 6f 75 6e 64 20 70 61 67 65 27 29 0a 20 20 20 20 20 20 20 | ted.in.background.page')........ |
337e0 | 20 72 65 74 75 72 6e 0a 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 2f 2f 20 50 61 72 73 65 20 | .return.......}........//.Parse. |
33800 | 74 68 65 20 6f 70 74 69 6f 6e 61 6c 20 61 72 67 73 2e 0a 20 20 20 20 20 20 6c 65 74 20 74 61 72 | the.optional.args........let.tar |
33820 | 67 65 74 45 78 74 65 6e 73 69 6f 6e 49 64 20 3d 20 65 78 74 65 6e 73 69 6f 6e 49 64 0a 20 20 20 | getExtensionId.=.extensionId.... |
33840 | 20 20 20 6c 65 74 20 63 6f 6e 6e 65 63 74 49 6e 66 6f 20 3d 20 7b 20 6e 61 6d 65 3a 20 27 27 20 | ...let.connectInfo.=.{.name:.''. |
33860 | 7d 0a 20 20 20 20 20 20 69 66 20 28 61 72 67 73 2e 6c 65 6e 67 74 68 20 3d 3d 3d 20 31 29 20 7b | }.......if.(args.length.===.1).{ |
33880 | 0a 20 20 20 20 20 20 20 20 63 6f 6e 6e 65 63 74 49 6e 66 6f 20 3d 20 61 72 67 73 5b 30 5d 0a 20 | .........connectInfo.=.args[0].. |
338a0 | 20 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 67 73 2e 6c 65 6e 67 74 68 20 3d 3d 3d 20 | .....}.else.if.(args.length.===. |
338c0 | 32 29 20 7b 0a 20 20 20 20 20 20 20 20 5b 74 61 72 67 65 74 45 78 74 65 6e 73 69 6f 6e 49 64 2c | 2).{.........[targetExtensionId, |
338e0 | 20 63 6f 6e 6e 65 63 74 49 6e 66 6f 5d 20 3d 20 61 72 67 73 0a 20 20 20 20 20 20 7d 0a 0a 20 20 | .connectInfo].=.args.......}.... |
33900 | 20 20 20 20 63 6f 6e 73 74 20 7b 20 74 61 62 49 64 2c 20 70 6f 72 74 49 64 20 7d 20 3d 20 69 70 | ....const.{.tabId,.portId.}.=.ip |
33920 | 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 27 43 48 52 4f 4d 45 5f 52 55 4e 54 49 | cRenderer.sendSync('CHROME_RUNTI |
33940 | 4d 45 5f 43 4f 4e 4e 45 43 54 27 2c 20 74 61 72 67 65 74 45 78 74 65 6e 73 69 6f 6e 49 64 2c 20 | ME_CONNECT',.targetExtensionId,. |
33960 | 63 6f 6e 6e 65 63 74 49 6e 66 6f 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 65 77 20 50 6f | connectInfo).......return.new.Po |
33980 | 72 74 28 74 61 62 49 64 2c 20 70 6f 72 74 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 63 | rt(tabId,.portId,.extensionId,.c |
339a0 | 6f 6e 6e 65 63 74 49 6e 66 6f 2e 6e 61 6d 65 29 0a 20 20 20 20 7d 2c 0a 0a 20 20 20 20 73 65 6e | onnectInfo.name).....},......sen |
339c0 | 64 4d 65 73 73 61 67 65 20 28 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 69 | dMessage.(...args).{.......if.(i |
339e0 | 73 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 29 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 6f | sBackgroundPage).{.........conso |
33a00 | 6c 65 2e 65 72 72 6f 72 28 27 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 2e 73 65 6e 64 4d 65 73 | le.error('chrome.runtime.sendMes |
33a20 | 73 61 67 65 20 69 73 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 20 69 6e 20 62 61 63 6b 67 72 6f | sage.is.not.supported.in.backgro |
33a40 | 75 6e 64 20 70 61 67 65 27 29 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 20 20 | und.page').........return....... |
33a60 | 7d 0a 0a 20 20 20 20 20 20 2f 2f 20 50 61 72 73 65 20 74 68 65 20 6f 70 74 69 6f 6e 61 6c 20 61 | }........//.Parse.the.optional.a |
33a80 | 72 67 73 2e 0a 20 20 20 20 20 20 6c 65 74 20 74 61 72 67 65 74 45 78 74 65 6e 73 69 6f 6e 49 64 | rgs........let.targetExtensionId |
33aa0 | 20 3d 20 65 78 74 65 6e 73 69 6f 6e 49 64 0a 20 20 20 20 20 20 6c 65 74 20 6d 65 73 73 61 67 65 | .=.extensionId.......let.message |
33ac0 | 0a 20 20 20 20 20 20 69 66 20 28 61 72 67 73 2e 6c 65 6e 67 74 68 20 3d 3d 3d 20 31 29 20 7b 0a | .......if.(args.length.===.1).{. |
33ae0 | 20 20 20 20 20 20 20 20 6d 65 73 73 61 67 65 20 3d 20 61 72 67 73 5b 30 5d 0a 20 20 20 20 20 20 | ........message.=.args[0]....... |
33b00 | 7d 20 65 6c 73 65 20 69 66 20 28 61 72 67 73 2e 6c 65 6e 67 74 68 20 3d 3d 3d 20 32 29 20 7b 0a | }.else.if.(args.length.===.2).{. |
33b20 | 20 20 20 20 20 20 20 20 2f 2f 20 41 20 63 61 73 65 20 6f 66 20 6e 6f 74 20 70 72 6f 76 69 64 65 | ........//.A.case.of.not.provide |
33b40 | 20 65 78 74 65 6e 73 69 6f 6e 2d 69 64 3a 20 28 6d 65 73 73 61 67 65 2c 20 72 65 73 70 6f 6e 73 | .extension-id:.(message,.respons |
33b60 | 65 43 61 6c 6c 62 61 63 6b 29 0a 20 20 20 20 20 20 20 20 69 66 20 28 74 79 70 65 6f 66 20 61 72 | eCallback).........if.(typeof.ar |
33b80 | 67 73 5b 31 5d 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 7b 0a 20 20 20 20 20 20 20 20 | gs[1].===.'function').{......... |
33ba0 | 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 | ..ipcRenderer.on(`CHROME_RUNTIME |
33bc0 | 5f 53 45 4e 44 4d 45 53 53 41 47 45 5f 52 45 53 55 4c 54 5f 24 7b 6f 72 69 67 69 6e 52 65 73 75 | _SENDMESSAGE_RESULT_${originResu |
33be0 | 6c 74 49 44 7d 60 2c 20 28 65 76 65 6e 74 2c 20 72 65 73 75 6c 74 29 20 3d 3e 20 61 72 67 73 5b | ltID}`,.(event,.result).=>.args[ |
33c00 | 31 5d 28 72 65 73 75 6c 74 29 29 0a 20 20 20 20 20 20 20 20 20 20 6d 65 73 73 61 67 65 20 3d 20 | 1](result))...........message.=. |
33c20 | 61 72 67 73 5b 30 5d 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 | args[0].........}.else.{........ |
33c40 | 20 20 20 5b 74 61 72 67 65 74 45 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6d 65 73 73 61 67 65 5d 20 | ...[targetExtensionId,.message]. |
33c60 | 3d 20 61 72 67 73 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a | =.args.........}.......}.else.{. |
33c80 | 20 20 20 20 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 27 6f 70 74 69 6f 6e 73 20 69 | ........console.error('options.i |
33ca0 | 73 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 27 29 0a 20 20 20 20 20 20 20 20 69 70 63 52 65 6e | s.not.supported').........ipcRen |
33cc0 | 64 65 72 65 72 2e 6f 6e 28 60 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 53 45 4e 44 4d 45 53 | derer.on(`CHROME_RUNTIME_SENDMES |
33ce0 | 53 41 47 45 5f 52 45 53 55 4c 54 5f 24 7b 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 7d 60 2c 20 | SAGE_RESULT_${originResultID}`,. |
33d00 | 28 65 76 65 6e 74 2c 20 72 65 73 75 6c 74 29 20 3d 3e 20 61 72 67 73 5b 32 5d 28 72 65 73 75 6c | (event,.result).=>.args[2](resul |
33d20 | 74 29 29 0a 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 | t)).......}........ipcRenderer.s |
33d40 | 65 6e 64 28 27 43 48 52 4f 4d 45 5f 52 55 4e 54 49 4d 45 5f 53 45 4e 44 4d 45 53 53 41 47 45 27 | end('CHROME_RUNTIME_SENDMESSAGE' |
33d60 | 2c 20 74 61 72 67 65 74 45 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6d 65 73 73 61 67 65 2c 20 6f 72 | ,.targetExtensionId,.message,.or |
33d80 | 69 67 69 6e 52 65 73 75 6c 74 49 44 29 0a 20 20 20 20 20 20 6f 72 69 67 69 6e 52 65 73 75 6c 74 | iginResultID).......originResult |
33da0 | 49 44 2b 2b 0a 20 20 20 20 7d 2c 0a 0a 20 20 20 20 6f 6e 43 6f 6e 6e 65 63 74 3a 20 6e 65 77 20 | ID++.....},......onConnect:.new. |
33dc0 | 45 76 65 6e 74 28 29 2c 0a 20 20 20 20 6f 6e 4d 65 73 73 61 67 65 3a 20 6e 65 77 20 45 76 65 6e | Event(),.....onMessage:.new.Even |
33de0 | 74 28 29 2c 0a 20 20 20 20 6f 6e 49 6e 73 74 61 6c 6c 65 64 3a 20 6e 65 77 20 45 76 65 6e 74 28 | t(),.....onInstalled:.new.Event( |
33e00 | 29 0a 20 20 7d 0a 0a 20 20 63 68 72 6f 6d 65 2e 74 61 62 73 20 3d 20 7b 0a 20 20 20 20 65 78 65 | )...}....chrome.tabs.=.{.....exe |
33e20 | 63 75 74 65 53 63 72 69 70 74 20 28 74 61 62 49 64 2c 20 64 65 74 61 69 6c 73 2c 20 72 65 73 75 | cuteScript.(tabId,.details,.resu |
33e40 | 6c 74 43 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 72 65 73 75 6c 74 43 61 | ltCallback).{.......if.(resultCa |
33e60 | 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e | llback).{.........ipcRenderer.on |
33e80 | 63 65 28 60 43 48 52 4f 4d 45 5f 54 41 42 53 5f 45 58 45 43 55 54 45 53 43 52 49 50 54 5f 52 45 | ce(`CHROME_TABS_EXECUTESCRIPT_RE |
33ea0 | 53 55 4c 54 5f 24 7b 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 7d 60 2c 20 28 65 76 65 6e 74 2c | SULT_${originResultID}`,.(event, |
33ec0 | 20 72 65 73 75 6c 74 29 20 3d 3e 20 72 65 73 75 6c 74 43 61 6c 6c 62 61 63 6b 28 5b 72 65 73 75 | .result).=>.resultCallback([resu |
33ee0 | 6c 74 5d 29 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e | lt])).......}.......ipcRenderer. |
33f00 | 73 65 6e 64 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 45 58 45 43 55 54 45 53 43 52 49 50 54 27 | send('CHROME_TABS_EXECUTESCRIPT' |
33f20 | 2c 20 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 2c 20 74 61 62 49 64 2c 20 65 78 74 65 6e 73 69 | ,.originResultID,.tabId,.extensi |
33f40 | 6f 6e 49 64 2c 20 64 65 74 61 69 6c 73 29 0a 20 20 20 20 20 20 6f 72 69 67 69 6e 52 65 73 75 6c | onId,.details).......originResul |
33f60 | 74 49 44 2b 2b 0a 20 20 20 20 7d 2c 0a 0a 20 20 20 20 73 65 6e 64 4d 65 73 73 61 67 65 20 28 74 | tID++.....},......sendMessage.(t |
33f80 | 61 62 49 64 2c 20 6d 65 73 73 61 67 65 2c 20 6f 70 74 69 6f 6e 73 2c 20 72 65 73 70 6f 6e 73 65 | abId,.message,.options,.response |
33fa0 | 43 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 72 65 73 70 6f 6e 73 65 43 61 | Callback).{.......if.(responseCa |
33fc0 | 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e | llback).{.........ipcRenderer.on |
33fe0 | 28 60 43 48 52 4f 4d 45 5f 54 41 42 53 5f 53 45 4e 44 5f 4d 45 53 53 41 47 45 5f 52 45 53 55 4c | (`CHROME_TABS_SEND_MESSAGE_RESUL |
34000 | 54 5f 24 7b 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 7d 60 2c 20 28 65 76 65 6e 74 2c 20 72 65 | T_${originResultID}`,.(event,.re |
34020 | 73 75 6c 74 29 20 3d 3e 20 72 65 73 70 6f 6e 73 65 43 61 6c 6c 62 61 63 6b 28 72 65 73 75 6c 74 | sult).=>.responseCallback(result |
34040 | 29 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e | )).......}.......ipcRenderer.sen |
34060 | 64 28 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 53 45 4e 44 5f 4d 45 53 53 41 47 45 27 2c 20 74 61 | d('CHROME_TABS_SEND_MESSAGE',.ta |
34080 | 62 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 69 73 42 61 63 6b 67 72 6f 75 6e 64 50 61 | bId,.extensionId,.isBackgroundPa |
340a0 | 67 65 2c 20 6d 65 73 73 61 67 65 2c 20 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 29 0a 20 20 20 | ge,.message,.originResultID).... |
340c0 | 20 20 20 6f 72 69 67 69 6e 52 65 73 75 6c 74 49 44 2b 2b 0a 20 20 20 20 7d 2c 0a 0a 20 20 20 20 | ...originResultID++.....},...... |
340e0 | 6f 6e 55 70 64 61 74 65 64 3a 20 6e 65 77 20 45 76 65 6e 74 28 29 2c 0a 20 20 20 20 6f 6e 43 72 | onUpdated:.new.Event(),.....onCr |
34100 | 65 61 74 65 64 3a 20 6e 65 77 20 45 76 65 6e 74 28 29 2c 0a 20 20 20 20 6f 6e 52 65 6d 6f 76 65 | eated:.new.Event(),.....onRemove |
34120 | 64 3a 20 6e 65 77 20 45 76 65 6e 74 28 29 0a 20 20 7d 0a 0a 20 20 63 68 72 6f 6d 65 2e 65 78 74 | d:.new.Event()...}....chrome.ext |
34140 | 65 6e 73 69 6f 6e 20 3d 20 7b 0a 20 20 20 20 67 65 74 55 52 4c 3a 20 63 68 72 6f 6d 65 2e 72 75 | ension.=.{.....getURL:.chrome.ru |
34160 | 6e 74 69 6d 65 2e 67 65 74 55 52 4c 2c 0a 20 20 20 20 63 6f 6e 6e 65 63 74 3a 20 63 68 72 6f 6d | ntime.getURL,.....connect:.chrom |
34180 | 65 2e 72 75 6e 74 69 6d 65 2e 63 6f 6e 6e 65 63 74 2c 0a 20 20 20 20 6f 6e 43 6f 6e 6e 65 63 74 | e.runtime.connect,.....onConnect |
341a0 | 3a 20 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 2e 6f 6e 43 6f 6e 6e 65 63 74 2c 0a 20 20 20 20 | :.chrome.runtime.onConnect,..... |
341c0 | 73 65 6e 64 4d 65 73 73 61 67 65 3a 20 63 68 72 6f 6d 65 2e 72 75 6e 74 69 6d 65 2e 73 65 6e 64 | sendMessage:.chrome.runtime.send |
341e0 | 4d 65 73 73 61 67 65 2c 0a 20 20 20 20 6f 6e 4d 65 73 73 61 67 65 3a 20 63 68 72 6f 6d 65 2e 72 | Message,.....onMessage:.chrome.r |
34200 | 75 6e 74 69 6d 65 2e 6f 6e 4d 65 73 73 61 67 65 0a 20 20 7d 0a 0a 20 20 63 68 72 6f 6d 65 2e 73 | untime.onMessage...}....chrome.s |
34220 | 74 6f 72 61 67 65 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 | torage.=.require('@electron/inte |
34240 | 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 65 78 74 65 6e 73 69 6f 6e 73 2f 73 74 6f 72 61 67 65 | rnal/renderer/extensions/storage |
34260 | 27 29 2e 73 65 74 75 70 28 65 78 74 65 6e 73 69 6f 6e 49 64 29 0a 0a 20 20 63 68 72 6f 6d 65 2e | ').setup(extensionId)....chrome. |
34280 | 70 61 67 65 41 63 74 69 6f 6e 20 3d 20 7b 0a 20 20 20 20 73 68 6f 77 20 28 29 20 7b 7d 2c 0a 20 | pageAction.=.{.....show.().{},.. |
342a0 | 20 20 20 68 69 64 65 20 28 29 20 7b 7d 2c 0a 20 20 20 20 73 65 74 54 69 74 6c 65 20 28 29 20 7b | ...hide.().{},.....setTitle.().{ |
342c0 | 7d 2c 0a 20 20 20 20 67 65 74 54 69 74 6c 65 20 28 29 20 7b 7d 2c 0a 20 20 20 20 73 65 74 49 63 | },.....getTitle.().{},.....setIc |
342e0 | 6f 6e 20 28 29 20 7b 7d 2c 0a 20 20 20 20 73 65 74 50 6f 70 75 70 20 28 29 20 7b 7d 2c 0a 20 20 | on.().{},.....setPopup.().{},... |
34300 | 20 20 67 65 74 50 6f 70 75 70 20 28 29 20 7b 7d 0a 20 20 7d 0a 0a 20 20 63 68 72 6f 6d 65 2e 69 | ..getPopup.().{}...}....chrome.i |
34320 | 31 38 6e 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 | 18n.=.require('@electron/interna |
34340 | 6c 2f 72 65 6e 64 65 72 65 72 2f 65 78 74 65 6e 73 69 6f 6e 73 2f 69 31 38 6e 27 29 2e 73 65 74 | l/renderer/extensions/i18n').set |
34360 | 75 70 28 65 78 74 65 6e 73 69 6f 6e 49 64 29 0a 20 20 63 68 72 6f 6d 65 2e 77 65 62 4e 61 76 69 | up(extensionId)...chrome.webNavi |
34380 | 67 61 74 69 6f 6e 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 | gation.=.require('@electron/inte |
343a0 | 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 65 78 74 65 6e 73 69 6f 6e 73 2f 77 65 62 2d 6e 61 76 | rnal/renderer/extensions/web-nav |
343c0 | 69 67 61 74 69 6f 6e 27 29 2e 73 65 74 75 70 28 29 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 | igation').setup().}.'use.strict' |
343e0 | 0a 0a 63 6f 6e 73 74 20 69 70 63 52 65 6e 64 65 72 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 40 | ..const.ipcRenderer.=.require('@ |
34400 | 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 69 70 63 2d 72 | electron/internal/renderer/ipc-r |
34420 | 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 63 6f 6e 73 74 20 7b 20 72 75 6e 49 6e | enderer-internal').const.{.runIn |
34440 | 54 68 69 73 43 6f 6e 74 65 78 74 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 76 6d 27 29 0a 0a 2f | ThisContext.}.=.require('vm')../ |
34460 | 2f 20 43 68 65 63 6b 20 77 68 65 74 68 65 72 20 70 61 74 74 65 72 6e 20 6d 61 74 63 68 65 73 2e | /.Check.whether.pattern.matches. |
34480 | 0a 2f 2f 20 68 74 74 70 73 3a 2f 2f 64 65 76 65 6c 6f 70 65 72 2e 63 68 72 6f 6d 65 2e 63 6f 6d | .//.https://developer.chrome.com |
344a0 | 2f 65 78 74 65 6e 73 69 6f 6e 73 2f 6d 61 74 63 68 5f 70 61 74 74 65 72 6e 73 0a 63 6f 6e 73 74 | /extensions/match_patterns.const |
344c0 | 20 6d 61 74 63 68 65 73 50 61 74 74 65 72 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 70 61 74 74 | .matchesPattern.=.function.(patt |
344e0 | 65 72 6e 29 20 7b 0a 20 20 69 66 20 28 70 61 74 74 65 72 6e 20 3d 3d 3d 20 27 3c 61 6c 6c 5f 75 | ern).{...if.(pattern.===.'<all_u |
34500 | 72 6c 73 3e 27 29 20 72 65 74 75 72 6e 20 74 72 75 65 0a 20 20 63 6f 6e 73 74 20 72 65 67 65 78 | rls>').return.true...const.regex |
34520 | 70 20 3d 20 6e 65 77 20 52 65 67 45 78 70 28 60 5e 24 7b 70 61 74 74 65 72 6e 2e 72 65 70 6c 61 | p.=.new.RegExp(`^${pattern.repla |
34540 | 63 65 28 2f 5c 2a 2f 67 2c 20 27 2e 2a 27 29 7d 24 60 29 0a 20 20 63 6f 6e 73 74 20 75 72 6c 20 | ce(/\*/g,.'.*')}$`)...const.url. |
34560 | 3d 20 60 24 7b 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 7d 2f 2f 24 7b 6c 6f 63 61 74 | =.`${location.protocol}//${locat |
34580 | 69 6f 6e 2e 68 6f 73 74 7d 24 7b 6c 6f 63 61 74 69 6f 6e 2e 70 61 74 68 6e 61 6d 65 7d 60 0a 20 | ion.host}${location.pathname}`.. |
345a0 | 20 72 65 74 75 72 6e 20 75 72 6c 2e 6d 61 74 63 68 28 72 65 67 65 78 70 29 0a 7d 0a 0a 2f 2f 20 | .return.url.match(regexp).}..//. |
345c0 | 52 75 6e 20 74 68 65 20 63 6f 64 65 20 77 69 74 68 20 63 68 72 6f 6d 65 20 41 50 49 20 69 6e 74 | Run.the.code.with.chrome.API.int |
345e0 | 65 67 72 61 74 65 64 2e 0a 63 6f 6e 73 74 20 72 75 6e 43 6f 6e 74 65 6e 74 53 63 72 69 70 74 20 | egrated..const.runContentScript. |
34600 | 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 75 72 6c 2c 20 63 6f | =.function.(extensionId,.url,.co |
34620 | 64 65 29 20 7b 0a 20 20 63 6f 6e 73 74 20 63 6f 6e 74 65 78 74 20 3d 20 7b 7d 0a 20 20 72 65 71 | de).{...const.context.=.{}...req |
34640 | 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 | uire('@electron/internal/rendere |
34660 | 72 2f 63 68 72 6f 6d 65 2d 61 70 69 27 29 2e 69 6e 6a 65 63 74 54 6f 28 65 78 74 65 6e 73 69 6f | r/chrome-api').injectTo(extensio |
34680 | 6e 49 64 2c 20 66 61 6c 73 65 2c 20 63 6f 6e 74 65 78 74 29 0a 20 20 63 6f 6e 73 74 20 77 72 61 | nId,.false,.context)...const.wra |
346a0 | 70 70 65 72 20 3d 20 60 28 28 63 68 72 6f 6d 65 29 20 3d 3e 20 7b 5c 6e 20 20 24 7b 63 6f 64 65 | pper.=.`((chrome).=>.{\n..${code |
346c0 | 7d 5c 6e 20 20 7d 29 60 0a 20 20 63 6f 6e 73 74 20 63 6f 6d 70 69 6c 65 64 57 72 61 70 70 65 72 | }\n..})`...const.compiledWrapper |
346e0 | 20 3d 20 72 75 6e 49 6e 54 68 69 73 43 6f 6e 74 65 78 74 28 77 72 61 70 70 65 72 2c 20 7b 0a 20 | .=.runInThisContext(wrapper,.{.. |
34700 | 20 20 20 66 69 6c 65 6e 61 6d 65 3a 20 75 72 6c 2c 0a 20 20 20 20 6c 69 6e 65 4f 66 66 73 65 74 | ...filename:.url,.....lineOffset |
34720 | 3a 20 31 2c 0a 20 20 20 20 64 69 73 70 6c 61 79 45 72 72 6f 72 73 3a 20 74 72 75 65 0a 20 20 7d | :.1,.....displayErrors:.true...} |
34740 | 29 0a 20 20 72 65 74 75 72 6e 20 63 6f 6d 70 69 6c 65 64 57 72 61 70 70 65 72 2e 63 61 6c 6c 28 | )...return.compiledWrapper.call( |
34760 | 74 68 69 73 2c 20 63 6f 6e 74 65 78 74 2e 63 68 72 6f 6d 65 29 0a 7d 0a 0a 63 6f 6e 73 74 20 72 | this,.context.chrome).}..const.r |
34780 | 75 6e 41 6c 6c 43 6f 6e 74 65 6e 74 53 63 72 69 70 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 | unAllContentScript.=.function.(s |
347a0 | 63 72 69 70 74 73 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 29 20 7b 0a 20 20 66 6f 72 20 28 63 6f | cripts,.extensionId).{...for.(co |
347c0 | 6e 73 74 20 7b 20 75 72 6c 2c 20 63 6f 64 65 20 7d 20 6f 66 20 73 63 72 69 70 74 73 29 20 7b 0a | nst.{.url,.code.}.of.scripts).{. |
347e0 | 20 20 20 20 72 75 6e 43 6f 6e 74 65 6e 74 53 63 72 69 70 74 2e 63 61 6c 6c 28 77 69 6e 64 6f 77 | ....runContentScript.call(window |
34800 | 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 75 72 6c 2c 20 63 6f 64 65 29 0a 20 20 7d 0a 7d 0a | ,.extensionId,.url,.code)...}.}. |
34820 | 0a 63 6f 6e 73 74 20 72 75 6e 53 74 79 6c 65 73 68 65 65 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 | .const.runStylesheet.=.function. |
34840 | 28 75 72 6c 2c 20 63 6f 64 65 29 20 7b 0a 20 20 63 6f 6e 73 74 20 77 72 61 70 70 65 72 20 3d 20 | (url,.code).{...const.wrapper.=. |
34860 | 60 28 28 63 6f 64 65 29 20 3d 3e 20 7b 0a 20 20 20 20 66 75 6e 63 74 69 6f 6e 20 69 6e 69 74 28 | `((code).=>.{.....function.init( |
34880 | 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 73 74 79 6c 65 45 6c 65 6d 65 6e 74 20 3d 20 64 | ).{.......const.styleElement.=.d |
348a0 | 6f 63 75 6d 65 6e 74 2e 63 72 65 61 74 65 45 6c 65 6d 65 6e 74 28 27 73 74 79 6c 65 27 29 3b 0a | ocument.createElement('style');. |
348c0 | 20 20 20 20 20 20 73 74 79 6c 65 45 6c 65 6d 65 6e 74 2e 74 65 78 74 43 6f 6e 74 65 6e 74 20 3d | ......styleElement.textContent.= |
348e0 | 20 63 6f 64 65 3b 0a 20 20 20 20 20 20 64 6f 63 75 6d 65 6e 74 2e 68 65 61 64 2e 61 70 70 65 6e | .code;.......document.head.appen |
34900 | 64 28 73 74 79 6c 65 45 6c 65 6d 65 6e 74 29 3b 0a 20 20 20 20 7d 0a 20 20 20 20 64 6f 63 75 6d | d(styleElement);.....}.....docum |
34920 | 65 6e 74 2e 61 64 64 45 76 65 6e 74 4c 69 73 74 65 6e 65 72 28 27 44 4f 4d 43 6f 6e 74 65 6e 74 | ent.addEventListener('DOMContent |
34940 | 4c 6f 61 64 65 64 27 2c 20 69 6e 69 74 29 3b 0a 20 20 7d 29 60 0a 20 20 63 6f 6e 73 74 20 63 6f | Loaded',.init);...})`...const.co |
34960 | 6d 70 69 6c 65 64 57 72 61 70 70 65 72 20 3d 20 72 75 6e 49 6e 54 68 69 73 43 6f 6e 74 65 78 74 | mpiledWrapper.=.runInThisContext |
34980 | 28 77 72 61 70 70 65 72 2c 20 7b 0a 20 20 20 20 66 69 6c 65 6e 61 6d 65 3a 20 75 72 6c 2c 0a 20 | (wrapper,.{.....filename:.url,.. |
349a0 | 20 20 20 6c 69 6e 65 4f 66 66 73 65 74 3a 20 31 2c 0a 20 20 20 20 64 69 73 70 6c 61 79 45 72 72 | ...lineOffset:.1,.....displayErr |
349c0 | 6f 72 73 3a 20 74 72 75 65 0a 20 20 7d 29 0a 20 20 72 65 74 75 72 6e 20 63 6f 6d 70 69 6c 65 64 | ors:.true...})...return.compiled |
349e0 | 57 72 61 70 70 65 72 2e 63 61 6c 6c 28 74 68 69 73 2c 20 63 6f 64 65 29 0a 7d 0a 0a 63 6f 6e 73 | Wrapper.call(this,.code).}..cons |
34a00 | 74 20 72 75 6e 41 6c 6c 53 74 79 6c 65 73 68 65 65 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 63 | t.runAllStylesheet.=.function.(c |
34a20 | 73 73 29 20 7b 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 7b 20 75 72 6c 2c 20 63 6f 64 65 20 7d | ss).{...for.(const.{.url,.code.} |
34a40 | 20 6f 66 20 63 73 73 29 20 7b 0a 20 20 20 20 72 75 6e 53 74 79 6c 65 73 68 65 65 74 2e 63 61 6c | .of.css).{.....runStylesheet.cal |
34a60 | 6c 28 77 69 6e 64 6f 77 2c 20 75 72 6c 2c 20 63 6f 64 65 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 52 | l(window,.url,.code)...}.}..//.R |
34a80 | 75 6e 20 69 6e 6a 65 63 74 65 64 20 73 63 72 69 70 74 73 2e 0a 2f 2f 20 68 74 74 70 73 3a 2f 2f | un.injected.scripts..//.https:// |
34aa0 | 64 65 76 65 6c 6f 70 65 72 2e 63 68 72 6f 6d 65 2e 63 6f 6d 2f 65 78 74 65 6e 73 69 6f 6e 73 2f | developer.chrome.com/extensions/ |
34ac0 | 63 6f 6e 74 65 6e 74 5f 73 63 72 69 70 74 73 0a 63 6f 6e 73 74 20 69 6e 6a 65 63 74 43 6f 6e 74 | content_scripts.const.injectCont |
34ae0 | 65 6e 74 53 63 72 69 70 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 65 78 74 65 6e 73 69 6f 6e 49 | entScript.=.function.(extensionI |
34b00 | 64 2c 20 73 63 72 69 70 74 29 20 7b 0a 20 20 69 66 20 28 21 73 63 72 69 70 74 2e 6d 61 74 63 68 | d,.script).{...if.(!script.match |
34b20 | 65 73 2e 73 6f 6d 65 28 6d 61 74 63 68 65 73 50 61 74 74 65 72 6e 29 29 20 72 65 74 75 72 6e 0a | es.some(matchesPattern)).return. |
34b40 | 0a 20 20 69 66 20 28 73 63 72 69 70 74 2e 6a 73 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 66 69 | ...if.(script.js).{.....const.fi |
34b60 | 72 65 20 3d 20 72 75 6e 41 6c 6c 43 6f 6e 74 65 6e 74 53 63 72 69 70 74 2e 62 69 6e 64 28 77 69 | re.=.runAllContentScript.bind(wi |
34b80 | 6e 64 6f 77 2c 20 73 63 72 69 70 74 2e 6a 73 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 29 0a 20 20 | ndow,.script.js,.extensionId)... |
34ba0 | 20 20 69 66 20 28 73 63 72 69 70 74 2e 72 75 6e 41 74 20 3d 3d 3d 20 27 64 6f 63 75 6d 65 6e 74 | ..if.(script.runAt.===.'document |
34bc0 | 5f 73 74 61 72 74 27 29 20 7b 0a 20 20 20 20 20 20 70 72 6f 63 65 73 73 2e 6f 6e 63 65 28 27 64 | _start').{.......process.once('d |
34be0 | 6f 63 75 6d 65 6e 74 2d 73 74 61 72 74 27 2c 20 66 69 72 65 29 0a 20 20 20 20 7d 20 65 6c 73 65 | ocument-start',.fire).....}.else |
34c00 | 20 69 66 20 28 73 63 72 69 70 74 2e 72 75 6e 41 74 20 3d 3d 3d 20 27 64 6f 63 75 6d 65 6e 74 5f | .if.(script.runAt.===.'document_ |
34c20 | 65 6e 64 27 29 20 7b 0a 20 20 20 20 20 20 70 72 6f 63 65 73 73 2e 6f 6e 63 65 28 27 64 6f 63 75 | end').{.......process.once('docu |
34c40 | 6d 65 6e 74 2d 65 6e 64 27 2c 20 66 69 72 65 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 | ment-end',.fire).....}.else.{... |
34c60 | 20 20 20 20 64 6f 63 75 6d 65 6e 74 2e 61 64 64 45 76 65 6e 74 4c 69 73 74 65 6e 65 72 28 27 44 | ....document.addEventListener('D |
34c80 | 4f 4d 43 6f 6e 74 65 6e 74 4c 6f 61 64 65 64 27 2c 20 66 69 72 65 29 0a 20 20 20 20 7d 0a 20 20 | OMContentLoaded',.fire).....}... |
34ca0 | 7d 0a 0a 20 20 69 66 20 28 73 63 72 69 70 74 2e 63 73 73 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 | }....if.(script.css).{.....const |
34cc0 | 20 66 69 72 65 20 3d 20 72 75 6e 41 6c 6c 53 74 79 6c 65 73 68 65 65 74 2e 62 69 6e 64 28 77 69 | .fire.=.runAllStylesheet.bind(wi |
34ce0 | 6e 64 6f 77 2c 20 73 63 72 69 70 74 2e 63 73 73 29 0a 20 20 20 20 69 66 20 28 73 63 72 69 70 74 | ndow,.script.css).....if.(script |
34d00 | 2e 72 75 6e 41 74 20 3d 3d 3d 20 27 64 6f 63 75 6d 65 6e 74 5f 73 74 61 72 74 27 29 20 7b 0a 20 | .runAt.===.'document_start').{.. |
34d20 | 20 20 20 20 20 70 72 6f 63 65 73 73 2e 6f 6e 63 65 28 27 64 6f 63 75 6d 65 6e 74 2d 73 74 61 72 | .....process.once('document-star |
34d40 | 74 27 2c 20 66 69 72 65 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 73 63 72 69 70 74 2e | t',.fire).....}.else.if.(script. |
34d60 | 72 75 6e 41 74 20 3d 3d 3d 20 27 64 6f 63 75 6d 65 6e 74 5f 65 6e 64 27 29 20 7b 0a 20 20 20 20 | runAt.===.'document_end').{..... |
34d80 | 20 20 70 72 6f 63 65 73 73 2e 6f 6e 63 65 28 27 64 6f 63 75 6d 65 6e 74 2d 65 6e 64 27 2c 20 66 | ..process.once('document-end',.f |
34da0 | 69 72 65 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 64 6f 63 75 6d 65 6e 74 | ire).....}.else.{.......document |
34dc0 | 2e 61 64 64 45 76 65 6e 74 4c 69 73 74 65 6e 65 72 28 27 44 4f 4d 43 6f 6e 74 65 6e 74 4c 6f 61 | .addEventListener('DOMContentLoa |
34de0 | 64 65 64 27 2c 20 66 69 72 65 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 48 61 6e 64 | ded',.fire).....}...}.}..//.Hand |
34e00 | 6c 65 20 74 68 65 20 72 65 71 75 65 73 74 20 6f 66 20 63 68 72 6f 6d 65 2e 74 61 62 73 2e 65 78 | le.the.request.of.chrome.tabs.ex |
34e20 | 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 2e 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 | ecuteJavaScript..ipcRenderer.on( |
34e40 | 27 43 48 52 4f 4d 45 5f 54 41 42 53 5f 45 58 45 43 55 54 45 53 43 52 49 50 54 27 2c 20 66 75 6e | 'CHROME_TABS_EXECUTESCRIPT',.fun |
34e60 | 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 73 65 6e 64 65 72 57 65 62 43 6f 6e 74 65 6e 74 73 49 | ction.(event,.senderWebContentsI |
34e80 | 64 2c 20 72 65 71 75 65 73 74 49 64 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 75 72 6c 2c 20 | d,.requestId,.extensionId,.url,. |
34ea0 | 63 6f 64 65 29 20 7b 0a 20 20 63 6f 6e 73 74 20 72 65 73 75 6c 74 20 3d 20 72 75 6e 43 6f 6e 74 | code).{...const.result.=.runCont |
34ec0 | 65 6e 74 53 63 72 69 70 74 2e 63 61 6c 6c 28 77 69 6e 64 6f 77 2c 20 65 78 74 65 6e 73 69 6f 6e | entScript.call(window,.extension |
34ee0 | 49 64 2c 20 75 72 6c 2c 20 63 6f 64 65 29 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e | Id,.url,.code)...ipcRenderer.sen |
34f00 | 64 54 6f 41 6c 6c 28 73 65 6e 64 65 72 57 65 62 43 6f 6e 74 65 6e 74 73 49 64 2c 20 60 43 48 52 | dToAll(senderWebContentsId,.`CHR |
34f20 | 4f 4d 45 5f 54 41 42 53 5f 45 58 45 43 55 54 45 53 43 52 49 50 54 5f 52 45 53 55 4c 54 5f 24 7b | OME_TABS_EXECUTESCRIPT_RESULT_${ |
34f40 | 72 65 71 75 65 73 74 49 64 7d 60 2c 20 72 65 73 75 6c 74 29 0a 7d 29 0a 0a 2f 2f 20 52 65 61 64 | requestId}`,.result).})..//.Read |
34f60 | 20 74 68 65 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 73 20 70 72 65 66 65 72 65 6e 63 65 | .the.renderer.process.preference |
34f80 | 73 2e 0a 63 6f 6e 73 74 20 70 72 65 66 65 72 65 6e 63 65 73 20 3d 20 70 72 6f 63 65 73 73 2e 67 | s..const.preferences.=.process.g |
34fa0 | 65 74 52 65 6e 64 65 72 50 72 6f 63 65 73 73 50 72 65 66 65 72 65 6e 63 65 73 28 29 0a 69 66 20 | etRenderProcessPreferences().if. |
34fc0 | 28 70 72 65 66 65 72 65 6e 63 65 73 29 20 7b 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 70 72 65 | (preferences).{...for.(const.pre |
34fe0 | 66 20 6f 66 20 70 72 65 66 65 72 65 6e 63 65 73 29 20 7b 0a 20 20 20 20 69 66 20 28 70 72 65 66 | f.of.preferences).{.....if.(pref |
35000 | 2e 63 6f 6e 74 65 6e 74 53 63 72 69 70 74 73 29 20 7b 0a 20 20 20 20 20 20 66 6f 72 20 28 63 6f | .contentScripts).{.......for.(co |
35020 | 6e 73 74 20 73 63 72 69 70 74 20 6f 66 20 70 72 65 66 2e 63 6f 6e 74 65 6e 74 53 63 72 69 70 74 | nst.script.of.pref.contentScript |
35040 | 73 29 20 7b 0a 20 20 20 20 20 20 20 20 69 6e 6a 65 63 74 43 6f 6e 74 65 6e 74 53 63 72 69 70 74 | s).{.........injectContentScript |
35060 | 28 70 72 65 66 2e 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 73 63 72 69 70 74 29 0a 20 20 20 20 20 | (pref.extensionId,.script)...... |
35080 | 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6c 61 | .}.....}...}.}.'use.strict'..cla |
350a0 | 73 73 20 45 76 65 6e 74 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 29 20 7b 0a 20 20 | ss.Event.{...constructor.().{... |
350c0 | 20 20 74 68 69 73 2e 6c 69 73 74 65 6e 65 72 73 20 3d 20 5b 5d 0a 20 20 7d 0a 0a 20 20 61 64 64 | ..this.listeners.=.[]...}....add |
350e0 | 4c 69 73 74 65 6e 65 72 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 6c | Listener.(callback).{.....this.l |
35100 | 69 73 74 65 6e 65 72 73 2e 70 75 73 68 28 63 61 6c 6c 62 61 63 6b 29 0a 20 20 7d 0a 0a 20 20 72 | isteners.push(callback)...}....r |
35120 | 65 6d 6f 76 65 4c 69 73 74 65 6e 65 72 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 63 | emoveListener.(callback).{.....c |
35140 | 6f 6e 73 74 20 69 6e 64 65 78 20 3d 20 74 68 69 73 2e 6c 69 73 74 65 6e 65 72 73 2e 69 6e 64 65 | onst.index.=.this.listeners.inde |
35160 | 78 4f 66 28 63 61 6c 6c 62 61 63 6b 29 0a 20 20 20 20 69 66 20 28 69 6e 64 65 78 20 21 3d 3d 20 | xOf(callback).....if.(index.!==. |
35180 | 2d 31 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 6c 69 73 74 65 6e 65 72 73 2e 73 70 6c 69 63 | -1).{.......this.listeners.splic |
351a0 | 65 28 69 6e 64 65 78 2c 20 31 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 65 6d 69 74 20 28 2e | e(index,.1).....}...}....emit.(. |
351c0 | 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 6c 69 73 74 65 6e 65 | ..args).{.....for.(const.listene |
351e0 | 72 20 6f 66 20 74 68 69 73 2e 6c 69 73 74 65 6e 65 72 73 29 20 7b 0a 20 20 20 20 20 20 6c 69 73 | r.of.this.listeners).{.......lis |
35200 | 74 65 6e 65 72 28 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 | tener(...args).....}...}.}..modu |
35220 | 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 45 76 65 6e 74 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a | le.exports.=.Event.'use.strict'. |
35240 | 0a 2f 2f 20 49 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 20 63 68 72 6f 6d 65 2e 69 31 38 | .//.Implementation.of.chrome.i18 |
35260 | 6e 2e 67 65 74 4d 65 73 73 61 67 65 0a 2f 2f 20 68 74 74 70 73 3a 2f 2f 64 65 76 65 6c 6f 70 65 | n.getMessage.//.https://develope |
35280 | 72 2e 63 68 72 6f 6d 65 2e 63 6f 6d 2f 65 78 74 65 6e 73 69 6f 6e 73 2f 69 31 38 6e 23 6d 65 74 | r.chrome.com/extensions/i18n#met |
352a0 | 68 6f 64 2d 67 65 74 4d 65 73 73 61 67 65 0a 2f 2f 0a 2f 2f 20 44 6f 65 73 20 6e 6f 74 20 69 6d | hod-getMessage.//.//.Does.not.im |
352c0 | 70 6c 65 6d 65 6e 74 20 70 72 65 64 65 66 69 6e 65 64 20 6d 65 73 73 61 67 65 73 3a 0a 2f 2f 20 | plement.predefined.messages:.//. |
352e0 | 68 74 74 70 73 3a 2f 2f 64 65 76 65 6c 6f 70 65 72 2e 63 68 72 6f 6d 65 2e 63 6f 6d 2f 65 78 74 | https://developer.chrome.com/ext |
35300 | 65 6e 73 69 6f 6e 73 2f 69 31 38 6e 23 6f 76 65 72 76 69 65 77 2d 70 72 65 64 65 66 69 6e 65 64 | ensions/i18n#overview-predefined |
35320 | 0a 0a 63 6f 6e 73 74 20 69 70 63 52 65 6e 64 65 72 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 40 | ..const.ipcRenderer.=.require('@ |
35340 | 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 69 70 63 2d 72 | electron/internal/renderer/ipc-r |
35360 | 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 63 6f 6e 73 74 20 66 73 20 3d 20 72 65 | enderer-internal').const.fs.=.re |
35380 | 71 75 69 72 65 28 27 66 73 27 29 0a 63 6f 6e 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 | quire('fs').const.path.=.require |
353a0 | 28 27 70 61 74 68 27 29 0a 0a 6c 65 74 20 6d 65 74 61 64 61 74 61 0a 0a 63 6f 6e 73 74 20 67 65 | ('path')..let.metadata..const.ge |
353c0 | 74 45 78 74 65 6e 73 69 6f 6e 4d 65 74 61 64 61 74 61 20 3d 20 28 65 78 74 65 6e 73 69 6f 6e 49 | tExtensionMetadata.=.(extensionI |
353e0 | 64 29 20 3d 3e 20 7b 0a 20 20 69 66 20 28 21 6d 65 74 61 64 61 74 61 29 20 7b 0a 20 20 20 20 6d | d).=>.{...if.(!metadata).{.....m |
35400 | 65 74 61 64 61 74 61 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 27 | etadata.=.ipcRenderer.sendSync(' |
35420 | 43 48 52 4f 4d 45 5f 49 31 38 4e 5f 4d 41 4e 49 46 45 53 54 27 2c 20 65 78 74 65 6e 73 69 6f 6e | CHROME_I18N_MANIFEST',.extension |
35440 | 49 64 29 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 6d 65 74 61 64 61 74 61 0a 7d 0a 0a 63 6f 6e | Id)...}...return.metadata.}..con |
35460 | 73 74 20 67 65 74 4d 65 73 73 61 67 65 73 50 61 74 68 20 3d 20 28 65 78 74 65 6e 73 69 6f 6e 49 | st.getMessagesPath.=.(extensionI |
35480 | 64 2c 20 6c 61 6e 67 75 61 67 65 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 6d 65 74 61 64 61 | d,.language).=>.{...const.metada |
354a0 | 74 61 20 3d 20 67 65 74 45 78 74 65 6e 73 69 6f 6e 4d 65 74 61 64 61 74 61 28 65 78 74 65 6e 73 | ta.=.getExtensionMetadata(extens |
354c0 | 69 6f 6e 49 64 29 0a 20 20 63 6f 6e 73 74 20 6c 6f 63 61 6c 65 73 44 69 72 65 63 74 6f 72 79 20 | ionId)...const.localesDirectory. |
354e0 | 3d 20 70 61 74 68 2e 6a 6f 69 6e 28 6d 65 74 61 64 61 74 61 2e 73 72 63 44 69 72 65 63 74 6f 72 | =.path.join(metadata.srcDirector |
35500 | 79 2c 20 27 5f 6c 6f 63 61 6c 65 73 27 29 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 63 6f 6e 73 74 | y,.'_locales')...try.{.....const |
35520 | 20 66 69 6c 65 6e 61 6d 65 20 3d 20 70 61 74 68 2e 6a 6f 69 6e 28 6c 6f 63 61 6c 65 73 44 69 72 | .filename.=.path.join(localesDir |
35540 | 65 63 74 6f 72 79 2c 20 6c 61 6e 67 75 61 67 65 2c 20 27 6d 65 73 73 61 67 65 73 2e 6a 73 6f 6e | ectory,.language,.'messages.json |
35560 | 27 29 0a 20 20 20 20 66 73 2e 61 63 63 65 73 73 53 79 6e 63 28 66 69 6c 65 6e 61 6d 65 2c 20 66 | ').....fs.accessSync(filename,.f |
35580 | 73 2e 63 6f 6e 73 74 61 6e 74 73 2e 52 5f 4f 4b 29 0a 20 20 20 20 72 65 74 75 72 6e 20 66 69 6c | s.constants.R_OK).....return.fil |
355a0 | 65 6e 61 6d 65 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 29 20 7b 0a 20 20 20 20 63 6f 6e 73 | ename...}.catch.(err).{.....cons |
355c0 | 74 20 64 65 66 61 75 6c 74 4c 6f 63 61 6c 65 20 3d 20 6d 65 74 61 64 61 74 61 2e 64 65 66 61 75 | t.defaultLocale.=.metadata.defau |
355e0 | 6c 74 5f 6c 6f 63 61 6c 65 20 7c 7c 20 27 65 6e 27 0a 20 20 20 20 72 65 74 75 72 6e 20 70 61 74 | lt_locale.||.'en'.....return.pat |
35600 | 68 2e 6a 6f 69 6e 28 6c 6f 63 61 6c 65 73 44 69 72 65 63 74 6f 72 79 2c 20 64 65 66 61 75 6c 74 | h.join(localesDirectory,.default |
35620 | 4c 6f 63 61 6c 65 2c 20 27 6d 65 73 73 61 67 65 73 2e 6a 73 6f 6e 27 29 0a 20 20 7d 0a 7d 0a 0a | Locale,.'messages.json')...}.}.. |
35640 | 63 6f 6e 73 74 20 67 65 74 4d 65 73 73 61 67 65 73 20 3d 20 28 65 78 74 65 6e 73 69 6f 6e 49 64 | const.getMessages.=.(extensionId |
35660 | 2c 20 6c 61 6e 67 75 61 67 65 29 20 3d 3e 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 63 6f 6e | ,.language).=>.{...try.{.....con |
35680 | 73 74 20 6d 65 73 73 61 67 65 73 50 61 74 68 20 3d 20 67 65 74 4d 65 73 73 61 67 65 73 50 61 74 | st.messagesPath.=.getMessagesPat |
356a0 | 68 28 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6c 61 6e 67 75 61 67 65 29 0a 20 20 20 20 72 65 74 | h(extensionId,.language).....ret |
356c0 | 75 72 6e 20 4a 53 4f 4e 2e 70 61 72 73 65 28 66 73 2e 72 65 61 64 46 69 6c 65 53 79 6e 63 28 6d | urn.JSON.parse(fs.readFileSync(m |
356e0 | 65 73 73 61 67 65 73 50 61 74 68 29 29 20 7c 7c 20 7b 7d 0a 20 20 7d 20 63 61 74 63 68 20 28 65 | essagesPath)).||.{}...}.catch.(e |
35700 | 72 72 6f 72 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 7b 7d 0a 20 20 7d 0a 7d 0a 0a 63 6f 6e | rror).{.....return.{}...}.}..con |
35720 | 73 74 20 67 65 74 4c 61 6e 67 75 61 67 65 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 72 65 74 75 72 | st.getLanguage.=.().=>.{...retur |
35740 | 6e 20 6e 61 76 69 67 61 74 6f 72 2e 6c 61 6e 67 75 61 67 65 2e 72 65 70 6c 61 63 65 28 2f 2d 2e | n.navigator.language.replace(/-. |
35760 | 2a 24 2f 2c 20 27 27 29 2e 74 6f 4c 6f 77 65 72 43 61 73 65 28 29 0a 7d 0a 0a 63 6f 6e 73 74 20 | *$/,.'').toLowerCase().}..const. |
35780 | 72 65 70 6c 61 63 65 4e 75 6d 62 65 72 65 64 53 75 62 73 74 69 74 75 74 69 6f 6e 73 20 3d 20 28 | replaceNumberedSubstitutions.=.( |
357a0 | 6d 65 73 73 61 67 65 2c 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 29 20 3d 3e 20 7b 0a 20 20 72 | message,.substitutions).=>.{...r |
357c0 | 65 74 75 72 6e 20 6d 65 73 73 61 67 65 2e 72 65 70 6c 61 63 65 28 2f 5c 24 28 5c 64 2b 29 2f 2c | eturn.message.replace(/\$(\d+)/, |
357e0 | 20 28 5f 2c 20 6e 75 6d 62 65 72 29 20 3d 3e 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 69 6e 64 65 | .(_,.number).=>.{.....const.inde |
35800 | 78 20 3d 20 70 61 72 73 65 49 6e 74 28 6e 75 6d 62 65 72 2c 20 31 30 29 20 2d 20 31 0a 20 20 20 | x.=.parseInt(number,.10).-.1.... |
35820 | 20 72 65 74 75 72 6e 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 5b 69 6e 64 65 78 5d 20 7c 7c 20 | .return.substitutions[index].||. |
35840 | 27 27 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 72 65 70 6c 61 63 65 50 6c 61 63 65 68 6f 6c | ''...}).}..const.replacePlacehol |
35860 | 64 65 72 73 20 3d 20 28 6d 65 73 73 61 67 65 2c 20 70 6c 61 63 65 68 6f 6c 64 65 72 73 2c 20 73 | ders.=.(message,.placeholders,.s |
35880 | 75 62 73 74 69 74 75 74 69 6f 6e 73 29 20 3d 3e 20 7b 0a 20 20 69 66 20 28 74 79 70 65 6f 66 20 | ubstitutions).=>.{...if.(typeof. |
358a0 | 73 75 62 73 74 69 74 75 74 69 6f 6e 73 20 3d 3d 3d 20 27 73 74 72 69 6e 67 27 29 20 7b 0a 20 20 | substitutions.===.'string').{... |
358c0 | 20 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 20 3d 20 5b 73 75 62 73 74 69 74 75 74 69 6f 6e 73 | ..substitutions.=.[substitutions |
358e0 | 5d 0a 20 20 7d 0a 20 20 69 66 20 28 21 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 73 75 62 73 74 | ]...}...if.(!Array.isArray(subst |
35900 | 69 74 75 74 69 6f 6e 73 29 29 20 7b 0a 20 20 20 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 20 3d | itutions)).{.....substitutions.= |
35920 | 20 5b 5d 0a 20 20 7d 0a 0a 20 20 69 66 20 28 70 6c 61 63 65 68 6f 6c 64 65 72 73 29 20 7b 0a 20 | .[]...}....if.(placeholders).{.. |
35940 | 20 20 20 4f 62 6a 65 63 74 2e 6b 65 79 73 28 70 6c 61 63 65 68 6f 6c 64 65 72 73 29 2e 66 6f 72 | ...Object.keys(placeholders).for |
35960 | 45 61 63 68 28 28 6e 61 6d 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 6c 65 74 20 7b 20 63 6f 6e | Each((name).=>.{.......let.{.con |
35980 | 74 65 6e 74 20 7d 20 3d 20 70 6c 61 63 65 68 6f 6c 64 65 72 73 5b 6e 61 6d 65 5d 0a 20 20 20 20 | tent.}.=.placeholders[name]..... |
359a0 | 20 20 63 6f 6e 74 65 6e 74 20 3d 20 72 65 70 6c 61 63 65 4e 75 6d 62 65 72 65 64 53 75 62 73 74 | ..content.=.replaceNumberedSubst |
359c0 | 69 74 75 74 69 6f 6e 73 28 63 6f 6e 74 65 6e 74 2c 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 29 | itutions(content,.substitutions) |
359e0 | 0a 20 20 20 20 20 20 6d 65 73 73 61 67 65 20 3d 20 6d 65 73 73 61 67 65 2e 72 65 70 6c 61 63 65 | .......message.=.message.replace |
35a00 | 28 6e 65 77 20 52 65 67 45 78 70 28 60 5c 5c 24 24 7b 6e 61 6d 65 7d 5c 5c 24 60 2c 20 27 67 69 | (new.RegExp(`\\$${name}\\$`,.'gi |
35a20 | 27 29 2c 20 63 6f 6e 74 65 6e 74 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 | '),.content).....})...}....retur |
35a40 | 6e 20 72 65 70 6c 61 63 65 4e 75 6d 62 65 72 65 64 53 75 62 73 74 69 74 75 74 69 6f 6e 73 28 6d | n.replaceNumberedSubstitutions(m |
35a60 | 65 73 73 61 67 65 2c 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 29 0a 7d 0a 0a 63 6f 6e 73 74 20 | essage,.substitutions).}..const. |
35a80 | 67 65 74 4d 65 73 73 61 67 65 20 3d 20 28 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6d 65 73 73 61 | getMessage.=.(extensionId,.messa |
35aa0 | 67 65 4e 61 6d 65 2c 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 29 20 3d 3e 20 7b 0a 20 20 63 6f | geName,.substitutions).=>.{...co |
35ac0 | 6e 73 74 20 6d 65 73 73 61 67 65 73 20 3d 20 67 65 74 4d 65 73 73 61 67 65 73 28 65 78 74 65 6e | nst.messages.=.getMessages(exten |
35ae0 | 73 69 6f 6e 49 64 2c 20 67 65 74 4c 61 6e 67 75 61 67 65 28 29 29 0a 20 20 69 66 20 28 6d 65 73 | sionId,.getLanguage())...if.(mes |
35b00 | 73 61 67 65 73 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 6d 65 73 73 61 67 65 4e 61 6d 65 | sages.hasOwnProperty(messageName |
35b20 | 29 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 7b 20 6d 65 73 73 61 67 65 2c 20 70 6c 61 63 65 68 | )).{.....const.{.message,.placeh |
35b40 | 6f 6c 64 65 72 73 20 7d 20 3d 20 6d 65 73 73 61 67 65 73 5b 6d 65 73 73 61 67 65 4e 61 6d 65 5d | olders.}.=.messages[messageName] |
35b60 | 0a 20 20 20 20 72 65 74 75 72 6e 20 72 65 70 6c 61 63 65 50 6c 61 63 65 68 6f 6c 64 65 72 73 28 | .....return.replacePlaceholders( |
35b80 | 6d 65 73 73 61 67 65 2c 20 70 6c 61 63 65 68 6f 6c 64 65 72 73 2c 20 73 75 62 73 74 69 74 75 74 | message,.placeholders,.substitut |
35ba0 | 69 6f 6e 73 29 0a 20 20 7d 0a 7d 0a 0a 65 78 70 6f 72 74 73 2e 73 65 74 75 70 20 3d 20 28 65 78 | ions)...}.}..exports.setup.=.(ex |
35bc0 | 74 65 6e 73 69 6f 6e 49 64 29 20 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 67 | tensionId).=>.{...return.{.....g |
35be0 | 65 74 4d 65 73 73 61 67 65 20 28 6d 65 73 73 61 67 65 4e 61 6d 65 2c 20 73 75 62 73 74 69 74 75 | etMessage.(messageName,.substitu |
35c00 | 74 69 6f 6e 73 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 67 65 74 4d 65 73 73 61 67 65 | tions).{.......return.getMessage |
35c20 | 28 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6d 65 73 73 61 67 65 4e 61 6d 65 2c 20 73 75 62 73 74 | (extensionId,.messageName,.subst |
35c40 | 69 74 75 74 69 6f 6e 73 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 | itutions).....}...}.}.'use.stric |
35c60 | 74 27 0a 0a 63 6f 6e 73 74 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 29 0a 63 6f 6e | t'..const.fs.=.require('fs').con |
35c80 | 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 74 68 27 29 0a 63 6f 6e 73 74 20 | st.path.=.require('path').const. |
35ca0 | 7b 20 72 65 6d 6f 74 65 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 | {.remote.}.=.require('electron') |
35cc0 | 0a 63 6f 6e 73 74 20 7b 20 61 70 70 20 7d 20 3d 20 72 65 6d 6f 74 65 0a 0a 63 6f 6e 73 74 20 67 | .const.{.app.}.=.remote..const.g |
35ce0 | 65 74 43 68 72 6f 6d 65 53 74 6f 72 61 67 65 50 61 74 68 20 3d 20 28 73 74 6f 72 61 67 65 54 79 | etChromeStoragePath.=.(storageTy |
35d00 | 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 29 20 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e 20 70 | pe,.extensionId).=>.{...return.p |
35d20 | 61 74 68 2e 6a 6f 69 6e 28 0a 20 20 20 20 61 70 70 2e 67 65 74 50 61 74 68 28 27 75 73 65 72 44 | ath.join(.....app.getPath('userD |
35d40 | 61 74 61 27 29 2c 20 60 2f 43 68 72 6f 6d 65 20 53 74 6f 72 61 67 65 2f 24 7b 65 78 74 65 6e 73 | ata'),.`/Chrome.Storage/${extens |
35d60 | 69 6f 6e 49 64 7d 2d 24 7b 73 74 6f 72 61 67 65 54 79 70 65 7d 2e 6a 73 6f 6e 60 29 0a 7d 0a 0a | ionId}-${storageType}.json`).}.. |
35d80 | 63 6f 6e 73 74 20 6d 6b 64 69 72 70 20 3d 20 28 64 69 72 2c 20 63 61 6c 6c 62 61 63 6b 29 20 3d | const.mkdirp.=.(dir,.callback).= |
35da0 | 3e 20 7b 0a 20 20 66 73 2e 6d 6b 64 69 72 28 64 69 72 2c 20 28 65 72 72 6f 72 29 20 3d 3e 20 7b | >.{...fs.mkdir(dir,.(error).=>.{ |
35dc0 | 0a 20 20 20 20 69 66 20 28 65 72 72 6f 72 20 26 26 20 65 72 72 6f 72 2e 63 6f 64 65 20 3d 3d 3d | .....if.(error.&&.error.code.=== |
35de0 | 20 27 45 4e 4f 45 4e 54 27 29 20 7b 0a 20 20 20 20 20 20 6d 6b 64 69 72 70 28 70 61 74 68 2e 64 | .'ENOENT').{.......mkdirp(path.d |
35e00 | 69 72 6e 61 6d 65 28 64 69 72 29 2c 20 28 65 72 72 6f 72 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 | irname(dir),.(error).=>.{....... |
35e20 | 20 20 69 66 20 28 21 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 6d 6b 64 69 72 70 | ..if.(!error).{...........mkdirp |
35e40 | 28 64 69 72 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 | (dir,.callback).........}....... |
35e60 | 7d 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 28 65 72 72 6f 72 20 26 26 20 65 72 72 6f 72 | }).....}.else.if.(error.&&.error |
35e80 | 2e 63 6f 64 65 20 3d 3d 3d 20 27 45 45 58 49 53 54 27 29 20 7b 0a 20 20 20 20 20 20 63 61 6c 6c | .code.===.'EEXIST').{.......call |
35ea0 | 62 61 63 6b 28 6e 75 6c 6c 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 63 61 | back(null).....}.else.{.......ca |
35ec0 | 6c 6c 62 61 63 6b 28 65 72 72 6f 72 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 | llback(error).....}...}).}..cons |
35ee0 | 74 20 72 65 61 64 43 68 72 6f 6d 65 53 74 6f 72 61 67 65 46 69 6c 65 20 3d 20 28 73 74 6f 72 61 | t.readChromeStorageFile.=.(stora |
35f00 | 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 63 62 29 20 3d 3e 20 7b 0a 20 20 | geType,.extensionId,.cb).=>.{... |
35f20 | 63 6f 6e 73 74 20 66 69 6c 65 50 61 74 68 20 3d 20 67 65 74 43 68 72 6f 6d 65 53 74 6f 72 61 67 | const.filePath.=.getChromeStorag |
35f40 | 65 50 61 74 68 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 29 0a | ePath(storageType,.extensionId). |
35f60 | 20 20 66 73 2e 72 65 61 64 46 69 6c 65 28 66 69 6c 65 50 61 74 68 2c 20 27 75 74 66 38 27 2c 20 | ..fs.readFile(filePath,.'utf8',. |
35f80 | 28 65 72 72 2c 20 64 61 74 61 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 65 72 72 20 26 26 20 | (err,.data).=>.{.....if.(err.&&. |
35fa0 | 65 72 72 2e 63 6f 64 65 20 3d 3d 3d 20 27 45 4e 4f 45 4e 54 27 29 20 7b 0a 20 20 20 20 20 20 72 | err.code.===.'ENOENT').{.......r |
35fc0 | 65 74 75 72 6e 20 63 62 28 6e 75 6c 6c 2c 20 6e 75 6c 6c 29 0a 20 20 20 20 7d 0a 20 20 20 20 63 | eturn.cb(null,.null).....}.....c |
35fe0 | 62 28 65 72 72 2c 20 64 61 74 61 29 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 77 72 69 74 65 | b(err,.data)...}).}..const.write |
36000 | 43 68 72 6f 6d 65 53 74 6f 72 61 67 65 46 69 6c 65 20 3d 20 28 73 74 6f 72 61 67 65 54 79 70 65 | ChromeStorageFile.=.(storageType |
36020 | 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 64 61 74 61 2c 20 63 62 29 20 3d 3e 20 7b 0a 20 20 | ,.extensionId,.data,.cb).=>.{... |
36040 | 63 6f 6e 73 74 20 66 69 6c 65 50 61 74 68 20 3d 20 67 65 74 43 68 72 6f 6d 65 53 74 6f 72 61 67 | const.filePath.=.getChromeStorag |
36060 | 65 50 61 74 68 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 29 0a | ePath(storageType,.extensionId). |
36080 | 0a 20 20 6d 6b 64 69 72 70 28 70 61 74 68 2e 64 69 72 6e 61 6d 65 28 66 69 6c 65 50 61 74 68 29 | ...mkdirp(path.dirname(filePath) |
360a0 | 2c 20 65 72 72 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 65 72 72 29 20 7b 20 2f 2a 20 77 65 20 | ,.err.=>.{.....if.(err).{./*.we. |
360c0 | 6a 75 73 74 20 69 67 6e 6f 72 65 20 74 68 65 20 65 72 72 6f 72 73 20 6f 66 20 6d 6b 64 69 72 20 | just.ignore.the.errors.of.mkdir. |
360e0 | 6f 72 20 6d 6b 64 69 72 70 20 2a 2f 20 7d 0a 20 20 20 20 66 73 2e 77 72 69 74 65 46 69 6c 65 28 | or.mkdirp.*/.}.....fs.writeFile( |
36100 | 66 69 6c 65 50 61 74 68 2c 20 64 61 74 61 2c 20 63 62 29 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 | filePath,.data,.cb)...}).}..cons |
36120 | 74 20 67 65 74 53 74 6f 72 61 67 65 20 3d 20 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 | t.getStorage.=.(storageType,.ext |
36140 | 65 6e 73 69 6f 6e 49 64 2c 20 63 62 29 20 3d 3e 20 7b 0a 20 20 72 65 61 64 43 68 72 6f 6d 65 53 | ensionId,.cb).=>.{...readChromeS |
36160 | 74 6f 72 61 67 65 46 69 6c 65 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f | torageFile(storageType,.extensio |
36180 | 6e 49 64 2c 20 28 65 72 72 2c 20 64 61 74 61 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 65 72 | nId,.(err,.data).=>.{.....if.(er |
361a0 | 72 29 20 74 68 72 6f 77 20 65 72 72 0a 20 20 20 20 69 66 20 28 21 63 62 29 20 74 68 72 6f 77 20 | r).throw.err.....if.(!cb).throw. |
361c0 | 6e 65 77 20 54 79 70 65 45 72 72 6f 72 28 27 4e 6f 20 63 61 6c 6c 62 61 63 6b 20 70 72 6f 76 69 | new.TypeError('No.callback.provi |
361e0 | 64 65 64 27 29 0a 0a 20 20 20 20 69 66 20 28 64 61 74 61 20 21 3d 3d 20 6e 75 6c 6c 29 20 7b 0a | ded')......if.(data.!==.null).{. |
36200 | 20 20 20 20 20 20 63 62 28 4a 53 4f 4e 2e 70 61 72 73 65 28 64 61 74 61 29 29 0a 20 20 20 20 7d | ......cb(JSON.parse(data)).....} |
36220 | 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 2f 2f 20 44 69 73 61 62 6c 65 64 20 64 75 65 20 74 6f | .else.{.......//.Disabled.due.to |
36240 | 20 66 61 6c 73 65 20 70 6f 73 69 74 69 76 65 20 69 6e 20 53 74 61 6e 64 61 72 64 4a 53 0a 20 20 | .false.positive.in.StandardJS... |
36260 | 20 20 20 20 2f 2f 20 65 73 6c 69 6e 74 2d 64 69 73 61 62 6c 65 2d 6e 65 78 74 2d 6c 69 6e 65 20 | ....//.eslint-disable-next-line. |
36280 | 73 74 61 6e 64 61 72 64 2f 6e 6f 2d 63 61 6c 6c 62 61 63 6b 2d 6c 69 74 65 72 61 6c 0a 20 20 20 | standard/no-callback-literal.... |
362a0 | 20 20 20 63 62 28 7b 7d 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 73 65 | ...cb({}).....}...}).}..const.se |
362c0 | 74 53 74 6f 72 61 67 65 20 3d 20 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 | tStorage.=.(storageType,.extensi |
362e0 | 6f 6e 49 64 2c 20 73 74 6f 72 61 67 65 2c 20 63 62 29 20 3d 3e 20 7b 0a 20 20 63 6f 6e 73 74 20 | onId,.storage,.cb).=>.{...const. |
36300 | 6a 73 6f 6e 20 3d 20 4a 53 4f 4e 2e 73 74 72 69 6e 67 69 66 79 28 73 74 6f 72 61 67 65 29 0a 20 | json.=.JSON.stringify(storage).. |
36320 | 20 77 72 69 74 65 43 68 72 6f 6d 65 53 74 6f 72 61 67 65 46 69 6c 65 28 73 74 6f 72 61 67 65 54 | .writeChromeStorageFile(storageT |
36340 | 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 6a 73 6f 6e 2c 20 65 72 72 20 3d 3e 20 7b | ype,.extensionId,.json,.err.=>.{ |
36360 | 0a 20 20 20 20 69 66 20 28 65 72 72 29 20 74 68 72 6f 77 20 65 72 72 0a 20 20 20 20 69 66 20 28 | .....if.(err).throw.err.....if.( |
36380 | 63 62 29 20 63 62 28 29 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 67 65 74 53 74 6f 72 61 67 | cb).cb()...}).}..const.getStorag |
363a0 | 65 4d 61 6e 61 67 65 72 20 3d 20 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 | eManager.=.(storageType,.extensi |
363c0 | 6f 6e 49 64 29 20 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e 20 7b 0a 20 20 20 20 67 65 74 20 28 6b | onId).=>.{...return.{.....get.(k |
363e0 | 65 79 73 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 67 65 74 53 74 6f 72 61 67 | eys,.callback).{.......getStorag |
36400 | 65 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 73 74 6f 72 | e(storageType,.extensionId,.stor |
36420 | 61 67 65 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 6b 65 79 73 20 3d 3d 20 6e 75 6c | age.=>.{.........if.(keys.==.nul |
36440 | 6c 29 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 73 74 6f 72 61 67 65 29 0a 0a 20 20 20 | l).return.callback(storage)..... |
36460 | 20 20 20 20 20 6c 65 74 20 64 65 66 61 75 6c 74 73 20 3d 20 7b 7d 0a 20 20 20 20 20 20 20 20 73 | .....let.defaults.=.{}.........s |
36480 | 77 69 74 63 68 20 28 74 79 70 65 6f 66 20 6b 65 79 73 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 | witch.(typeof.keys).{........... |
364a0 | 63 61 73 65 20 27 73 74 72 69 6e 67 27 3a 0a 20 20 20 20 20 20 20 20 20 20 20 20 6b 65 79 73 20 | case.'string':.............keys. |
364c0 | 3d 20 5b 6b 65 79 73 5d 0a 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b 0a 20 20 20 20 20 | =.[keys].............break...... |
364e0 | 20 20 20 20 20 63 61 73 65 20 27 6f 62 6a 65 63 74 27 3a 0a 20 20 20 20 20 20 20 20 20 20 20 20 | .....case.'object':............. |
36500 | 69 66 20 28 21 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 6b 65 79 73 29 29 20 7b 0a 20 20 20 20 | if.(!Array.isArray(keys)).{..... |
36520 | 20 20 20 20 20 20 20 20 20 20 64 65 66 61 75 6c 74 73 20 3d 20 6b 65 79 73 0a 20 20 20 20 20 20 | ..........defaults.=.keys....... |
36540 | 20 20 20 20 20 20 20 20 6b 65 79 73 20 3d 20 4f 62 6a 65 63 74 2e 6b 65 79 73 28 6b 65 79 73 29 | ........keys.=.Object.keys(keys) |
36560 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 20 20 20 62 72 65 61 6b | .............}.............break |
36580 | 0a 20 20 20 20 20 20 20 20 7d 0a 0a 20 20 20 20 20 20 20 20 2f 2f 20 44 69 73 61 62 6c 65 64 20 | .........}..........//.Disabled. |
365a0 | 64 75 65 20 74 6f 20 66 61 6c 73 65 20 70 6f 73 69 74 69 76 65 20 69 6e 20 53 74 61 6e 64 61 72 | due.to.false.positive.in.Standar |
365c0 | 64 4a 53 0a 20 20 20 20 20 20 20 20 2f 2f 20 65 73 6c 69 6e 74 2d 64 69 73 61 62 6c 65 2d 6e 65 | dJS.........//.eslint-disable-ne |
365e0 | 78 74 2d 6c 69 6e 65 20 73 74 61 6e 64 61 72 64 2f 6e 6f 2d 63 61 6c 6c 62 61 63 6b 2d 6c 69 74 | xt-line.standard/no-callback-lit |
36600 | 65 72 61 6c 0a 20 20 20 20 20 20 20 20 69 66 20 28 6b 65 79 73 2e 6c 65 6e 67 74 68 20 3d 3d 3d | eral.........if.(keys.length.=== |
36620 | 20 30 29 20 72 65 74 75 72 6e 20 63 61 6c 6c 62 61 63 6b 28 7b 7d 29 0a 0a 20 20 20 20 20 20 20 | .0).return.callback({})......... |
36640 | 20 63 6f 6e 73 74 20 69 74 65 6d 73 20 3d 20 7b 7d 0a 20 20 20 20 20 20 20 20 6b 65 79 73 2e 66 | .const.items.=.{}.........keys.f |
36660 | 6f 72 45 61 63 68 28 66 75 6e 63 74 69 6f 6e 20 28 6b 65 79 29 20 7b 0a 20 20 20 20 20 20 20 20 | orEach(function.(key).{......... |
36680 | 20 20 6c 65 74 20 76 61 6c 75 65 20 3d 20 73 74 6f 72 61 67 65 5b 6b 65 79 5d 0a 20 20 20 20 20 | ..let.value.=.storage[key]...... |
366a0 | 20 20 20 20 20 69 66 20 28 76 61 6c 75 65 20 3d 3d 20 6e 75 6c 6c 29 20 76 61 6c 75 65 20 3d 20 | .....if.(value.==.null).value.=. |
366c0 | 64 65 66 61 75 6c 74 73 5b 6b 65 79 5d 0a 20 20 20 20 20 20 20 20 20 20 69 74 65 6d 73 5b 6b 65 | defaults[key]...........items[ke |
366e0 | 79 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 20 20 63 61 | y].=.value.........}).........ca |
36700 | 6c 6c 62 61 63 6b 28 69 74 65 6d 73 29 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 7d 2c 0a 0a 20 | llback(items).......}).....},... |
36720 | 20 20 20 73 65 74 20 28 69 74 65 6d 73 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 | ...set.(items,.callback).{...... |
36740 | 20 67 65 74 53 74 6f 72 61 67 65 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 | .getStorage(storageType,.extensi |
36760 | 6f 6e 49 64 2c 20 73 74 6f 72 61 67 65 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 4f 62 6a 65 63 | onId,.storage.=>.{.........Objec |
36780 | 74 2e 6b 65 79 73 28 69 74 65 6d 73 29 2e 66 6f 72 45 61 63 68 28 66 75 6e 63 74 69 6f 6e 20 28 | t.keys(items).forEach(function.( |
367a0 | 6e 61 6d 65 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 73 74 6f 72 61 67 65 5b 6e 61 6d 65 5d 20 | name).{...........storage[name]. |
367c0 | 3d 20 69 74 65 6d 73 5b 6e 61 6d 65 5d 0a 20 20 20 20 20 20 20 20 7d 29 0a 0a 20 20 20 20 20 20 | =.items[name].........})........ |
367e0 | 20 20 73 65 74 53 74 6f 72 61 67 65 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 | ..setStorage(storageType,.extens |
36800 | 69 6f 6e 49 64 2c 20 73 74 6f 72 61 67 65 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 20 20 20 20 | ionId,.storage,.callback)....... |
36820 | 7d 29 0a 20 20 20 20 7d 2c 0a 0a 20 20 20 20 72 65 6d 6f 76 65 20 28 6b 65 79 73 2c 20 63 61 6c | }).....},......remove.(keys,.cal |
36840 | 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 67 65 74 53 74 6f 72 61 67 65 28 73 74 6f 72 61 67 | lback).{.......getStorage(storag |
36860 | 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 2c 20 73 74 6f 72 61 67 65 20 3d 3e 20 7b | eType,.extensionId,.storage.=>.{ |
36880 | 0a 20 20 20 20 20 20 20 20 69 66 20 28 21 41 72 72 61 79 2e 69 73 41 72 72 61 79 28 6b 65 79 73 | .........if.(!Array.isArray(keys |
368a0 | 29 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 6b 65 79 73 20 3d 20 5b 6b 65 79 73 5d 0a 20 20 20 | )).{...........keys.=.[keys].... |
368c0 | 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 6b 65 79 73 2e 66 6f 72 45 61 63 68 28 66 75 6e 63 | .....}.........keys.forEach(func |
368e0 | 74 69 6f 6e 20 28 6b 65 79 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 64 65 6c 65 74 65 20 73 74 | tion.(key).{...........delete.st |
36900 | 6f 72 61 67 65 5b 6b 65 79 5d 0a 20 20 20 20 20 20 20 20 7d 29 0a 0a 20 20 20 20 20 20 20 20 73 | orage[key].........})..........s |
36920 | 65 74 53 74 6f 72 61 67 65 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 65 6e 73 69 6f 6e | etStorage(storageType,.extension |
36940 | 49 64 2c 20 73 74 6f 72 61 67 65 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 20 20 20 20 7d 29 0a | Id,.storage,.callback).......}). |
36960 | 20 20 20 20 7d 2c 0a 0a 20 20 20 20 63 6c 65 61 72 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 | ....},......clear.(callback).{.. |
36980 | 20 20 20 20 20 73 65 74 53 74 6f 72 61 67 65 28 73 74 6f 72 61 67 65 54 79 70 65 2c 20 65 78 74 | .....setStorage(storageType,.ext |
369a0 | 65 6e 73 69 6f 6e 49 64 2c 20 7b 7d 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 20 20 20 7d 0a 20 20 | ensionId,.{},.callback).....}... |
369c0 | 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 7b 0a 20 20 73 65 74 75 70 3a | }.}..module.exports.=.{...setup: |
369e0 | 20 65 78 74 65 6e 73 69 6f 6e 49 64 20 3d 3e 20 28 7b 0a 20 20 20 20 73 79 6e 63 3a 20 67 65 74 | .extensionId.=>.({.....sync:.get |
36a00 | 53 74 6f 72 61 67 65 4d 61 6e 61 67 65 72 28 27 73 79 6e 63 27 2c 20 65 78 74 65 6e 73 69 6f 6e | StorageManager('sync',.extension |
36a20 | 49 64 29 2c 0a 20 20 20 20 6c 6f 63 61 6c 3a 20 67 65 74 53 74 6f 72 61 67 65 4d 61 6e 61 67 65 | Id),.....local:.getStorageManage |
36a40 | 72 28 27 6c 6f 63 61 6c 27 2c 20 65 78 74 65 6e 73 69 6f 6e 49 64 29 0a 20 20 7d 29 0a 7d 0a 27 | r('local',.extensionId)...}).}.' |
36a60 | 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 45 76 65 6e 74 20 3d 20 72 65 71 75 69 | use.strict'..const.Event.=.requi |
36a80 | 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f | re('@electron/internal/renderer/ |
36aa0 | 65 78 74 65 6e 73 69 6f 6e 73 2f 65 76 65 6e 74 27 29 0a 63 6f 6e 73 74 20 69 70 63 52 65 6e 64 | extensions/event').const.ipcRend |
36ac0 | 65 72 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e | erer.=.require('@electron/intern |
36ae0 | 61 6c 2f 72 65 6e 64 65 72 65 72 2f 69 70 63 2d 72 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 6e 61 | al/renderer/ipc-renderer-interna |
36b00 | 6c 27 29 0a 0a 63 6c 61 73 73 20 57 65 62 4e 61 76 69 67 61 74 69 6f 6e 20 7b 0a 20 20 63 6f 6e | l')..class.WebNavigation.{...con |
36b20 | 73 74 72 75 63 74 6f 72 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 6f 6e 42 65 66 6f 72 65 4e | structor.().{.....this.onBeforeN |
36b40 | 61 76 69 67 61 74 65 20 3d 20 6e 65 77 20 45 76 65 6e 74 28 29 0a 20 20 20 20 74 68 69 73 2e 6f | avigate.=.new.Event().....this.o |
36b60 | 6e 43 6f 6d 70 6c 65 74 65 64 20 3d 20 6e 65 77 20 45 76 65 6e 74 28 29 0a 0a 20 20 20 20 69 70 | nCompleted.=.new.Event()......ip |
36b80 | 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 43 48 52 4f 4d 45 5f 57 45 42 4e 41 56 49 47 41 54 49 | cRenderer.on('CHROME_WEBNAVIGATI |
36ba0 | 4f 4e 5f 4f 4e 42 45 46 4f 52 45 4e 41 56 49 47 41 54 45 27 2c 20 28 65 76 65 6e 74 2c 20 64 65 | ON_ONBEFORENAVIGATE',.(event,.de |
36bc0 | 74 61 69 6c 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 6f 6e 42 65 66 6f 72 65 4e | tails).=>.{.......this.onBeforeN |
36be0 | 61 76 69 67 61 74 65 2e 65 6d 69 74 28 64 65 74 61 69 6c 73 29 0a 20 20 20 20 7d 29 0a 0a 20 20 | avigate.emit(details).....}).... |
36c00 | 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 43 48 52 4f 4d 45 5f 57 45 42 4e 41 56 49 | ..ipcRenderer.on('CHROME_WEBNAVI |
36c20 | 47 41 54 49 4f 4e 5f 4f 4e 43 4f 4d 50 4c 45 54 45 44 27 2c 20 28 65 76 65 6e 74 2c 20 64 65 74 | GATION_ONCOMPLETED',.(event,.det |
36c40 | 61 69 6c 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 6f 6e 43 6f 6d 70 6c 65 74 65 | ails).=>.{.......this.onComplete |
36c60 | 64 2e 65 6d 69 74 28 64 65 74 61 69 6c 73 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 7d 0a 0a 65 78 | d.emit(details).....})...}.}..ex |
36c80 | 70 6f 72 74 73 2e 73 65 74 75 70 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 72 65 74 75 72 6e 20 6e | ports.setup.=.().=>.{...return.n |
36ca0 | 65 77 20 57 65 62 4e 61 76 69 67 61 74 69 6f 6e 28 29 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 | ew.WebNavigation().}.'use.strict |
36cc0 | 27 0a 0a 63 6f 6e 73 74 20 7b 20 45 76 65 6e 74 45 6d 69 74 74 65 72 20 7d 20 3d 20 72 65 71 75 | '..const.{.EventEmitter.}.=.requ |
36ce0 | 69 72 65 28 27 65 76 65 6e 74 73 27 29 0a 63 6f 6e 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 | ire('events').const.path.=.requi |
36d00 | 72 65 28 27 70 61 74 68 27 29 0a 63 6f 6e 73 74 20 4d 6f 64 75 6c 65 20 3d 20 72 65 71 75 69 72 | re('path').const.Module.=.requir |
36d20 | 65 28 27 6d 6f 64 75 6c 65 27 29 0a 0a 2f 2f 20 57 65 20 6d 6f 64 69 66 69 65 64 20 74 68 65 20 | e('module')..//.We.modified.the. |
36d40 | 6f 72 69 67 69 6e 61 6c 20 70 72 6f 63 65 73 73 2e 61 72 67 76 20 74 6f 20 6c 65 74 20 6e 6f 64 | original.process.argv.to.let.nod |
36d60 | 65 2e 6a 73 20 6c 6f 61 64 20 74 68 65 0a 2f 2f 20 69 6e 69 74 2e 6a 73 2c 20 77 65 20 6e 65 65 | e.js.load.the.//.init.js,.we.nee |
36d80 | 64 20 74 6f 20 72 65 73 74 6f 72 65 20 69 74 20 68 65 72 65 2e 0a 70 72 6f 63 65 73 73 2e 61 72 | d.to.restore.it.here..process.ar |
36da0 | 67 76 2e 73 70 6c 69 63 65 28 31 2c 20 31 29 0a 0a 2f 2f 20 43 6c 65 61 72 20 73 65 61 72 63 68 | gv.splice(1,.1)..//.Clear.search |
36dc0 | 20 70 61 74 68 73 2e 0a 72 65 71 75 69 72 65 28 27 2e 2e 2f 63 6f 6d 6d 6f 6e 2f 72 65 73 65 74 | .paths..require('../common/reset |
36de0 | 2d 73 65 61 72 63 68 2d 70 61 74 68 73 27 29 0a 0a 2f 2f 20 49 6d 70 6f 72 74 20 63 6f 6d 6d 6f | -search-paths')..//.Import.commo |
36e00 | 6e 20 73 65 74 74 69 6e 67 73 2e 0a 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 | n.settings..require('@electron/i |
36e20 | 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 69 6e 69 74 27 29 0a 0a 63 6f 6e 73 74 20 67 6c 6f | nternal/common/init')..const.glo |
36e40 | 62 61 6c 50 61 74 68 73 20 3d 20 4d 6f 64 75 6c 65 2e 67 6c 6f 62 61 6c 50 61 74 68 73 0a 0a 2f | balPaths.=.Module.globalPaths../ |
36e60 | 2f 20 45 78 70 6f 73 65 20 70 75 62 6c 69 63 20 41 50 49 73 2e 0a 67 6c 6f 62 61 6c 50 61 74 68 | /.Expose.public.APIs..globalPath |
36e80 | 73 2e 70 75 73 68 28 70 61 74 68 2e 6a 6f 69 6e 28 5f 5f 64 69 72 6e 61 6d 65 2c 20 27 61 70 69 | s.push(path.join(__dirname,.'api |
36ea0 | 27 2c 20 27 65 78 70 6f 72 74 73 27 29 29 0a 0a 2f 2f 20 54 68 65 20 67 6c 6f 62 61 6c 20 76 61 | ',.'exports'))..//.The.global.va |
36ec0 | 72 69 61 62 6c 65 20 77 69 6c 6c 20 62 65 20 75 73 65 64 20 62 79 20 69 70 63 20 66 6f 72 20 65 | riable.will.be.used.by.ipc.for.e |
36ee0 | 76 65 6e 74 20 64 69 73 70 61 74 63 68 69 6e 67 0a 63 6f 6e 73 74 20 76 38 55 74 69 6c 20 3d 20 | vent.dispatching.const.v8Util.=. |
36f00 | 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 5f 75 74 69 6c 27 29 0a 0a | process.atomBinding('v8_util').. |
36f20 | 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 67 6c 6f 62 61 6c 2c 20 27 69 | v8Util.setHiddenValue(global,.'i |
36f40 | 70 63 27 2c 20 6e 65 77 20 45 76 65 6e 74 45 6d 69 74 74 65 72 28 29 29 0a 76 38 55 74 69 6c 2e | pc',.new.EventEmitter()).v8Util. |
36f60 | 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 67 6c 6f 62 61 6c 2c 20 27 69 70 63 2d 69 6e 74 65 | setHiddenValue(global,.'ipc-inte |
36f80 | 72 6e 61 6c 27 2c 20 6e 65 77 20 45 76 65 6e 74 45 6d 69 74 74 65 72 28 29 29 0a 0a 2f 2f 20 55 | rnal',.new.EventEmitter())..//.U |
36fa0 | 73 65 20 65 6c 65 63 74 72 6f 6e 20 6d 6f 64 75 6c 65 20 61 66 74 65 72 20 65 76 65 72 79 74 68 | se.electron.module.after.everyth |
36fc0 | 69 6e 67 20 69 73 20 72 65 61 64 79 2e 0a 63 6f 6e 73 74 20 69 70 63 52 65 6e 64 65 72 65 72 20 | ing.is.ready..const.ipcRenderer. |
36fe0 | 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 | =.require('@electron/internal/re |
37000 | 6e 64 65 72 65 72 2f 69 70 63 2d 72 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 0a | nderer/ipc-renderer-internal').. |
37020 | 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 | require('@electron/internal/rend |
37040 | 65 72 65 72 2f 77 65 62 2d 66 72 61 6d 65 2d 69 6e 69 74 27 29 28 29 0a 0a 2f 2f 20 50 72 6f 63 | erer/web-frame-init')()..//.Proc |
37060 | 65 73 73 20 63 6f 6d 6d 61 6e 64 20 6c 69 6e 65 20 61 72 67 75 6d 65 6e 74 73 2e 0a 6c 65 74 20 | ess.command.line.arguments..let. |
37080 | 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 20 3d 20 66 61 6c 73 65 0a 6c 65 74 20 77 65 62 76 | nodeIntegration.=.false.let.webv |
370a0 | 69 65 77 54 61 67 20 3d 20 66 61 6c 73 65 0a 6c 65 74 20 70 72 65 6c 6f 61 64 53 63 72 69 70 74 | iewTag.=.false.let.preloadScript |
370c0 | 20 3d 20 6e 75 6c 6c 0a 6c 65 74 20 70 72 65 6c 6f 61 64 53 63 72 69 70 74 73 20 3d 20 5b 5d 0a | .=.null.let.preloadScripts.=.[]. |
370e0 | 6c 65 74 20 69 73 42 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 20 3d 20 66 61 6c 73 65 0a 6c 65 74 | let.isBackgroundPage.=.false.let |
37100 | 20 61 70 70 50 61 74 68 20 3d 20 6e 75 6c 6c 0a 66 6f 72 20 28 63 6f 6e 73 74 20 61 72 67 20 6f | .appPath.=.null.for.(const.arg.o |
37120 | 66 20 70 72 6f 63 65 73 73 2e 61 72 67 76 29 20 7b 0a 20 20 69 66 20 28 61 72 67 2e 69 6e 64 65 | f.process.argv).{...if.(arg.inde |
37140 | 78 4f 66 28 27 2d 2d 67 75 65 73 74 2d 69 6e 73 74 61 6e 63 65 2d 69 64 3d 27 29 20 3d 3d 3d 20 | xOf('--guest-instance-id=').===. |
37160 | 30 29 20 7b 0a 20 20 20 20 2f 2f 20 54 68 69 73 20 69 73 20 61 20 67 75 65 73 74 20 77 65 62 20 | 0).{.....//.This.is.a.guest.web. |
37180 | 76 69 65 77 2e 0a 20 20 20 20 70 72 6f 63 65 73 73 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 | view......process.guestInstanceI |
371a0 | 64 20 3d 20 70 61 72 73 65 49 6e 74 28 61 72 67 2e 73 75 62 73 74 72 28 61 72 67 2e 69 6e 64 65 | d.=.parseInt(arg.substr(arg.inde |
371c0 | 78 4f 66 28 27 3d 27 29 20 2b 20 31 29 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 67 2e | xOf('=').+.1))...}.else.if.(arg. |
371e0 | 69 6e 64 65 78 4f 66 28 27 2d 2d 6f 70 65 6e 65 72 2d 69 64 3d 27 29 20 3d 3d 3d 20 30 29 20 7b | indexOf('--opener-id=').===.0).{ |
37200 | 0a 20 20 20 20 2f 2f 20 54 68 69 73 20 69 73 20 61 20 67 75 65 73 74 20 42 72 6f 77 73 65 72 57 | .....//.This.is.a.guest.BrowserW |
37220 | 69 6e 64 6f 77 2e 0a 20 20 20 20 70 72 6f 63 65 73 73 2e 6f 70 65 6e 65 72 49 64 20 3d 20 70 61 | indow......process.openerId.=.pa |
37240 | 72 73 65 49 6e 74 28 61 72 67 2e 73 75 62 73 74 72 28 61 72 67 2e 69 6e 64 65 78 4f 66 28 27 3d | rseInt(arg.substr(arg.indexOf('= |
37260 | 27 29 20 2b 20 31 29 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 67 2e 69 6e 64 65 78 4f | ').+.1))...}.else.if.(arg.indexO |
37280 | 66 28 27 2d 2d 6e 6f 64 65 2d 69 6e 74 65 67 72 61 74 69 6f 6e 3d 27 29 20 3d 3d 3d 20 30 29 20 | f('--node-integration=').===.0). |
372a0 | 7b 0a 20 20 20 20 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 20 3d 20 61 72 67 2e 73 75 62 73 | {.....nodeIntegration.=.arg.subs |
372c0 | 74 72 28 61 72 67 2e 69 6e 64 65 78 4f 66 28 27 3d 27 29 20 2b 20 31 29 20 3d 3d 3d 20 27 74 72 | tr(arg.indexOf('=').+.1).===.'tr |
372e0 | 75 65 27 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 67 2e 69 6e 64 65 78 4f 66 28 27 2d 2d | ue'...}.else.if.(arg.indexOf('-- |
37300 | 70 72 65 6c 6f 61 64 3d 27 29 20 3d 3d 3d 20 30 29 20 7b 0a 20 20 20 20 70 72 65 6c 6f 61 64 53 | preload=').===.0).{.....preloadS |
37320 | 63 72 69 70 74 20 3d 20 61 72 67 2e 73 75 62 73 74 72 28 61 72 67 2e 69 6e 64 65 78 4f 66 28 27 | cript.=.arg.substr(arg.indexOf(' |
37340 | 3d 27 29 20 2b 20 31 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 67 20 3d 3d 3d 20 27 2d | =').+.1)...}.else.if.(arg.===.'- |
37360 | 2d 62 61 63 6b 67 72 6f 75 6e 64 2d 70 61 67 65 27 29 20 7b 0a 20 20 20 20 69 73 42 61 63 6b 67 | -background-page').{.....isBackg |
37380 | 72 6f 75 6e 64 50 61 67 65 20 3d 20 74 72 75 65 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 | roundPage.=.true...}.else.if.(ar |
373a0 | 67 2e 69 6e 64 65 78 4f 66 28 27 2d 2d 61 70 70 2d 70 61 74 68 3d 27 29 20 3d 3d 3d 20 30 29 20 | g.indexOf('--app-path=').===.0). |
373c0 | 7b 0a 20 20 20 20 61 70 70 50 61 74 68 20 3d 20 61 72 67 2e 73 75 62 73 74 72 28 61 72 67 2e 69 | {.....appPath.=.arg.substr(arg.i |
373e0 | 6e 64 65 78 4f 66 28 27 3d 27 29 20 2b 20 31 29 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 | ndexOf('=').+.1)...}.else.if.(ar |
37400 | 67 2e 69 6e 64 65 78 4f 66 28 27 2d 2d 77 65 62 76 69 65 77 2d 74 61 67 3d 27 29 20 3d 3d 3d 20 | g.indexOf('--webview-tag=').===. |
37420 | 30 29 20 7b 0a 20 20 20 20 77 65 62 76 69 65 77 54 61 67 20 3d 20 61 72 67 2e 73 75 62 73 74 72 | 0).{.....webviewTag.=.arg.substr |
37440 | 28 61 72 67 2e 69 6e 64 65 78 4f 66 28 27 3d 27 29 20 2b 20 31 29 20 3d 3d 3d 20 27 74 72 75 65 | (arg.indexOf('=').+.1).===.'true |
37460 | 27 0a 20 20 7d 20 65 6c 73 65 20 69 66 20 28 61 72 67 2e 69 6e 64 65 78 4f 66 28 27 2d 2d 70 72 | '...}.else.if.(arg.indexOf('--pr |
37480 | 65 6c 6f 61 64 2d 73 63 72 69 70 74 73 27 29 20 3d 3d 3d 20 30 29 20 7b 0a 20 20 20 20 70 72 65 | eload-scripts').===.0).{.....pre |
374a0 | 6c 6f 61 64 53 63 72 69 70 74 73 20 3d 20 61 72 67 2e 73 75 62 73 74 72 28 61 72 67 2e 69 6e 64 | loadScripts.=.arg.substr(arg.ind |
374c0 | 65 78 4f 66 28 27 3d 27 29 20 2b 20 31 29 2e 73 70 6c 69 74 28 70 61 74 68 2e 64 65 6c 69 6d 69 | exOf('=').+.1).split(path.delimi |
374e0 | 74 65 72 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 54 68 65 20 77 65 62 43 6f 6e 74 65 6e 74 73 20 70 | ter)...}.}..//.The.webContents.p |
37500 | 72 65 6c 6f 61 64 20 73 63 72 69 70 74 20 69 73 20 6c 6f 61 64 65 64 20 61 66 74 65 72 20 74 68 | reload.script.is.loaded.after.th |
37520 | 65 20 73 65 73 73 69 6f 6e 20 70 72 65 6c 6f 61 64 20 73 63 72 69 70 74 73 2e 0a 69 66 20 28 70 | e.session.preload.scripts..if.(p |
37540 | 72 65 6c 6f 61 64 53 63 72 69 70 74 29 20 7b 0a 20 20 70 72 65 6c 6f 61 64 53 63 72 69 70 74 73 | reloadScript).{...preloadScripts |
37560 | 2e 70 75 73 68 28 70 72 65 6c 6f 61 64 53 63 72 69 70 74 29 0a 7d 0a 0a 69 66 20 28 77 69 6e 64 | .push(preloadScript).}..if.(wind |
37580 | 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 20 3d 3d 3d 20 27 63 68 72 6f 6d 65 | ow.location.protocol.===.'chrome |
375a0 | 2d 64 65 76 74 6f 6f 6c 73 3a 27 29 20 7b 0a 20 20 2f 2f 20 4f 76 65 72 72 69 64 65 20 73 6f 6d | -devtools:').{...//.Override.som |
375c0 | 65 20 69 6e 73 70 65 63 74 6f 72 20 41 50 49 73 2e 0a 20 20 72 65 71 75 69 72 65 28 27 40 65 6c | e.inspector.APIs....require('@el |
375e0 | 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 69 6e 73 70 65 63 74 | ectron/internal/renderer/inspect |
37600 | 6f 72 27 29 0a 20 20 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 20 3d 20 66 61 6c 73 65 0a 7d | or')...nodeIntegration.=.false.} |
37620 | 20 65 6c 73 65 20 69 66 20 28 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 | .else.if.(window.location.protoc |
37640 | 6f 6c 20 3d 3d 3d 20 27 63 68 72 6f 6d 65 2d 65 78 74 65 6e 73 69 6f 6e 3a 27 29 20 7b 0a 20 20 | ol.===.'chrome-extension:').{... |
37660 | 2f 2f 20 41 64 64 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 20 63 68 72 6f 6d 65 | //.Add.implementations.of.chrome |
37680 | 20 41 50 49 2e 0a 20 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 | .API....require('@electron/inter |
376a0 | 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 63 68 72 6f 6d 65 2d 61 70 69 27 29 2e 69 6e 6a 65 63 74 | nal/renderer/chrome-api').inject |
376c0 | 54 6f 28 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 68 6f 73 74 6e 61 6d 65 2c 20 69 73 42 | To(window.location.hostname,.isB |
376e0 | 61 63 6b 67 72 6f 75 6e 64 50 61 67 65 2c 20 77 69 6e 64 6f 77 29 0a 20 20 6e 6f 64 65 49 6e 74 | ackgroundPage,.window)...nodeInt |
37700 | 65 67 72 61 74 69 6f 6e 20 3d 20 66 61 6c 73 65 0a 7d 20 65 6c 73 65 20 69 66 20 28 77 69 6e 64 | egration.=.false.}.else.if.(wind |
37720 | 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 20 3d 3d 3d 20 27 63 68 72 6f 6d 65 | ow.location.protocol.===.'chrome |
37740 | 3a 27 29 20 7b 0a 20 20 2f 2f 20 44 69 73 61 62 6c 65 20 6e 6f 64 65 20 69 6e 74 65 67 72 61 74 | :').{...//.Disable.node.integrat |
37760 | 69 6f 6e 20 66 6f 72 20 63 68 72 6f 6d 65 20 55 49 20 73 63 68 65 6d 65 2e 0a 20 20 6e 6f 64 65 | ion.for.chrome.UI.scheme....node |
37780 | 49 6e 74 65 67 72 61 74 69 6f 6e 20 3d 20 66 61 6c 73 65 0a 7d 20 65 6c 73 65 20 7b 0a 20 20 2f | Integration.=.false.}.else.{.../ |
377a0 | 2f 20 4f 76 65 72 72 69 64 65 20 64 65 66 61 75 6c 74 20 77 65 62 20 66 75 6e 63 74 69 6f 6e 73 | /.Override.default.web.functions |
377c0 | 2e 0a 20 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f | ....require('@electron/internal/ |
377e0 | 72 65 6e 64 65 72 65 72 2f 6f 76 65 72 72 69 64 65 27 29 0a 0a 20 20 2f 2f 20 49 6e 6a 65 63 74 | renderer/override')....//.Inject |
37800 | 20 63 6f 6e 74 65 6e 74 20 73 63 72 69 70 74 73 2e 0a 20 20 72 65 71 75 69 72 65 28 27 40 65 6c | .content.scripts....require('@el |
37820 | 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 63 6f 6e 74 65 6e 74 | ectron/internal/renderer/content |
37840 | 2d 73 63 72 69 70 74 73 2d 69 6e 6a 65 63 74 6f 72 27 29 0a 0a 20 20 2f 2f 20 4c 6f 61 64 20 77 | -scripts-injector')....//.Load.w |
37860 | 65 62 76 69 65 77 20 74 61 67 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 0a 20 20 69 66 20 | ebview.tag.implementation....if. |
37880 | 28 77 65 62 76 69 65 77 54 61 67 20 26 26 20 70 72 6f 63 65 73 73 2e 67 75 65 73 74 49 6e 73 74 | (webviewTag.&&.process.guestInst |
378a0 | 61 6e 63 65 49 64 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 7b 20 73 65 | anceId.==.null).{.....const.{.se |
378c0 | 74 75 70 57 65 62 56 69 65 77 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f | tupWebView.}.=.require('@electro |
378e0 | 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 77 65 62 2d 76 69 65 77 2f 77 65 62 | n/internal/renderer/web-view/web |
37900 | 2d 76 69 65 77 27 29 0a 20 20 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 61 72 67 76 2e 69 6e 63 | -view').....if.(process.argv.inc |
37920 | 6c 75 64 65 73 28 27 2d 2d 63 6f 6e 74 65 78 74 2d 69 73 6f 6c 61 74 69 6f 6e 27 29 29 20 7b 0a | ludes('--context-isolation')).{. |
37940 | 20 20 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 77 69 6e 64 | ......v8Util.setHiddenValue(wind |
37960 | 6f 77 2c 20 27 73 65 74 75 70 2d 77 65 62 76 69 65 77 27 2c 20 73 65 74 75 70 57 65 62 56 69 65 | ow,.'setup-webview',.setupWebVie |
37980 | 77 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 73 65 74 75 70 57 65 62 56 69 | w).....}.else.{.......setupWebVi |
379a0 | 65 77 28 77 69 6e 64 6f 77 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 69 66 20 28 6e 6f 64 65 | ew(window).....}...}.}..if.(node |
379c0 | 49 6e 74 65 67 72 61 74 69 6f 6e 29 20 7b 0a 20 20 2f 2f 20 45 78 70 6f 72 74 20 6e 6f 64 65 20 | Integration).{...//.Export.node. |
379e0 | 62 69 6e 64 69 6e 67 73 20 74 6f 20 67 6c 6f 62 61 6c 2e 0a 20 20 67 6c 6f 62 61 6c 2e 72 65 71 | bindings.to.global....global.req |
37a00 | 75 69 72 65 20 3d 20 72 65 71 75 69 72 65 0a 20 20 67 6c 6f 62 61 6c 2e 6d 6f 64 75 6c 65 20 3d | uire.=.require...global.module.= |
37a20 | 20 6d 6f 64 75 6c 65 0a 0a 20 20 2f 2f 20 53 65 74 20 74 68 65 20 5f 5f 66 69 6c 65 6e 61 6d 65 | .module....//.Set.the.__filename |
37a40 | 20 74 6f 20 74 68 65 20 70 61 74 68 20 6f 66 20 68 74 6d 6c 20 66 69 6c 65 20 69 66 20 69 74 20 | .to.the.path.of.html.file.if.it. |
37a60 | 69 73 20 66 69 6c 65 3a 20 70 72 6f 74 6f 63 6f 6c 2e 0a 20 20 69 66 20 28 77 69 6e 64 6f 77 2e | is.file:.protocol....if.(window. |
37a80 | 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 20 3d 3d 3d 20 27 66 69 6c 65 3a 27 29 20 7b | location.protocol.===.'file:').{ |
37aa0 | 0a 20 20 20 20 63 6f 6e 73 74 20 6c 6f 63 61 74 69 6f 6e 20 3d 20 77 69 6e 64 6f 77 2e 6c 6f 63 | .....const.location.=.window.loc |
37ac0 | 61 74 69 6f 6e 0a 20 20 20 20 6c 65 74 20 70 61 74 68 6e 61 6d 65 20 3d 20 6c 6f 63 61 74 69 6f | ation.....let.pathname.=.locatio |
37ae0 | 6e 2e 70 61 74 68 6e 61 6d 65 0a 0a 20 20 20 20 69 66 20 28 70 72 6f 63 65 73 73 2e 70 6c 61 74 | n.pathname......if.(process.plat |
37b00 | 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 70 61 | form.===.'win32').{.......if.(pa |
37b20 | 74 68 6e 61 6d 65 5b 30 5d 20 3d 3d 3d 20 27 2f 27 29 20 70 61 74 68 6e 61 6d 65 20 3d 20 70 61 | thname[0].===.'/').pathname.=.pa |
37b40 | 74 68 6e 61 6d 65 2e 73 75 62 73 74 72 28 31 29 0a 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 69 73 | thname.substr(1)........const.is |
37b60 | 57 69 6e 64 6f 77 73 4e 65 74 77 6f 72 6b 53 68 61 72 65 50 61 74 68 20 3d 20 6c 6f 63 61 74 69 | WindowsNetworkSharePath.=.locati |
37b80 | 6f 6e 2e 68 6f 73 74 6e 61 6d 65 2e 6c 65 6e 67 74 68 20 3e 20 30 20 26 26 20 67 6c 6f 62 61 6c | on.hostname.length.>.0.&&.global |
37ba0 | 50 61 74 68 73 5b 30 5d 2e 73 74 61 72 74 73 57 69 74 68 28 27 5c 5c 27 29 0a 20 20 20 20 20 20 | Paths[0].startsWith('\\')....... |
37bc0 | 69 66 20 28 69 73 57 69 6e 64 6f 77 73 4e 65 74 77 6f 72 6b 53 68 61 72 65 50 61 74 68 29 20 7b | if.(isWindowsNetworkSharePath).{ |
37be0 | 0a 20 20 20 20 20 20 20 20 70 61 74 68 6e 61 6d 65 20 3d 20 60 2f 2f 24 7b 6c 6f 63 61 74 69 6f | .........pathname.=.`//${locatio |
37c00 | 6e 2e 68 6f 73 74 7d 2f 24 7b 70 61 74 68 6e 61 6d 65 7d 60 0a 20 20 20 20 20 20 7d 0a 20 20 20 | n.host}/${pathname}`.......}.... |
37c20 | 20 7d 0a 0a 20 20 20 20 67 6c 6f 62 61 6c 2e 5f 5f 66 69 6c 65 6e 61 6d 65 20 3d 20 70 61 74 68 | .}......global.__filename.=.path |
37c40 | 2e 6e 6f 72 6d 61 6c 69 7a 65 28 64 65 63 6f 64 65 55 52 49 43 6f 6d 70 6f 6e 65 6e 74 28 70 61 | .normalize(decodeURIComponent(pa |
37c60 | 74 68 6e 61 6d 65 29 29 0a 20 20 20 20 67 6c 6f 62 61 6c 2e 5f 5f 64 69 72 6e 61 6d 65 20 3d 20 | thname)).....global.__dirname.=. |
37c80 | 70 61 74 68 2e 64 69 72 6e 61 6d 65 28 67 6c 6f 62 61 6c 2e 5f 5f 66 69 6c 65 6e 61 6d 65 29 0a | path.dirname(global.__filename). |
37ca0 | 0a 20 20 20 20 2f 2f 20 53 65 74 20 6d 6f 64 75 6c 65 27 73 20 66 69 6c 65 6e 61 6d 65 20 73 6f | .....//.Set.module's.filename.so |
37cc0 | 20 72 65 6c 61 74 69 76 65 20 72 65 71 75 69 72 65 20 63 61 6e 20 77 6f 72 6b 20 61 73 20 65 78 | .relative.require.can.work.as.ex |
37ce0 | 70 65 63 74 65 64 2e 0a 20 20 20 20 6d 6f 64 75 6c 65 2e 66 69 6c 65 6e 61 6d 65 20 3d 20 67 6c | pected......module.filename.=.gl |
37d00 | 6f 62 61 6c 2e 5f 5f 66 69 6c 65 6e 61 6d 65 0a 0a 20 20 20 20 2f 2f 20 41 6c 73 6f 20 73 65 61 | obal.__filename......//.Also.sea |
37d20 | 72 63 68 20 66 6f 72 20 6d 6f 64 75 6c 65 20 75 6e 64 65 72 20 74 68 65 20 68 74 6d 6c 20 66 69 | rch.for.module.under.the.html.fi |
37d40 | 6c 65 2e 0a 20 20 20 20 6d 6f 64 75 6c 65 2e 70 61 74 68 73 20 3d 20 6d 6f 64 75 6c 65 2e 70 61 | le......module.paths.=.module.pa |
37d60 | 74 68 73 2e 63 6f 6e 63 61 74 28 4d 6f 64 75 6c 65 2e 5f 6e 6f 64 65 4d 6f 64 75 6c 65 50 61 74 | ths.concat(Module._nodeModulePat |
37d80 | 68 73 28 67 6c 6f 62 61 6c 2e 5f 5f 64 69 72 6e 61 6d 65 29 29 0a 20 20 7d 20 65 6c 73 65 20 7b | hs(global.__dirname))...}.else.{ |
37da0 | 0a 20 20 20 20 67 6c 6f 62 61 6c 2e 5f 5f 66 69 6c 65 6e 61 6d 65 20 3d 20 5f 5f 66 69 6c 65 6e | .....global.__filename.=.__filen |
37dc0 | 61 6d 65 0a 20 20 20 20 67 6c 6f 62 61 6c 2e 5f 5f 64 69 72 6e 61 6d 65 20 3d 20 5f 5f 64 69 72 | ame.....global.__dirname.=.__dir |
37de0 | 6e 61 6d 65 0a 0a 20 20 20 20 69 66 20 28 61 70 70 50 61 74 68 29 20 7b 0a 20 20 20 20 20 20 2f | name......if.(appPath).{......./ |
37e00 | 2f 20 53 65 61 72 63 68 20 66 6f 72 20 6d 6f 64 75 6c 65 20 75 6e 64 65 72 20 74 68 65 20 61 70 | /.Search.for.module.under.the.ap |
37e20 | 70 20 64 69 72 65 63 74 6f 72 79 0a 20 20 20 20 20 20 6d 6f 64 75 6c 65 2e 70 61 74 68 73 20 3d | p.directory.......module.paths.= |
37e40 | 20 6d 6f 64 75 6c 65 2e 70 61 74 68 73 2e 63 6f 6e 63 61 74 28 4d 6f 64 75 6c 65 2e 5f 6e 6f 64 | .module.paths.concat(Module._nod |
37e60 | 65 4d 6f 64 75 6c 65 50 61 74 68 73 28 61 70 70 50 61 74 68 29 29 0a 20 20 20 20 7d 0a 20 20 7d | eModulePaths(appPath)).....}...} |
37e80 | 0a 0a 20 20 2f 2f 20 52 65 64 69 72 65 63 74 20 77 69 6e 64 6f 77 2e 6f 6e 65 72 72 6f 72 20 74 | ....//.Redirect.window.onerror.t |
37ea0 | 6f 20 75 6e 63 61 75 67 68 74 45 78 63 65 70 74 69 6f 6e 2e 0a 20 20 77 69 6e 64 6f 77 2e 6f 6e | o.uncaughtException....window.on |
37ec0 | 65 72 72 6f 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 65 73 73 61 67 65 2c 20 66 69 6c 65 6e | error.=.function.(message,.filen |
37ee0 | 61 6d 65 2c 20 6c 69 6e 65 6e 6f 2c 20 63 6f 6c 6e 6f 2c 20 65 72 72 6f 72 29 20 7b 0a 20 20 20 | ame,.lineno,.colno,.error).{.... |
37f00 | 20 69 66 20 28 67 6c 6f 62 61 6c 2e 70 72 6f 63 65 73 73 2e 6c 69 73 74 65 6e 65 72 73 28 27 75 | .if.(global.process.listeners('u |
37f20 | 6e 63 61 75 67 68 74 45 78 63 65 70 74 69 6f 6e 27 29 2e 6c 65 6e 67 74 68 20 3e 20 30 29 20 7b | ncaughtException').length.>.0).{ |
37f40 | 0a 20 20 20 20 20 20 67 6c 6f 62 61 6c 2e 70 72 6f 63 65 73 73 2e 65 6d 69 74 28 27 75 6e 63 61 | .......global.process.emit('unca |
37f60 | 75 67 68 74 45 78 63 65 70 74 69 6f 6e 27 2c 20 65 72 72 6f 72 29 0a 20 20 20 20 20 20 72 65 74 | ughtException',.error).......ret |
37f80 | 75 72 6e 20 74 72 75 65 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 | urn.true.....}.else.{.......retu |
37fa0 | 72 6e 20 66 61 6c 73 65 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 20 65 6c 73 65 20 7b 0a 20 20 2f 2f | rn.false.....}...}.}.else.{...// |
37fc0 | 20 44 65 6c 65 74 65 20 4e 6f 64 65 27 73 20 73 79 6d 62 6f 6c 73 20 61 66 74 65 72 20 74 68 65 | .Delete.Node's.symbols.after.the |
37fe0 | 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 68 61 73 20 62 65 65 6e 20 6c 6f 61 64 65 64 2e 0a 20 20 | .Environment.has.been.loaded.... |
38000 | 70 72 6f 63 65 73 73 2e 6f 6e 63 65 28 27 6c 6f 61 64 65 64 27 2c 20 66 75 6e 63 74 69 6f 6e 20 | process.once('loaded',.function. |
38020 | 28 29 20 7b 0a 20 20 20 20 64 65 6c 65 74 65 20 67 6c 6f 62 61 6c 2e 70 72 6f 63 65 73 73 0a 20 | ().{.....delete.global.process.. |
38040 | 20 20 20 64 65 6c 65 74 65 20 67 6c 6f 62 61 6c 2e 42 75 66 66 65 72 0a 20 20 20 20 64 65 6c 65 | ...delete.global.Buffer.....dele |
38060 | 74 65 20 67 6c 6f 62 61 6c 2e 73 65 74 49 6d 6d 65 64 69 61 74 65 0a 20 20 20 20 64 65 6c 65 74 | te.global.setImmediate.....delet |
38080 | 65 20 67 6c 6f 62 61 6c 2e 63 6c 65 61 72 49 6d 6d 65 64 69 61 74 65 0a 20 20 20 20 64 65 6c 65 | e.global.clearImmediate.....dele |
380a0 | 74 65 20 67 6c 6f 62 61 6c 2e 67 6c 6f 62 61 6c 0a 20 20 7d 29 0a 7d 0a 0a 2f 2f 20 4c 6f 61 64 | te.global.global...}).}..//.Load |
380c0 | 20 74 68 65 20 70 72 65 6c 6f 61 64 20 73 63 72 69 70 74 73 2e 0a 66 6f 72 20 28 63 6f 6e 73 74 | .the.preload.scripts..for.(const |
380e0 | 20 70 72 65 6c 6f 61 64 53 63 72 69 70 74 20 6f 66 20 70 72 65 6c 6f 61 64 53 63 72 69 70 74 73 | .preloadScript.of.preloadScripts |
38100 | 29 20 7b 0a 20 20 74 72 79 20 7b 0a 20 20 20 20 72 65 71 75 69 72 65 28 70 72 65 6c 6f 61 64 53 | ).{...try.{.....require(preloadS |
38120 | 63 72 69 70 74 29 0a 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 63 | cript)...}.catch.(error).{.....c |
38140 | 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 27 55 6e 61 62 6c 65 20 74 6f 20 6c 6f 61 64 20 70 72 65 | onsole.error('Unable.to.load.pre |
38160 | 6c 6f 61 64 20 73 63 72 69 70 74 3a 20 27 20 2b 20 70 72 65 6c 6f 61 64 53 63 72 69 70 74 29 0a | load.script:.'.+.preloadScript). |
38180 | 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 65 72 72 6f 72 2e 73 74 61 63 6b 20 7c 7c | ....console.error(error.stack.|| |
381a0 | 20 65 72 72 6f 72 2e 6d 65 73 73 61 67 65 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 57 61 72 6e 20 61 | .error.message)...}.}..//.Warn.a |
381c0 | 62 6f 75 74 20 73 65 63 75 72 69 74 79 20 69 73 73 75 65 73 0a 72 65 71 75 69 72 65 28 27 40 65 | bout.security.issues.require('@e |
381e0 | 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 73 65 63 75 72 69 | lectron/internal/renderer/securi |
38200 | 74 79 2d 77 61 72 6e 69 6e 67 73 27 29 28 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 29 0a 0a | ty-warnings')(nodeIntegration).. |
38220 | 2f 2f 20 52 65 70 6f 72 74 20 66 6f 63 75 73 2f 62 6c 75 72 20 65 76 65 6e 74 73 20 6f 66 20 77 | //.Report.focus/blur.events.of.w |
38240 | 65 62 76 69 65 77 20 74 6f 20 62 72 6f 77 73 65 72 2e 0a 2f 2f 20 4e 6f 74 65 20 74 68 61 74 20 | ebview.to.browser..//.Note.that. |
38260 | 77 68 69 6c 65 20 43 68 72 6f 6d 69 75 6d 20 63 6f 6e 74 65 6e 74 20 41 50 49 73 20 68 61 76 65 | while.Chromium.content.APIs.have |
38280 | 20 6f 62 73 65 72 76 65 72 20 66 6f 72 20 66 6f 63 75 73 2f 62 6c 75 72 2c 20 74 68 65 79 0a 2f | .observer.for.focus/blur,.they./ |
382a0 | 2f 20 75 6e 66 6f 72 74 75 6e 61 74 65 6c 79 20 64 6f 20 6e 6f 74 20 77 6f 72 6b 20 66 6f 72 20 | /.unfortunately.do.not.work.for. |
382c0 | 77 65 62 76 69 65 77 2e 0a 69 66 20 28 70 72 6f 63 65 73 73 2e 67 75 65 73 74 49 6e 73 74 61 6e | webview..if.(process.guestInstan |
382e0 | 63 65 49 64 29 20 7b 0a 20 20 77 69 6e 64 6f 77 2e 61 64 64 45 76 65 6e 74 4c 69 73 74 65 6e 65 | ceId).{...window.addEventListene |
38300 | 72 28 27 66 6f 63 75 73 27 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 | r('focus',.().=>.{.....ipcRender |
38320 | 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e | er.send('ELECTRON_GUEST_VIEW_MAN |
38340 | 41 47 45 52 5f 46 4f 43 55 53 5f 43 48 41 4e 47 45 27 2c 20 74 72 75 65 2c 20 70 72 6f 63 65 73 | AGER_FOCUS_CHANGE',.true,.proces |
38360 | 73 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 7d 29 0a 20 20 77 69 6e 64 6f 77 | s.guestInstanceId)...})...window |
38380 | 2e 61 64 64 45 76 65 6e 74 4c 69 73 74 65 6e 65 72 28 27 62 6c 75 72 27 2c 20 28 29 20 3d 3e 20 | .addEventListener('blur',.().=>. |
383a0 | 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e | {.....ipcRenderer.send('ELECTRON |
383c0 | 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 46 4f 43 55 53 5f 43 48 41 4e 47 45 | _GUEST_VIEW_MANAGER_FOCUS_CHANGE |
383e0 | 27 2c 20 66 61 6c 73 65 2c 20 70 72 6f 63 65 73 73 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 | ',.false,.process.guestInstanceI |
38400 | 64 29 0a 20 20 7d 29 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 77 69 6e 64 6f 77 2e 6f | d)...}).}.'use.strict'..window.o |
38420 | 6e 6c 6f 61 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 2f 2f 20 55 73 65 20 6d | nload.=.function.().{...//.Use.m |
38440 | 65 6e 75 20 41 50 49 20 74 6f 20 73 68 6f 77 20 63 6f 6e 74 65 78 74 20 6d 65 6e 75 2e 0a 20 20 | enu.API.to.show.context.menu.... |
38460 | 77 69 6e 64 6f 77 2e 49 6e 73 70 65 63 74 6f 72 46 72 6f 6e 74 65 6e 64 48 6f 73 74 2e 73 68 6f | window.InspectorFrontendHost.sho |
38480 | 77 43 6f 6e 74 65 78 74 4d 65 6e 75 41 74 50 6f 69 6e 74 20 3d 20 63 72 65 61 74 65 4d 65 6e 75 | wContextMenuAtPoint.=.createMenu |
384a0 | 0a 0a 20 20 2f 2f 20 63 6f 72 72 65 63 74 20 66 6f 72 20 43 68 72 6f 6d 69 75 6d 20 72 65 74 75 | ....//.correct.for.Chromium.retu |
384c0 | 72 6e 69 6e 67 20 75 6e 64 65 66 69 6e 65 64 20 66 6f 72 20 66 69 6c 65 73 79 73 74 65 6d 0a 20 | rning.undefined.for.filesystem.. |
384e0 | 20 77 69 6e 64 6f 77 2e 50 65 72 73 69 73 74 65 6e 63 65 2e 46 69 6c 65 53 79 73 74 65 6d 57 6f | .window.Persistence.FileSystemWo |
38500 | 72 6b 73 70 61 63 65 42 69 6e 64 69 6e 67 2e 63 6f 6d 70 6c 65 74 65 55 52 4c 20 3d 20 63 6f 6d | rkspaceBinding.completeURL.=.com |
38520 | 70 6c 65 74 65 55 52 4c 0a 0a 20 20 2f 2f 20 55 73 65 20 64 69 61 6c 6f 67 20 41 50 49 20 74 6f | pleteURL....//.Use.dialog.API.to |
38540 | 20 6f 76 65 72 72 69 64 65 20 66 69 6c 65 20 63 68 6f 6f 73 65 72 20 64 69 61 6c 6f 67 2e 0a 20 | .override.file.chooser.dialog... |
38560 | 20 77 69 6e 64 6f 77 2e 55 49 2e 63 72 65 61 74 65 46 69 6c 65 53 65 6c 65 63 74 6f 72 45 6c 65 | .window.UI.createFileSelectorEle |
38580 | 6d 65 6e 74 20 3d 20 63 72 65 61 74 65 46 69 6c 65 53 65 6c 65 63 74 6f 72 45 6c 65 6d 65 6e 74 | ment.=.createFileSelectorElement |
385a0 | 0a 7d 0a 0a 2f 2f 20 45 78 74 72 61 20 2f 20 69 73 20 6e 65 65 64 65 64 20 61 73 20 61 20 72 65 | .}..//.Extra./.is.needed.as.a.re |
385c0 | 73 75 6c 74 20 6f 66 20 4d 61 63 4f 53 20 72 65 71 75 69 72 69 6e 67 20 61 62 73 6f 6c 75 74 65 | sult.of.MacOS.requiring.absolute |
385e0 | 20 70 61 74 68 73 0a 66 75 6e 63 74 69 6f 6e 20 63 6f 6d 70 6c 65 74 65 55 52 4c 20 28 70 72 6f | .paths.function.completeURL.(pro |
38600 | 6a 65 63 74 2c 20 70 61 74 68 29 20 7b 0a 20 20 70 72 6f 6a 65 63 74 20 3d 20 27 66 69 6c 65 3a | ject,.path).{...project.=.'file: |
38620 | 2f 2f 2f 27 0a 20 20 72 65 74 75 72 6e 20 60 24 7b 70 72 6f 6a 65 63 74 7d 24 7b 70 61 74 68 7d | ///'...return.`${project}${path} |
38640 | 60 0a 7d 0a 0a 77 69 6e 64 6f 77 2e 63 6f 6e 66 69 72 6d 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 | `.}..window.confirm.=.function.( |
38660 | 6d 65 73 73 61 67 65 2c 20 74 69 74 6c 65 29 20 7b 0a 20 20 63 6f 6e 73 74 20 7b 20 64 69 61 6c | message,.title).{...const.{.dial |
38680 | 6f 67 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 2e 72 65 6d 6f 74 | og.}.=.require('electron').remot |
386a0 | 65 0a 20 20 69 66 20 28 74 69 74 6c 65 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 74 69 74 | e...if.(title.==.null).{.....tit |
386c0 | 6c 65 20 3d 20 27 27 0a 20 20 7d 0a 20 20 72 65 74 75 72 6e 20 21 64 69 61 6c 6f 67 2e 73 68 6f | le.=.''...}...return.!dialog.sho |
386e0 | 77 4d 65 73 73 61 67 65 42 6f 78 28 7b 0a 20 20 20 20 6d 65 73 73 61 67 65 3a 20 6d 65 73 73 61 | wMessageBox({.....message:.messa |
38700 | 67 65 2c 0a 20 20 20 20 74 69 74 6c 65 3a 20 74 69 74 6c 65 2c 0a 20 20 20 20 62 75 74 74 6f 6e | ge,.....title:.title,.....button |
38720 | 73 3a 20 5b 27 4f 4b 27 2c 20 27 43 61 6e 63 65 6c 27 5d 2c 0a 20 20 20 20 63 61 6e 63 65 6c 49 | s:.['OK',.'Cancel'],.....cancelI |
38740 | 64 3a 20 31 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 63 6f 6e 76 65 72 74 54 6f 4d 65 6e 75 | d:.1...}).}..const.convertToMenu |
38760 | 54 65 6d 70 6c 61 74 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 69 74 65 6d 73 29 20 7b 0a 20 20 | Template.=.function.(items).{... |
38780 | 72 65 74 75 72 6e 20 69 74 65 6d 73 2e 6d 61 70 28 66 75 6e 63 74 69 6f 6e 20 28 69 74 65 6d 29 | return.items.map(function.(item) |
387a0 | 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 74 72 61 6e 73 66 6f 72 6d 65 64 20 3d 20 69 74 65 6d 2e | .{.....const.transformed.=.item. |
387c0 | 74 79 70 65 20 3d 3d 3d 20 27 73 75 62 4d 65 6e 75 27 20 3f 20 7b 0a 20 20 20 20 20 20 74 79 70 | type.===.'subMenu'.?.{.......typ |
387e0 | 65 3a 20 27 73 75 62 6d 65 6e 75 27 2c 0a 20 20 20 20 20 20 6c 61 62 65 6c 3a 20 69 74 65 6d 2e | e:.'submenu',.......label:.item. |
38800 | 6c 61 62 65 6c 2c 0a 20 20 20 20 20 20 65 6e 61 62 6c 65 64 3a 20 69 74 65 6d 2e 65 6e 61 62 6c | label,.......enabled:.item.enabl |
38820 | 65 64 2c 0a 20 20 20 20 20 20 73 75 62 6d 65 6e 75 3a 20 63 6f 6e 76 65 72 74 54 6f 4d 65 6e 75 | ed,.......submenu:.convertToMenu |
38840 | 54 65 6d 70 6c 61 74 65 28 69 74 65 6d 2e 73 75 62 49 74 65 6d 73 29 0a 20 20 20 20 7d 20 3a 20 | Template(item.subItems).....}.:. |
38860 | 69 74 65 6d 2e 74 79 70 65 20 3d 3d 3d 20 27 73 65 70 61 72 61 74 6f 72 27 20 3f 20 7b 0a 20 20 | item.type.===.'separator'.?.{... |
38880 | 20 20 20 20 74 79 70 65 3a 20 27 73 65 70 61 72 61 74 6f 72 27 0a 20 20 20 20 7d 20 3a 20 69 74 | ....type:.'separator'.....}.:.it |
388a0 | 65 6d 2e 74 79 70 65 20 3d 3d 3d 20 27 63 68 65 63 6b 62 6f 78 27 20 3f 20 7b 0a 20 20 20 20 20 | em.type.===.'checkbox'.?.{...... |
388c0 | 20 74 79 70 65 3a 20 27 63 68 65 63 6b 62 6f 78 27 2c 0a 20 20 20 20 20 20 6c 61 62 65 6c 3a 20 | .type:.'checkbox',.......label:. |
388e0 | 69 74 65 6d 2e 6c 61 62 65 6c 2c 0a 20 20 20 20 20 20 65 6e 61 62 6c 65 64 3a 20 69 74 65 6d 2e | item.label,.......enabled:.item. |
38900 | 65 6e 61 62 6c 65 64 2c 0a 20 20 20 20 20 20 63 68 65 63 6b 65 64 3a 20 69 74 65 6d 2e 63 68 65 | enabled,.......checked:.item.che |
38920 | 63 6b 65 64 0a 20 20 20 20 7d 20 3a 20 7b 0a 20 20 20 20 20 20 74 79 70 65 3a 20 27 6e 6f 72 6d | cked.....}.:.{.......type:.'norm |
38940 | 61 6c 27 2c 0a 20 20 20 20 20 20 6c 61 62 65 6c 3a 20 69 74 65 6d 2e 6c 61 62 65 6c 2c 0a 20 20 | al',.......label:.item.label,... |
38960 | 20 20 20 20 65 6e 61 62 6c 65 64 3a 20 69 74 65 6d 2e 65 6e 61 62 6c 65 64 0a 20 20 20 20 7d 0a | ....enabled:.item.enabled.....}. |
38980 | 0a 20 20 20 20 69 66 20 28 69 74 65 6d 2e 69 64 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 | .....if.(item.id.!=.null).{..... |
389a0 | 20 20 74 72 61 6e 73 66 6f 72 6d 65 64 2e 63 6c 69 63 6b 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 | ..transformed.click.=.function.( |
389c0 | 29 20 7b 0a 20 20 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 44 65 76 54 6f 6f 6c 73 41 50 49 2e 63 | ).{.........window.DevToolsAPI.c |
389e0 | 6f 6e 74 65 78 74 4d 65 6e 75 49 74 65 6d 53 65 6c 65 63 74 65 64 28 69 74 65 6d 2e 69 64 29 0a | ontextMenuItemSelected(item.id). |
38a00 | 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 77 69 6e 64 6f 77 2e 44 65 76 54 6f 6f 6c 73 41 50 | ........return.window.DevToolsAP |
38a20 | 49 2e 63 6f 6e 74 65 78 74 4d 65 6e 75 43 6c 65 61 72 65 64 28 29 0a 20 20 20 20 20 20 7d 0a 20 | I.contextMenuCleared().......}.. |
38a40 | 20 20 20 7d 0a 0a 20 20 20 20 72 65 74 75 72 6e 20 74 72 61 6e 73 66 6f 72 6d 65 64 0a 20 20 7d | ...}......return.transformed...} |
38a60 | 29 0a 7d 0a 0a 63 6f 6e 73 74 20 63 72 65 61 74 65 4d 65 6e 75 20 3d 20 66 75 6e 63 74 69 6f 6e | ).}..const.createMenu.=.function |
38a80 | 20 28 78 2c 20 79 2c 20 69 74 65 6d 73 29 20 7b 0a 20 20 63 6f 6e 73 74 20 7b 20 72 65 6d 6f 74 | .(x,.y,.items).{...const.{.remot |
38aa0 | 65 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 20 20 63 6f 6e 73 | e.}.=.require('electron')...cons |
38ac0 | 74 20 7b 20 4d 65 6e 75 20 7d 20 3d 20 72 65 6d 6f 74 65 0a 0a 20 20 6c 65 74 20 74 65 6d 70 6c | t.{.Menu.}.=.remote....let.templ |
38ae0 | 61 74 65 20 3d 20 63 6f 6e 76 65 72 74 54 6f 4d 65 6e 75 54 65 6d 70 6c 61 74 65 28 69 74 65 6d | ate.=.convertToMenuTemplate(item |
38b00 | 73 29 0a 20 20 69 66 20 28 75 73 65 45 64 69 74 4d 65 6e 75 49 74 65 6d 73 28 78 2c 20 79 2c 20 | s)...if.(useEditMenuItems(x,.y,. |
38b20 | 74 65 6d 70 6c 61 74 65 29 29 20 7b 0a 20 20 20 20 74 65 6d 70 6c 61 74 65 20 3d 20 67 65 74 45 | template)).{.....template.=.getE |
38b40 | 64 69 74 4d 65 6e 75 49 74 65 6d 73 28 29 0a 20 20 7d 0a 20 20 63 6f 6e 73 74 20 6d 65 6e 75 20 | ditMenuItems()...}...const.menu. |
38b60 | 3d 20 4d 65 6e 75 2e 62 75 69 6c 64 46 72 6f 6d 54 65 6d 70 6c 61 74 65 28 74 65 6d 70 6c 61 74 | =.Menu.buildFromTemplate(templat |
38b80 | 65 29 0a 0a 20 20 2f 2f 20 54 68 65 20 6d 65 6e 75 20 69 73 20 65 78 70 65 63 74 65 64 20 74 6f | e)....//.The.menu.is.expected.to |
38ba0 | 20 73 68 6f 77 20 61 73 79 6e 63 68 72 6f 6e 6f 75 73 6c 79 2e 0a 20 20 73 65 74 54 69 6d 65 6f | .show.asynchronously....setTimeo |
38bc0 | 75 74 28 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 6d 65 6e 75 2e 70 6f 70 75 70 28 | ut(function.().{.....menu.popup( |
38be0 | 7b 20 77 69 6e 64 6f 77 3a 20 72 65 6d 6f 74 65 2e 67 65 74 43 75 72 72 65 6e 74 57 69 6e 64 6f | {.window:.remote.getCurrentWindo |
38c00 | 77 28 29 20 7d 29 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 75 73 65 45 64 69 74 4d 65 6e 75 | w().})...}).}..const.useEditMenu |
38c20 | 49 74 65 6d 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 78 2c 20 79 2c 20 69 74 65 6d 73 29 20 7b | Items.=.function.(x,.y,.items).{ |
38c40 | 0a 20 20 72 65 74 75 72 6e 20 69 74 65 6d 73 2e 6c 65 6e 67 74 68 20 3d 3d 3d 20 30 20 26 26 20 | ...return.items.length.===.0.&&. |
38c60 | 64 6f 63 75 6d 65 6e 74 2e 65 6c 65 6d 65 6e 74 73 46 72 6f 6d 50 6f 69 6e 74 28 78 2c 20 79 29 | document.elementsFromPoint(x,.y) |
38c80 | 2e 73 6f 6d 65 28 66 75 6e 63 74 69 6f 6e 20 28 65 6c 65 6d 65 6e 74 29 20 7b 0a 20 20 20 20 72 | .some(function.(element).{.....r |
38ca0 | 65 74 75 72 6e 20 65 6c 65 6d 65 6e 74 2e 6e 6f 64 65 4e 61 6d 65 20 3d 3d 3d 20 27 49 4e 50 55 | eturn.element.nodeName.===.'INPU |
38cc0 | 54 27 20 7c 7c 20 65 6c 65 6d 65 6e 74 2e 6e 6f 64 65 4e 61 6d 65 20 3d 3d 3d 20 27 54 45 58 54 | T'.||.element.nodeName.===.'TEXT |
38ce0 | 41 52 45 41 27 20 7c 7c 20 65 6c 65 6d 65 6e 74 2e 69 73 43 6f 6e 74 65 6e 74 45 64 69 74 61 62 | AREA'.||.element.isContentEditab |
38d00 | 6c 65 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 67 65 74 45 64 69 74 4d 65 6e 75 49 74 65 6d | le...}).}..const.getEditMenuItem |
38d20 | 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 5b 0a 20 20 20 | s.=.function.().{...return.[.... |
38d40 | 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 75 6e 64 6f 27 0a 20 20 20 20 7d 2c 0a 20 20 20 | .{.......role:.'undo'.....},.... |
38d60 | 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 72 65 64 6f 27 0a 20 20 20 20 7d 2c 0a 20 20 20 | .{.......role:.'redo'.....},.... |
38d80 | 20 7b 0a 20 20 20 20 20 20 74 79 70 65 3a 20 27 73 65 70 61 72 61 74 6f 72 27 0a 20 20 20 20 7d | .{.......type:.'separator'.....} |
38da0 | 2c 0a 20 20 20 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 63 75 74 27 0a 20 20 20 20 7d 2c | ,.....{.......role:.'cut'.....}, |
38dc0 | 0a 20 20 20 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 63 6f 70 79 27 0a 20 20 20 20 7d 2c | .....{.......role:.'copy'.....}, |
38de0 | 0a 20 20 20 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 70 61 73 74 65 27 0a 20 20 20 20 7d | .....{.......role:.'paste'.....} |
38e00 | 2c 0a 20 20 20 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 3a 20 27 70 61 73 74 65 41 6e 64 4d 61 74 | ,.....{.......role:.'pasteAndMat |
38e20 | 63 68 53 74 79 6c 65 27 0a 20 20 20 20 7d 2c 0a 20 20 20 20 7b 0a 20 20 20 20 20 20 72 6f 6c 65 | chStyle'.....},.....{.......role |
38e40 | 3a 20 27 64 65 6c 65 74 65 27 0a 20 20 20 20 7d 2c 0a 20 20 20 20 7b 0a 20 20 20 20 20 20 72 6f | :.'delete'.....},.....{.......ro |
38e60 | 6c 65 3a 20 27 73 65 6c 65 63 74 41 6c 6c 27 0a 20 20 20 20 7d 0a 20 20 5d 0a 7d 0a 0a 63 6f 6e | le:.'selectAll'.....}...].}..con |
38e80 | 73 74 20 73 68 6f 77 46 69 6c 65 43 68 6f 6f 73 65 72 44 69 61 6c 6f 67 20 3d 20 66 75 6e 63 74 | st.showFileChooserDialog.=.funct |
38ea0 | 69 6f 6e 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 63 6f 6e 73 74 20 7b 20 64 69 61 6c 6f | ion.(callback).{...const.{.dialo |
38ec0 | 67 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 2e 72 65 6d 6f 74 65 | g.}.=.require('electron').remote |
38ee0 | 0a 20 20 63 6f 6e 73 74 20 66 69 6c 65 73 20 3d 20 64 69 61 6c 6f 67 2e 73 68 6f 77 4f 70 65 6e | ...const.files.=.dialog.showOpen |
38f00 | 44 69 61 6c 6f 67 28 7b 7d 29 0a 20 20 69 66 20 28 66 69 6c 65 73 20 21 3d 20 6e 75 6c 6c 29 20 | Dialog({})...if.(files.!=.null). |
38f20 | 7b 0a 20 20 20 20 63 61 6c 6c 62 61 63 6b 28 70 61 74 68 54 6f 48 74 6d 6c 35 46 69 6c 65 4f 62 | {.....callback(pathToHtml5FileOb |
38f40 | 6a 65 63 74 28 66 69 6c 65 73 5b 30 5d 29 29 0a 20 20 7d 0a 7d 0a 0a 63 6f 6e 73 74 20 70 61 74 | ject(files[0]))...}.}..const.pat |
38f60 | 68 54 6f 48 74 6d 6c 35 46 69 6c 65 4f 62 6a 65 63 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 70 | hToHtml5FileObject.=.function.(p |
38f80 | 61 74 68 29 20 7b 0a 20 20 63 6f 6e 73 74 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 | ath).{...const.fs.=.require('fs' |
38fa0 | 29 0a 20 20 63 6f 6e 73 74 20 62 6c 6f 62 20 3d 20 6e 65 77 20 42 6c 6f 62 28 5b 66 73 2e 72 65 | )...const.blob.=.new.Blob([fs.re |
38fc0 | 61 64 46 69 6c 65 53 79 6e 63 28 70 61 74 68 29 5d 29 0a 20 20 62 6c 6f 62 2e 6e 61 6d 65 20 3d | adFileSync(path)])...blob.name.= |
38fe0 | 20 70 61 74 68 0a 20 20 72 65 74 75 72 6e 20 62 6c 6f 62 0a 7d 0a 0a 63 6f 6e 73 74 20 63 72 65 | .path...return.blob.}..const.cre |
39000 | 61 74 65 46 69 6c 65 53 65 6c 65 63 74 6f 72 45 6c 65 6d 65 6e 74 20 3d 20 66 75 6e 63 74 69 6f | ateFileSelectorElement.=.functio |
39020 | 6e 20 28 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 63 6f 6e 73 74 20 66 69 6c 65 53 65 6c 65 63 | n.(callback).{...const.fileSelec |
39040 | 74 6f 72 45 6c 65 6d 65 6e 74 20 3d 20 64 6f 63 75 6d 65 6e 74 2e 63 72 65 61 74 65 45 6c 65 6d | torElement.=.document.createElem |
39060 | 65 6e 74 28 27 73 70 61 6e 27 29 0a 20 20 66 69 6c 65 53 65 6c 65 63 74 6f 72 45 6c 65 6d 65 6e | ent('span')...fileSelectorElemen |
39080 | 74 2e 73 74 79 6c 65 2e 64 69 73 70 6c 61 79 20 3d 20 27 6e 6f 6e 65 27 0a 20 20 66 69 6c 65 53 | t.style.display.=.'none'...fileS |
390a0 | 65 6c 65 63 74 6f 72 45 6c 65 6d 65 6e 74 2e 63 6c 69 63 6b 20 3d 20 73 68 6f 77 46 69 6c 65 43 | electorElement.click.=.showFileC |
390c0 | 68 6f 6f 73 65 72 44 69 61 6c 6f 67 2e 62 69 6e 64 28 74 68 69 73 2c 20 63 61 6c 6c 62 61 63 6b | hooserDialog.bind(this,.callback |
390e0 | 29 0a 20 20 72 65 74 75 72 6e 20 66 69 6c 65 53 65 6c 65 63 74 6f 72 45 6c 65 6d 65 6e 74 0a 7d | )...return.fileSelectorElement.} |
39100 | 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 62 69 6e 64 69 6e 67 20 3d 20 70 | .'use.strict'..const.binding.=.p |
39120 | 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 69 70 63 27 29 0a 63 6f 6e 73 74 20 | rocess.atomBinding('ipc').const. |
39140 | 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 27 76 38 | v8Util.=.process.atomBinding('v8 |
39160 | 5f 75 74 69 6c 27 29 0a 0a 2f 2f 20 43 72 65 61 74 65 64 20 62 79 20 69 6e 69 74 2e 6a 73 2e 0a | _util')..//.Created.by.init.js.. |
39180 | 63 6f 6e 73 74 20 69 70 63 52 65 6e 64 65 72 65 72 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 | const.ipcRenderer.=.v8Util.getHi |
391a0 | 64 64 65 6e 56 61 6c 75 65 28 67 6c 6f 62 61 6c 2c 20 27 69 70 63 2d 69 6e 74 65 72 6e 61 6c 27 | ddenValue(global,.'ipc-internal' |
391c0 | 29 0a 63 6f 6e 73 74 20 69 6e 74 65 72 6e 61 6c 20 3d 20 74 72 75 65 0a 0a 69 70 63 52 65 6e 64 | ).const.internal.=.true..ipcRend |
391e0 | 65 72 65 72 2e 73 65 6e 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 7b | erer.send.=.function.(...args).{ |
39200 | 0a 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 73 65 6e 64 28 27 69 70 63 2d 69 6e 74 65 | ...return.binding.send('ipc-inte |
39220 | 72 6e 61 6c 2d 6d 65 73 73 61 67 65 27 2c 20 61 72 67 73 29 0a 7d 0a 0a 69 70 63 52 65 6e 64 65 | rnal-message',.args).}..ipcRende |
39240 | 72 65 72 2e 73 65 6e 64 53 79 6e 63 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 | rer.sendSync.=.function.(...args |
39260 | 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 73 65 6e 64 53 79 6e 63 28 27 69 | ).{...return.binding.sendSync('i |
39280 | 70 63 2d 69 6e 74 65 72 6e 61 6c 2d 6d 65 73 73 61 67 65 2d 73 79 6e 63 27 2c 20 61 72 67 73 29 | pc-internal-message-sync',.args) |
392a0 | 5b 30 5d 0a 7d 0a 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 54 6f 20 3d 20 66 75 6e 63 | [0].}..ipcRenderer.sendTo.=.func |
392c0 | 74 69 6f 6e 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 2c 20 63 68 61 6e 6e 65 6c 2c 20 2e 2e | tion.(webContentsId,.channel,... |
392e0 | 2e 61 72 67 73 29 20 7b 0a 20 20 72 65 74 75 72 6e 20 62 69 6e 64 69 6e 67 2e 73 65 6e 64 54 6f | .args).{...return.binding.sendTo |
39300 | 28 69 6e 74 65 72 6e 61 6c 2c 20 66 61 6c 73 65 2c 20 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 2c | (internal,.false,.webContentsId, |
39320 | 20 63 68 61 6e 6e 65 6c 2c 20 61 72 67 73 29 0a 7d 0a 0a 69 70 63 52 65 6e 64 65 72 65 72 2e 73 | .channel,.args).}..ipcRenderer.s |
39340 | 65 6e 64 54 6f 41 6c 6c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 65 62 43 6f 6e 74 65 6e 74 73 | endToAll.=.function.(webContents |
39360 | 49 64 2c 20 63 68 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 72 65 74 75 72 6e | Id,.channel,....args).{...return |
39380 | 20 62 69 6e 64 69 6e 67 2e 73 65 6e 64 54 6f 28 69 6e 74 65 72 6e 61 6c 2c 20 74 72 75 65 2c 20 | .binding.sendTo(internal,.true,. |
393a0 | 77 65 62 43 6f 6e 74 65 6e 74 73 49 64 2c 20 63 68 61 6e 6e 65 6c 2c 20 61 72 67 73 29 0a 7d 0a | webContentsId,.channel,.args).}. |
393c0 | 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 69 70 63 52 65 6e 64 65 72 65 72 0a 27 75 | .module.exports.=.ipcRenderer.'u |
393e0 | 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 69 70 63 52 65 6e 64 65 72 65 72 20 3d 20 | se.strict'..const.ipcRenderer.=. |
39400 | 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 | require('@electron/internal/rend |
39420 | 65 72 65 72 2f 69 70 63 2d 72 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 0a 63 6f | erer/ipc-renderer-internal')..co |
39440 | 6e 73 74 20 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 | nst.v8Util.=.process.atomBinding |
39460 | 28 27 76 38 5f 75 74 69 6c 27 29 0a 0a 63 6f 6e 73 74 20 7b 20 67 75 65 73 74 49 6e 73 74 61 6e | ('v8_util')..const.{.guestInstan |
39480 | 63 65 49 64 2c 20 6f 70 65 6e 65 72 49 64 20 7d 20 3d 20 70 72 6f 63 65 73 73 0a 63 6f 6e 73 74 | ceId,.openerId.}.=.process.const |
394a0 | 20 68 69 64 64 65 6e 50 61 67 65 20 3d 20 70 72 6f 63 65 73 73 2e 61 72 67 76 2e 69 6e 63 6c 75 | .hiddenPage.=.process.argv.inclu |
394c0 | 64 65 73 28 27 2d 2d 68 69 64 64 65 6e 2d 70 61 67 65 27 29 0a 63 6f 6e 73 74 20 75 73 65 73 4e | des('--hidden-page').const.usesN |
394e0 | 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 20 3d 20 70 72 6f 63 65 73 73 2e 61 72 67 76 2e 69 | ativeWindowOpen.=.process.argv.i |
39500 | 6e 63 6c 75 64 65 73 28 27 2d 2d 6e 61 74 69 76 65 2d 77 69 6e 64 6f 77 2d 6f 70 65 6e 27 29 0a | ncludes('--native-window-open'). |
39520 | 63 6f 6e 73 74 20 63 6f 6e 74 65 78 74 49 73 6f 6c 61 74 69 6f 6e 20 3d 20 70 72 6f 63 65 73 73 | const.contextIsolation.=.process |
39540 | 2e 61 72 67 76 2e 69 6e 63 6c 75 64 65 73 28 27 2d 2d 63 6f 6e 74 65 78 74 2d 69 73 6f 6c 61 74 | .argv.includes('--context-isolat |
39560 | 69 6f 6e 27 29 0a 0a 2f 2f 20 50 61 73 73 20 74 68 65 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20 | ion')..//.Pass.the.arguments.to. |
39580 | 69 73 6f 6c 61 74 65 64 57 6f 72 6c 64 2e 0a 69 66 20 28 63 6f 6e 74 65 78 74 49 73 6f 6c 61 74 | isolatedWorld..if.(contextIsolat |
395a0 | 69 6f 6e 29 20 7b 0a 20 20 63 6f 6e 73 74 20 69 73 6f 6c 61 74 65 64 57 6f 72 6c 64 41 72 67 73 | ion).{...const.isolatedWorldArgs |
395c0 | 20 3d 20 7b 20 69 70 63 52 65 6e 64 65 72 65 72 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 | .=.{.ipcRenderer,.guestInstanceI |
395e0 | 64 2c 20 68 69 64 64 65 6e 50 61 67 65 2c 20 6f 70 65 6e 65 72 49 64 2c 20 75 73 65 73 4e 61 74 | d,.hiddenPage,.openerId,.usesNat |
39600 | 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 20 7d 0a 20 20 76 38 55 74 69 6c 2e 73 65 74 48 69 64 64 | iveWindowOpen.}...v8Util.setHidd |
39620 | 65 6e 56 61 6c 75 65 28 67 6c 6f 62 61 6c 2c 20 27 69 73 6f 6c 61 74 65 64 2d 77 6f 72 6c 64 2d | enValue(global,.'isolated-world- |
39640 | 61 72 67 73 27 2c 20 69 73 6f 6c 61 74 65 64 57 6f 72 6c 64 41 72 67 73 29 0a 7d 0a 0a 72 65 71 | args',.isolatedWorldArgs).}..req |
39660 | 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 | uire('@electron/internal/rendere |
39680 | 72 2f 77 69 6e 64 6f 77 2d 73 65 74 75 70 27 29 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 67 75 | r/window-setup')(ipcRenderer,.gu |
396a0 | 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 6f 70 65 6e 65 72 49 64 2c 20 68 69 64 64 65 6e 50 | estInstanceId,.openerId,.hiddenP |
396c0 | 61 67 65 2c 20 75 73 65 73 4e 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 29 0a 27 75 73 65 20 | age,.usesNativeWindowOpen).'use. |
396e0 | 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 72 65 6d 6f 74 65 20 7d 20 3d 20 72 65 71 75 | strict'..const.{.remote.}.=.requ |
39700 | 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 65 78 70 6f 72 74 73 2e 67 65 74 52 65 6d 6f | ire('electron')..exports.getRemo |
39720 | 74 65 46 6f 72 55 73 61 67 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 75 73 61 67 65 29 20 7b 0a | teForUsage.=.function.(usage).{. |
39740 | 20 20 69 66 20 28 21 72 65 6d 6f 74 65 29 20 7b 0a 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 | ..if.(!remote).{.....throw.new.E |
39760 | 72 72 6f 72 28 60 24 7b 75 73 61 67 65 7d 20 72 65 71 75 69 72 65 73 20 72 65 6d 6f 74 65 2c 20 | rror(`${usage}.requires.remote,. |
39780 | 77 68 69 63 68 20 69 73 20 6e 6f 74 20 65 6e 61 62 6c 65 64 60 29 0a 20 20 7d 0a 20 20 72 65 74 | which.is.not.enabled`)...}...ret |
397a0 | 75 72 6e 20 72 65 6d 6f 74 65 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 6c 65 74 20 73 | urn.remote.}.'use.strict'..let.s |
397c0 | 68 6f 75 6c 64 4c 6f 67 20 3d 20 6e 75 6c 6c 0a 0a 2f 2a 2a 0a 20 2a 20 54 68 69 73 20 6d 65 74 | houldLog.=.null../**..*.This.met |
397e0 | 68 6f 64 20 63 68 65 63 6b 73 20 69 66 20 61 20 73 65 63 75 72 69 74 79 20 6d 65 73 73 61 67 65 | hod.checks.if.a.security.message |
39800 | 20 73 68 6f 75 6c 64 20 62 65 20 6c 6f 67 67 65 64 2e 0a 20 2a 20 49 74 20 64 6f 65 73 20 73 6f | .should.be.logged...*.It.does.so |
39820 | 20 62 79 20 64 65 74 65 72 6d 69 6e 69 6e 67 20 77 68 65 74 68 65 72 20 77 65 27 72 65 20 72 75 | .by.determining.whether.we're.ru |
39840 | 6e 6e 69 6e 67 20 61 73 20 45 6c 65 63 74 72 6f 6e 2c 0a 20 2a 20 77 68 69 63 68 20 69 6e 64 69 | nning.as.Electron,..*.which.indi |
39860 | 63 61 74 65 73 20 74 68 61 74 20 61 20 64 65 76 65 6c 6f 70 65 72 20 69 73 20 63 75 72 72 65 6e | cates.that.a.developer.is.curren |
39880 | 74 6c 79 20 6c 6f 6f 6b 69 6e 67 20 61 74 20 74 68 65 0a 20 2a 20 61 70 70 2e 0a 20 2a 0a 20 2a | tly.looking.at.the..*.app...*..* |
398a0 | 20 40 72 65 74 75 72 6e 73 20 7b 62 6f 6f 6c 65 61 6e 7d 20 2d 20 53 68 6f 75 6c 64 20 77 65 20 | .@returns.{boolean}.-.Should.we. |
398c0 | 6c 6f 67 3f 0a 20 2a 2f 0a 63 6f 6e 73 74 20 73 68 6f 75 6c 64 4c 6f 67 53 65 63 75 72 69 74 79 | log?..*/.const.shouldLogSecurity |
398e0 | 57 61 72 6e 69 6e 67 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 69 66 20 28 73 | Warnings.=.function.().{...if.(s |
39900 | 68 6f 75 6c 64 4c 6f 67 20 21 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 | houldLog.!==.null).{.....return. |
39920 | 73 68 6f 75 6c 64 4c 6f 67 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 7b 20 70 6c 61 74 66 6f 72 | shouldLog...}....const.{.platfor |
39940 | 6d 2c 20 65 78 65 63 50 61 74 68 2c 20 65 6e 76 20 7d 20 3d 20 70 72 6f 63 65 73 73 0a 0a 20 20 | m,.execPath,.env.}.=.process.... |
39960 | 73 77 69 74 63 68 20 28 70 6c 61 74 66 6f 72 6d 29 20 7b 0a 20 20 20 20 63 61 73 65 20 27 64 61 | switch.(platform).{.....case.'da |
39980 | 72 77 69 6e 27 3a 0a 20 20 20 20 20 20 73 68 6f 75 6c 64 4c 6f 67 20 3d 20 65 78 65 63 50 61 74 | rwin':.......shouldLog.=.execPat |
399a0 | 68 2e 65 6e 64 73 57 69 74 68 28 27 4d 61 63 4f 53 2f 45 6c 65 63 74 72 6f 6e 27 29 20 7c 7c 0a | h.endsWith('MacOS/Electron').||. |
399c0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 78 65 63 50 61 74 68 2e 69 6e 63 6c 75 | ..................execPath.inclu |
399e0 | 64 65 73 28 27 45 6c 65 63 74 72 6f 6e 2e 61 70 70 2f 43 6f 6e 74 65 6e 74 73 2f 46 72 61 6d 65 | des('Electron.app/Contents/Frame |
39a00 | 77 6f 72 6b 73 2f 27 29 0a 20 20 20 20 20 20 62 72 65 61 6b 0a 20 20 20 20 63 61 73 65 20 27 66 | works/').......break.....case.'f |
39a20 | 72 65 65 62 73 64 27 3a 0a 20 20 20 20 63 61 73 65 20 27 6c 69 6e 75 78 27 3a 0a 20 20 20 20 20 | reebsd':.....case.'linux':...... |
39a40 | 20 73 68 6f 75 6c 64 4c 6f 67 20 3d 20 65 78 65 63 50 61 74 68 2e 65 6e 64 73 57 69 74 68 28 27 | .shouldLog.=.execPath.endsWith(' |
39a60 | 2f 65 6c 65 63 74 72 6f 6e 27 29 0a 20 20 20 20 20 20 62 72 65 61 6b 0a 20 20 20 20 63 61 73 65 | /electron').......break.....case |
39a80 | 20 27 77 69 6e 33 32 27 3a 0a 20 20 20 20 20 20 73 68 6f 75 6c 64 4c 6f 67 20 3d 20 65 78 65 63 | .'win32':.......shouldLog.=.exec |
39aa0 | 50 61 74 68 2e 65 6e 64 73 57 69 74 68 28 27 5c 5c 65 6c 65 63 74 72 6f 6e 2e 65 78 65 27 29 0a | Path.endsWith('\\electron.exe'). |
39ac0 | 20 20 20 20 20 20 62 72 65 61 6b 0a 20 20 20 20 64 65 66 61 75 6c 74 3a 0a 20 20 20 20 20 20 73 | ......break.....default:.......s |
39ae0 | 68 6f 75 6c 64 4c 6f 67 20 3d 20 66 61 6c 73 65 0a 20 20 7d 0a 0a 20 20 69 66 20 28 28 65 6e 76 | houldLog.=.false...}....if.((env |
39b00 | 20 26 26 20 65 6e 76 2e 45 4c 45 43 54 52 4f 4e 5f 44 49 53 41 42 4c 45 5f 53 45 43 55 52 49 54 | .&&.env.ELECTRON_DISABLE_SECURIT |
39b20 | 59 5f 57 41 52 4e 49 4e 47 53 29 20 7c 7c 0a 20 20 20 20 20 20 28 77 69 6e 64 6f 77 20 26 26 20 | Y_WARNINGS).||.......(window.&&. |
39b40 | 77 69 6e 64 6f 77 2e 45 4c 45 43 54 52 4f 4e 5f 44 49 53 41 42 4c 45 5f 53 45 43 55 52 49 54 59 | window.ELECTRON_DISABLE_SECURITY |
39b60 | 5f 57 41 52 4e 49 4e 47 53 29 29 20 7b 0a 20 20 20 20 73 68 6f 75 6c 64 4c 6f 67 20 3d 20 66 61 | _WARNINGS)).{.....shouldLog.=.fa |
39b80 | 6c 73 65 0a 20 20 7d 0a 0a 20 20 69 66 20 28 28 65 6e 76 20 26 26 20 65 6e 76 2e 45 4c 45 43 54 | lse...}....if.((env.&&.env.ELECT |
39ba0 | 52 4f 4e 5f 45 4e 41 42 4c 45 5f 53 45 43 55 52 49 54 59 5f 57 41 52 4e 49 4e 47 53 29 20 7c 7c | RON_ENABLE_SECURITY_WARNINGS).|| |
39bc0 | 0a 20 20 20 20 20 20 28 77 69 6e 64 6f 77 20 26 26 20 77 69 6e 64 6f 77 2e 45 4c 45 43 54 52 4f | .......(window.&&.window.ELECTRO |
39be0 | 4e 5f 45 4e 41 42 4c 45 5f 53 45 43 55 52 49 54 59 5f 57 41 52 4e 49 4e 47 53 29 29 20 7b 0a 20 | N_ENABLE_SECURITY_WARNINGS)).{.. |
39c00 | 20 20 20 73 68 6f 75 6c 64 4c 6f 67 20 3d 20 74 72 75 65 0a 20 20 7d 0a 0a 20 20 72 65 74 75 72 | ...shouldLog.=.true...}....retur |
39c20 | 6e 20 73 68 6f 75 6c 64 4c 6f 67 0a 7d 0a 0a 2f 2a 2a 0a 20 2a 20 43 68 65 63 6b 73 20 69 66 20 | n.shouldLog.}../**..*.Checks.if. |
39c40 | 74 68 65 20 63 75 72 72 65 6e 74 20 77 69 6e 64 6f 77 20 69 73 20 72 65 6d 6f 74 65 2e 0a 20 2a | the.current.window.is.remote...* |
39c60 | 0a 20 2a 20 40 72 65 74 75 72 6e 73 20 7b 62 6f 6f 6c 65 61 6e 7d 20 2d 20 49 73 20 74 68 69 73 | ..*.@returns.{boolean}.-.Is.this |
39c80 | 20 61 20 72 65 6d 6f 74 65 20 70 72 6f 74 6f 63 6f 6c 3f 0a 20 2a 2f 0a 63 6f 6e 73 74 20 67 65 | .a.remote.protocol?..*/.const.ge |
39ca0 | 74 49 73 52 65 6d 6f 74 65 50 72 6f 74 6f 63 6f 6c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 | tIsRemoteProtocol.=.function.(). |
39cc0 | 7b 0a 20 20 69 66 20 28 77 69 6e 64 6f 77 20 26 26 20 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f | {...if.(window.&&.window.locatio |
39ce0 | 6e 20 26 26 20 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 29 20 7b | n.&&.window.location.protocol).{ |
39d00 | 0a 20 20 20 20 72 65 74 75 72 6e 20 2f 5e 28 68 74 74 70 7c 66 74 70 29 73 3f 2f 67 69 2e 74 65 | .....return./^(http|ftp)s?/gi.te |
39d20 | 73 74 28 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 29 0a 20 20 7d | st(window.location.protocol)...} |
39d40 | 0a 7d 0a 0a 2f 2a 2a 0a 20 2a 20 54 72 69 65 73 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 77 68 | .}../**..*.Tries.to.determine.wh |
39d60 | 65 74 68 65 72 20 61 20 43 53 50 20 77 69 74 68 6f 75 74 20 60 75 6e 73 61 66 65 2d 65 76 61 6c | ether.a.CSP.without.`unsafe-eval |
39d80 | 60 20 69 73 20 73 65 74 2e 0a 20 2a 0a 20 2a 20 40 72 65 74 75 72 6e 73 20 7b 62 6f 6f 6c 65 61 | `.is.set...*..*.@returns.{boolea |
39da0 | 6e 7d 20 49 73 20 61 20 43 53 50 20 77 69 74 68 20 60 75 6e 73 61 66 65 2d 65 76 61 6c 60 20 73 | n}.Is.a.CSP.with.`unsafe-eval`.s |
39dc0 | 65 74 3f 0a 20 2a 2f 0a 63 6f 6e 73 74 20 69 73 55 6e 73 61 66 65 45 76 61 6c 45 6e 61 62 6c 65 | et?..*/.const.isUnsafeEvalEnable |
39de0 | 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 63 6f 6e 73 74 20 7b 20 77 65 62 46 | d.=.function.().{...const.{.webF |
39e00 | 72 61 6d 65 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 20 20 | rame.}.=.require('electron').... |
39e20 | 72 65 74 75 72 6e 20 6e 65 77 20 50 72 6f 6d 69 73 65 28 28 72 65 73 6f 6c 76 65 29 20 3d 3e 20 | return.new.Promise((resolve).=>. |
39e40 | 7b 0a 20 20 20 20 77 65 62 46 72 61 6d 65 2e 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 | {.....webFrame.executeJavaScript |
39e60 | 28 60 28 24 7b 28 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 74 72 79 20 7b 0a 20 20 20 20 20 20 | (`(${(().=>.{.......try.{....... |
39e80 | 20 20 6e 65 77 20 46 75 6e 63 74 69 6f 6e 28 27 27 29 20 2f 2f 20 65 73 6c 69 6e 74 2d 64 69 73 | ..new.Function('').//.eslint-dis |
39ea0 | 61 62 6c 65 2d 6c 69 6e 65 20 6e 6f 2d 6e 65 77 2c 6e 6f 2d 6e 65 77 2d 66 75 6e 63 0a 20 20 20 | able-line.no-new,no-new-func.... |
39ec0 | 20 20 20 7d 20 63 61 74 63 68 20 28 65 72 72 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 | ...}.catch.(err).{.........retur |
39ee0 | 6e 20 66 61 6c 73 65 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 72 75 | n.false.......}.......return.tru |
39f00 | 65 0a 20 20 20 20 7d 29 2e 74 6f 53 74 72 69 6e 67 28 29 7d 29 28 29 60 2c 20 72 65 73 6f 6c 76 | e.....}).toString()})()`,.resolv |
39f20 | 65 29 0a 20 20 7d 29 0a 7d 0a 0a 63 6f 6e 73 74 20 6d 6f 72 65 49 6e 66 6f 72 6d 61 74 69 6f 6e | e)...}).}..const.moreInformation |
39f40 | 20 3d 20 60 5c 6e 46 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 6e 64 20 68 | .=.`\nFor.more.information.and.h |
39f60 | 65 6c 70 2c 20 63 6f 6e 73 75 6c 74 0a 68 74 74 70 73 3a 2f 2f 65 6c 65 63 74 72 6f 6e 6a 73 2e | elp,.consult.https://electronjs. |
39f80 | 6f 72 67 2f 64 6f 63 73 2f 74 75 74 6f 72 69 61 6c 2f 73 65 63 75 72 69 74 79 2e 5c 6e 20 54 68 | org/docs/tutorial/security.\n.Th |
39fa0 | 69 73 20 77 61 72 6e 69 6e 67 20 77 69 6c 6c 20 6e 6f 74 20 73 68 6f 77 20 75 70 0a 6f 6e 63 65 | is.warning.will.not.show.up.once |
39fc0 | 20 74 68 65 20 61 70 70 20 69 73 20 70 61 63 6b 61 67 65 64 2e 60 0a 0a 2f 2a 2a 0a 20 2a 20 23 | .the.app.is.packaged.`../**..*.# |
39fe0 | 31 20 4f 6e 6c 79 20 6c 6f 61 64 20 73 65 63 75 72 65 20 63 6f 6e 74 65 6e 74 0a 20 2a 0a 20 2a | 1.Only.load.secure.content..*..* |
3a000 | 20 43 68 65 63 6b 73 20 74 68 65 20 6c 6f 61 64 65 64 20 72 65 73 6f 75 72 63 65 73 20 6f 6e 20 | .Checks.the.loaded.resources.on. |
3a020 | 74 68 65 20 63 75 72 72 65 6e 74 20 70 61 67 65 20 61 6e 64 20 6c 6f 67 73 20 61 0a 20 2a 20 6d | the.current.page.and.logs.a..*.m |
3a040 | 65 73 73 61 67 65 20 61 62 6f 75 74 20 61 6c 6c 20 72 65 73 6f 75 72 63 65 73 20 6c 6f 61 64 65 | essage.about.all.resources.loade |
3a060 | 64 20 6f 76 65 72 20 48 54 54 50 20 6f 72 20 46 54 50 2e 0a 20 2a 2f 0a 63 6f 6e 73 74 20 77 61 | d.over.HTTP.or.FTP...*/.const.wa |
3a080 | 72 6e 41 62 6f 75 74 49 6e 73 65 63 75 72 65 52 65 73 6f 75 72 63 65 73 20 3d 20 66 75 6e 63 74 | rnAboutInsecureResources.=.funct |
3a0a0 | 69 6f 6e 20 28 29 20 7b 0a 20 20 69 66 20 28 21 77 69 6e 64 6f 77 20 7c 7c 20 21 77 69 6e 64 6f | ion.().{...if.(!window.||.!windo |
3a0c0 | 77 2e 70 65 72 66 6f 72 6d 61 6e 63 65 20 7c 7c 20 21 77 69 6e 64 6f 77 2e 70 65 72 66 6f 72 6d | w.performance.||.!window.perform |
3a0e0 | 61 6e 63 65 2e 67 65 74 45 6e 74 72 69 65 73 42 79 54 79 70 65 29 20 7b 0a 20 20 20 20 72 65 74 | ance.getEntriesByType).{.....ret |
3a100 | 75 72 6e 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 72 65 73 6f 75 72 63 65 73 20 3d 20 77 69 6e | urn...}....const.resources.=.win |
3a120 | 64 6f 77 2e 70 65 72 66 6f 72 6d 61 6e 63 65 0a 20 20 20 20 2e 67 65 74 45 6e 74 72 69 65 73 42 | dow.performance......getEntriesB |
3a140 | 79 54 79 70 65 28 27 72 65 73 6f 75 72 63 65 27 29 0a 20 20 20 20 2e 66 69 6c 74 65 72 28 28 7b | yType('resource')......filter(({ |
3a160 | 20 6e 61 6d 65 20 7d 29 20 3d 3e 20 2f 5e 28 68 74 74 70 7c 66 74 70 29 3a 2f 67 69 2e 74 65 73 | .name.}).=>./^(http|ftp):/gi.tes |
3a180 | 74 28 6e 61 6d 65 20 7c 7c 20 27 27 29 29 0a 20 20 20 20 2e 6d 61 70 28 28 7b 20 6e 61 6d 65 20 | t(name.||.''))......map(({.name. |
3a1a0 | 7d 29 20 3d 3e 20 60 2d 20 24 7b 6e 61 6d 65 7d 60 29 0a 20 20 20 20 2e 6a 6f 69 6e 28 27 5c 6e | }).=>.`-.${name}`)......join('\n |
3a1c0 | 27 29 0a 0a 20 20 69 66 20 28 21 72 65 73 6f 75 72 63 65 73 20 7c 7c 20 72 65 73 6f 75 72 63 65 | ')....if.(!resources.||.resource |
3a1e0 | 73 2e 6c 65 6e 67 74 68 20 3d 3d 3d 20 30 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d | s.length.===.0).{.....return...} |
3a200 | 0a 0a 20 20 63 6f 6e 73 74 20 77 61 72 6e 69 6e 67 20 3d 20 60 54 68 69 73 20 72 65 6e 64 65 72 | ....const.warning.=.`This.render |
3a220 | 65 72 20 70 72 6f 63 65 73 73 20 6c 6f 61 64 73 20 72 65 73 6f 75 72 63 65 73 20 75 73 69 6e 67 | er.process.loads.resources.using |
3a240 | 20 69 6e 73 65 63 75 72 65 0a 20 20 70 72 6f 74 6f 63 6f 6c 73 2e 54 68 69 73 20 65 78 70 6f 73 | .insecure...protocols.This.expos |
3a260 | 65 73 20 75 73 65 72 73 20 6f 66 20 74 68 69 73 20 61 70 70 20 74 6f 20 75 6e 6e 65 63 65 73 73 | es.users.of.this.app.to.unnecess |
3a280 | 61 72 79 20 73 65 63 75 72 69 74 79 20 72 69 73 6b 73 2e 0a 20 20 43 6f 6e 73 69 64 65 72 20 6c | ary.security.risks....Consider.l |
3a2a0 | 6f 61 64 69 6e 67 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 72 65 73 6f 75 72 63 65 73 20 6f | oading.the.following.resources.o |
3a2c0 | 76 65 72 20 48 54 54 50 53 20 6f 72 20 46 54 50 53 2e 20 5c 6e 20 24 7b 72 65 73 6f 75 72 63 65 | ver.HTTPS.or.FTPS..\n.${resource |
3a2e0 | 73 7d 0a 20 20 5c 6e 20 24 7b 6d 6f 72 65 49 6e 66 6f 72 6d 61 74 69 6f 6e 7d 60 0a 0a 20 20 63 | s}...\n.${moreInformation}`....c |
3a300 | 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 27 25 63 45 6c 65 63 74 72 6f 6e 20 53 65 63 75 72 69 74 79 | onsole.warn('%cElectron.Security |
3a320 | 20 57 61 72 6e 69 6e 67 20 28 49 6e 73 65 63 75 72 65 20 52 65 73 6f 75 72 63 65 73 29 27 2c 0a | .Warning.(Insecure.Resources)',. |
3a340 | 20 20 20 20 27 66 6f 6e 74 2d 77 65 69 67 68 74 3a 20 62 6f 6c 64 3b 27 2c 20 77 61 72 6e 69 6e | ....'font-weight:.bold;',.warnin |
3a360 | 67 29 0a 7d 0a 0a 2f 2a 2a 0a 20 2a 20 23 32 20 6f 6e 20 74 68 65 20 63 68 65 63 6b 6c 69 73 74 | g).}../**..*.#2.on.the.checklist |
3a380 | 3a 20 44 69 73 61 62 6c 65 20 74 68 65 20 4e 6f 64 65 2e 6a 73 20 69 6e 74 65 67 72 61 74 69 6f | :.Disable.the.Node.js.integratio |
3a3a0 | 6e 20 69 6e 20 61 6c 6c 20 72 65 6e 64 65 72 65 72 73 20 74 68 61 74 0a 20 2a 20 64 69 73 70 6c | n.in.all.renderers.that..*.displ |
3a3c0 | 61 79 20 72 65 6d 6f 74 65 20 63 6f 6e 74 65 6e 74 0a 20 2a 0a 20 2a 20 4c 6f 67 73 20 61 20 77 | ay.remote.content..*..*.Logs.a.w |
3a3e0 | 61 72 6e 69 6e 67 20 6d 65 73 73 61 67 65 20 61 62 6f 75 74 20 4e 6f 64 65 20 69 6e 74 65 67 72 | arning.message.about.Node.integr |
3a400 | 61 74 69 6f 6e 2e 0a 20 2a 2f 0a 63 6f 6e 73 74 20 77 61 72 6e 41 62 6f 75 74 4e 6f 64 65 57 69 | ation...*/.const.warnAboutNodeWi |
3a420 | 74 68 52 65 6d 6f 74 65 43 6f 6e 74 65 6e 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6e 6f 64 65 | thRemoteContent.=.function.(node |
3a440 | 49 6e 74 65 67 72 61 74 69 6f 6e 29 20 7b 0a 20 20 69 66 20 28 21 6e 6f 64 65 49 6e 74 65 67 72 | Integration).{...if.(!nodeIntegr |
3a460 | 61 74 69 6f 6e 29 20 72 65 74 75 72 6e 0a 0a 20 20 69 66 20 28 67 65 74 49 73 52 65 6d 6f 74 65 | ation).return....if.(getIsRemote |
3a480 | 50 72 6f 74 6f 63 6f 6c 28 29 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 77 61 72 6e 69 6e 67 20 | Protocol()).{.....const.warning. |
3a4a0 | 3d 20 60 54 68 69 73 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 73 20 68 61 73 20 4e 6f 64 | =.`This.renderer.process.has.Nod |
3a4c0 | 65 2e 6a 73 20 69 6e 74 65 67 72 61 74 69 6f 6e 20 65 6e 61 62 6c 65 64 0a 20 20 20 20 61 6e 64 | e.js.integration.enabled.....and |
3a4e0 | 20 61 74 74 65 6d 70 74 65 64 20 74 6f 20 6c 6f 61 64 20 72 65 6d 6f 74 65 20 63 6f 6e 74 65 6e | .attempted.to.load.remote.conten |
3a500 | 74 20 66 72 6f 6d 20 27 24 7b 77 69 6e 64 6f 77 2e 6c 6f 63 61 74 69 6f 6e 7d 27 2e 20 54 68 69 | t.from.'${window.location}'..Thi |
3a520 | 73 0a 20 20 20 20 65 78 70 6f 73 65 73 20 75 73 65 72 73 20 6f 66 20 74 68 69 73 20 61 70 70 20 | s.....exposes.users.of.this.app. |
3a540 | 74 6f 20 73 65 76 65 72 65 20 73 65 63 75 72 69 74 79 20 72 69 73 6b 73 2e 5c 6e 20 24 7b 6d 6f | to.severe.security.risks.\n.${mo |
3a560 | 72 65 49 6e 66 6f 72 6d 61 74 69 6f 6e 7d 60 0a 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 | reInformation}`......console.war |
3a580 | 6e 28 27 25 63 45 6c 65 63 74 72 6f 6e 20 53 65 63 75 72 69 74 79 20 57 61 72 6e 69 6e 67 20 28 | n('%cElectron.Security.Warning.( |
3a5a0 | 4e 6f 64 65 2e 6a 73 20 49 6e 74 65 67 72 61 74 69 6f 6e 20 77 69 74 68 20 52 65 6d 6f 74 65 20 | Node.js.Integration.with.Remote. |
3a5c0 | 43 6f 6e 74 65 6e 74 29 27 2c 0a 20 20 20 20 20 20 27 66 6f 6e 74 2d 77 65 69 67 68 74 3a 20 62 | Content)',.......'font-weight:.b |
3a5e0 | 6f 6c 64 3b 27 2c 20 77 61 72 6e 69 6e 67 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 43 75 72 72 65 6e | old;',.warning)...}.}..//.Curren |
3a600 | 74 6c 79 20 6d 69 73 73 69 6e 67 20 73 69 6e 63 65 20 69 74 20 68 61 73 20 72 61 6d 69 66 69 63 | tly.missing.since.it.has.ramific |
3a620 | 61 74 69 6f 6e 73 20 61 6e 64 20 69 73 20 73 74 69 6c 6c 20 65 78 70 65 72 69 6d 65 6e 74 61 6c | ations.and.is.still.experimental |
3a640 | 3a 0a 2f 2f 20 20 20 23 33 20 45 6e 61 62 6c 65 20 63 6f 6e 74 65 78 74 20 69 73 6f 6c 61 74 69 | :.//...#3.Enable.context.isolati |
3a660 | 6f 6e 20 69 6e 20 61 6c 6c 20 72 65 6e 64 65 72 65 72 73 20 74 68 61 74 20 64 69 73 70 6c 61 79 | on.in.all.renderers.that.display |
3a680 | 20 72 65 6d 6f 74 65 20 63 6f 6e 74 65 6e 74 0a 2f 2f 0a 2f 2f 20 43 75 72 72 65 6e 74 6c 79 20 | .remote.content.//.//.Currently. |
3a6a0 | 6d 69 73 73 69 6e 67 20 73 69 6e 63 65 20 77 65 20 63 61 6e 27 74 20 65 61 73 69 6c 79 20 70 72 | missing.since.we.can't.easily.pr |
3a6c0 | 6f 67 72 61 6d 6d 61 74 69 63 61 6c 6c 79 20 63 68 65 63 6b 20 66 6f 72 20 74 68 6f 73 65 20 63 | ogrammatically.check.for.those.c |
3a6e0 | 61 73 65 73 3a 0a 2f 2f 20 20 20 23 34 20 55 73 65 20 73 65 73 2e 73 65 74 50 65 72 6d 69 73 73 | ases:.//...#4.Use.ses.setPermiss |
3a700 | 69 6f 6e 52 65 71 75 65 73 74 48 61 6e 64 6c 65 72 28 29 20 69 6e 20 61 6c 6c 20 73 65 73 73 69 | ionRequestHandler().in.all.sessi |
3a720 | 6f 6e 73 20 74 68 61 74 20 6c 6f 61 64 20 72 65 6d 6f 74 65 20 63 6f 6e 74 65 6e 74 0a 0a 2f 2a | ons.that.load.remote.content../* |
3a740 | 2a 0a 20 2a 20 23 35 20 6f 6e 20 74 68 65 20 63 68 65 63 6b 6c 69 73 74 3a 20 44 6f 20 6e 6f 74 | *..*.#5.on.the.checklist:.Do.not |
3a760 | 20 64 69 73 61 62 6c 65 20 77 65 62 73 65 63 75 72 69 74 79 0a 20 2a 0a 20 2a 20 4c 6f 67 73 20 | .disable.websecurity..*..*.Logs. |
3a780 | 61 20 77 61 72 6e 69 6e 67 20 6d 65 73 73 61 67 65 20 61 62 6f 75 74 20 64 69 73 61 62 6c 65 64 | a.warning.message.about.disabled |
3a7a0 | 20 77 65 62 53 65 63 75 72 69 74 79 2e 0a 20 2a 2f 0a 63 6f 6e 73 74 20 77 61 72 6e 41 62 6f 75 | .webSecurity...*/.const.warnAbou |
3a7c0 | 74 44 69 73 61 62 6c 65 64 57 65 62 53 65 63 75 72 69 74 79 20 3d 20 66 75 6e 63 74 69 6f 6e 20 | tDisabledWebSecurity.=.function. |
3a7e0 | 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 20 7b 0a 20 20 69 66 20 28 21 77 65 62 50 72 65 | (webPreferences).{...if.(!webPre |
3a800 | 66 65 72 65 6e 63 65 73 20 7c 7c 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2e 77 65 62 53 65 | ferences.||.webPreferences.webSe |
3a820 | 63 75 72 69 74 79 20 21 3d 3d 20 66 61 6c 73 65 29 20 72 65 74 75 72 6e 0a 0a 20 20 63 6f 6e 73 | curity.!==.false).return....cons |
3a840 | 74 20 77 61 72 6e 69 6e 67 20 3d 20 60 54 68 69 73 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 | t.warning.=.`This.renderer.proce |
3a860 | 73 73 20 68 61 73 20 22 77 65 62 53 65 63 75 72 69 74 79 22 20 64 69 73 61 62 6c 65 64 2e 20 54 | ss.has."webSecurity".disabled..T |
3a880 | 68 69 73 0a 20 20 65 78 70 6f 73 65 73 20 75 73 65 72 73 20 6f 66 20 74 68 69 73 20 61 70 70 20 | his...exposes.users.of.this.app. |
3a8a0 | 74 6f 20 73 65 76 65 72 65 20 73 65 63 75 72 69 74 79 20 72 69 73 6b 73 2e 5c 6e 20 24 7b 6d 6f | to.severe.security.risks.\n.${mo |
3a8c0 | 72 65 49 6e 66 6f 72 6d 61 74 69 6f 6e 7d 60 0a 0a 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 | reInformation}`....console.warn( |
3a8e0 | 27 25 63 45 6c 65 63 74 72 6f 6e 20 53 65 63 75 72 69 74 79 20 57 61 72 6e 69 6e 67 20 28 44 69 | '%cElectron.Security.Warning.(Di |
3a900 | 73 61 62 6c 65 64 20 77 65 62 53 65 63 75 72 69 74 79 29 27 2c 0a 20 20 20 20 27 66 6f 6e 74 2d | sabled.webSecurity)',.....'font- |
3a920 | 77 65 69 67 68 74 3a 20 62 6f 6c 64 3b 27 2c 20 77 61 72 6e 69 6e 67 29 0a 7d 0a 0a 2f 2a 2a 0a | weight:.bold;',.warning).}../**. |
3a940 | 20 2a 20 23 36 20 6f 6e 20 74 68 65 20 63 68 65 63 6b 6c 69 73 74 3a 20 44 65 66 69 6e 65 20 61 | .*.#6.on.the.checklist:.Define.a |
3a960 | 20 43 6f 6e 74 65 6e 74 2d 53 65 63 75 72 69 74 79 2d 50 6f 6c 69 63 79 20 61 6e 64 20 75 73 65 | .Content-Security-Policy.and.use |
3a980 | 20 72 65 73 74 72 69 63 74 69 76 65 0a 20 2a 20 72 75 6c 65 73 20 28 69 2e 65 2e 20 73 63 72 69 | .restrictive..*.rules.(i.e..scri |
3a9a0 | 70 74 2d 73 72 63 20 27 73 65 6c 66 27 29 0a 20 2a 0a 20 2a 20 23 37 20 6f 6e 20 74 68 65 20 63 | pt-src.'self')..*..*.#7.on.the.c |
3a9c0 | 68 65 63 6b 6c 69 73 74 3a 20 44 69 73 61 62 6c 65 20 65 76 61 6c 0a 20 2a 0a 20 2a 20 4c 6f 67 | hecklist:.Disable.eval..*..*.Log |
3a9e0 | 73 20 61 20 77 61 72 6e 69 6e 67 20 6d 65 73 73 61 67 65 20 61 62 6f 75 74 20 75 6e 73 65 74 20 | s.a.warning.message.about.unset. |
3aa00 | 6f 72 20 69 6e 73 65 63 75 72 65 20 43 53 50 0a 20 2a 2f 0a 63 6f 6e 73 74 20 77 61 72 6e 41 62 | or.insecure.CSP..*/.const.warnAb |
3aa20 | 6f 75 74 49 6e 73 65 63 75 72 65 43 53 50 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 | outInsecureCSP.=.function.().{.. |
3aa40 | 20 69 73 55 6e 73 61 66 65 45 76 61 6c 45 6e 61 62 6c 65 64 28 29 2e 74 68 65 6e 28 28 65 6e 61 | .isUnsafeEvalEnabled().then((ena |
3aa60 | 62 6c 65 64 29 20 3d 3e 20 7b 0a 20 20 20 20 69 66 20 28 21 65 6e 61 62 6c 65 64 29 20 72 65 74 | bled).=>.{.....if.(!enabled).ret |
3aa80 | 75 72 6e 0a 0a 20 20 20 20 63 6f 6e 73 74 20 77 61 72 6e 69 6e 67 20 3d 20 60 54 68 69 73 20 72 | urn......const.warning.=.`This.r |
3aaa0 | 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 73 20 68 61 73 20 65 69 74 68 65 72 20 6e 6f 20 43 6f | enderer.process.has.either.no.Co |
3aac0 | 6e 74 65 6e 74 20 53 65 63 75 72 69 74 79 0a 20 20 20 20 50 6f 6c 69 63 79 20 73 65 74 20 6f 72 | ntent.Security.....Policy.set.or |
3aae0 | 20 61 20 70 6f 6c 69 63 79 20 77 69 74 68 20 22 75 6e 73 61 66 65 2d 65 76 61 6c 22 20 65 6e 61 | .a.policy.with."unsafe-eval".ena |
3ab00 | 62 6c 65 64 2e 20 54 68 69 73 20 65 78 70 6f 73 65 73 20 75 73 65 72 73 20 6f 66 0a 20 20 20 20 | bled..This.exposes.users.of..... |
3ab20 | 74 68 69 73 20 61 70 70 20 74 6f 20 75 6e 6e 65 63 65 73 73 61 72 79 20 73 65 63 75 72 69 74 79 | this.app.to.unnecessary.security |
3ab40 | 20 72 69 73 6b 73 2e 5c 6e 20 24 7b 6d 6f 72 65 49 6e 66 6f 72 6d 61 74 69 6f 6e 7d 60 0a 0a 20 | .risks.\n.${moreInformation}`... |
3ab60 | 20 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 27 25 63 45 6c 65 63 74 72 6f 6e 20 53 65 63 75 | ...console.warn('%cElectron.Secu |
3ab80 | 72 69 74 79 20 57 61 72 6e 69 6e 67 20 28 49 6e 73 65 63 75 72 65 20 43 6f 6e 74 65 6e 74 2d 53 | rity.Warning.(Insecure.Content-S |
3aba0 | 65 63 75 72 69 74 79 2d 50 6f 6c 69 63 79 29 27 2c 0a 20 20 20 20 20 20 27 66 6f 6e 74 2d 77 65 | ecurity-Policy)',.......'font-we |
3abc0 | 69 67 68 74 3a 20 62 6f 6c 64 3b 27 2c 20 77 61 72 6e 69 6e 67 29 0a 20 20 7d 29 0a 7d 0a 0a 2f | ight:.bold;',.warning)...}).}../ |
3abe0 | 2a 2a 0a 20 2a 20 23 38 20 6f 6e 20 74 68 65 20 63 68 65 63 6b 6c 69 73 74 3a 20 44 6f 20 6e 6f | **..*.#8.on.the.checklist:.Do.no |
3ac00 | 74 20 73 65 74 20 61 6c 6c 6f 77 52 75 6e 6e 69 6e 67 49 6e 73 65 63 75 72 65 43 6f 6e 74 65 6e | t.set.allowRunningInsecureConten |
3ac20 | 74 20 74 6f 20 74 72 75 65 0a 20 2a 0a 20 2a 20 4c 6f 67 73 20 61 20 77 61 72 6e 69 6e 67 20 6d | t.to.true..*..*.Logs.a.warning.m |
3ac40 | 65 73 73 61 67 65 20 61 62 6f 75 74 20 64 69 73 61 62 6c 65 64 20 77 65 62 53 65 63 75 72 69 74 | essage.about.disabled.webSecurit |
3ac60 | 79 2e 0a 20 2a 2f 0a 63 6f 6e 73 74 20 77 61 72 6e 41 62 6f 75 74 49 6e 73 65 63 75 72 65 43 6f | y...*/.const.warnAboutInsecureCo |
3ac80 | 6e 74 65 6e 74 41 6c 6c 6f 77 65 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 65 62 50 72 65 66 | ntentAllowed.=.function.(webPref |
3aca0 | 65 72 65 6e 63 65 73 29 20 7b 0a 20 20 69 66 20 28 21 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 | erences).{...if.(!webPreferences |
3acc0 | 20 7c 7c 20 21 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2e 61 6c 6c 6f 77 52 75 6e 6e 69 6e 67 | .||.!webPreferences.allowRunning |
3ace0 | 49 6e 73 65 63 75 72 65 43 6f 6e 74 65 6e 74 29 20 72 65 74 75 72 6e 0a 0a 20 20 63 6f 6e 73 74 | InsecureContent).return....const |
3ad00 | 20 77 61 72 6e 69 6e 67 20 3d 20 60 54 68 69 73 20 72 65 6e 64 65 72 65 72 20 70 72 6f 63 65 73 | .warning.=.`This.renderer.proces |
3ad20 | 73 20 68 61 73 20 22 61 6c 6c 6f 77 52 75 6e 6e 69 6e 67 49 6e 73 65 63 75 72 65 43 6f 6e 74 65 | s.has."allowRunningInsecureConte |
3ad40 | 6e 74 22 0a 20 20 65 6e 61 62 6c 65 64 2e 20 54 68 69 73 20 65 78 70 6f 73 65 73 20 75 73 65 72 | nt"...enabled..This.exposes.user |
3ad60 | 73 20 6f 66 20 74 68 69 73 20 61 70 70 20 74 6f 20 73 65 76 65 72 65 20 73 65 63 75 72 69 74 79 | s.of.this.app.to.severe.security |
3ad80 | 20 72 69 73 6b 73 2e 5c 6e 0a 20 20 24 7b 6d 6f 72 65 49 6e 66 6f 72 6d 61 74 69 6f 6e 7d 60 0a | .risks.\n...${moreInformation}`. |
3ada0 | 0a 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 27 25 63 45 6c 65 63 74 72 6f 6e 20 53 65 63 75 | ...console.warn('%cElectron.Secu |
3adc0 | 72 69 74 79 20 57 61 72 6e 69 6e 67 20 28 61 6c 6c 6f 77 52 75 6e 6e 69 6e 67 49 6e 73 65 63 75 | rity.Warning.(allowRunningInsecu |
3ade0 | 72 65 43 6f 6e 74 65 6e 74 29 27 2c 0a 20 20 20 20 27 66 6f 6e 74 2d 77 65 69 67 68 74 3a 20 62 | reContent)',.....'font-weight:.b |
3ae00 | 6f 6c 64 3b 27 2c 20 77 61 72 6e 69 6e 67 29 0a 7d 0a 0a 2f 2a 2a 0a 20 2a 20 23 39 20 6f 6e 20 | old;',.warning).}../**..*.#9.on. |
3ae20 | 74 68 65 20 63 68 65 63 6b 6c 69 73 74 3a 20 44 6f 20 6e 6f 74 20 65 6e 61 62 6c 65 20 65 78 70 | the.checklist:.Do.not.enable.exp |
3ae40 | 65 72 69 6d 65 6e 74 61 6c 20 66 65 61 74 75 72 65 73 0a 20 2a 0a 20 2a 20 4c 6f 67 73 20 61 20 | erimental.features..*..*.Logs.a. |
3ae60 | 77 61 72 6e 69 6e 67 20 6d 65 73 73 61 67 65 20 61 62 6f 75 74 20 65 78 70 65 72 69 6d 65 6e 74 | warning.message.about.experiment |
3ae80 | 61 6c 20 66 65 61 74 75 72 65 73 2e 0a 20 2a 2f 0a 63 6f 6e 73 74 20 77 61 72 6e 41 62 6f 75 74 | al.features...*/.const.warnAbout |
3aea0 | 45 78 70 65 72 69 6d 65 6e 74 61 6c 46 65 61 74 75 72 65 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 | ExperimentalFeatures.=.function. |
3aec0 | 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 20 7b 0a 20 20 69 66 20 28 21 77 65 62 50 72 65 | (webPreferences).{...if.(!webPre |
3aee0 | 66 65 72 65 6e 63 65 73 20 7c 7c 20 28 21 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2e 65 78 70 | ferences.||.(!webPreferences.exp |
3af00 | 65 72 69 6d 65 6e 74 61 6c 46 65 61 74 75 72 65 73 29 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e | erimentalFeatures)).{.....return |
3af20 | 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 77 61 72 6e 69 6e 67 20 3d 20 60 54 68 69 73 20 72 65 | ...}....const.warning.=.`This.re |
3af40 | 6e 64 65 72 65 72 20 70 72 6f 63 65 73 73 20 68 61 73 20 22 65 78 70 65 72 69 6d 65 6e 74 61 6c | nderer.process.has."experimental |
3af60 | 46 65 61 74 75 72 65 73 22 20 65 6e 61 62 6c 65 64 2e 0a 20 20 54 68 69 73 20 65 78 70 6f 73 65 | Features".enabled....This.expose |
3af80 | 73 20 75 73 65 72 73 20 6f 66 20 74 68 69 73 20 61 70 70 20 74 6f 20 73 6f 6d 65 20 73 65 63 75 | s.users.of.this.app.to.some.secu |
3afa0 | 72 69 74 79 20 72 69 73 6b 2e 20 49 66 20 79 6f 75 20 64 6f 20 6e 6f 74 20 6e 65 65 64 0a 20 20 | rity.risk..If.you.do.not.need... |
3afc0 | 74 68 69 73 20 66 65 61 74 75 72 65 2c 20 79 6f 75 20 73 68 6f 75 6c 64 20 64 69 73 61 62 6c 65 | this.feature,.you.should.disable |
3afe0 | 20 69 74 2e 5c 6e 20 24 7b 6d 6f 72 65 49 6e 66 6f 72 6d 61 74 69 6f 6e 7d 60 0a 0a 20 20 63 6f | .it.\n.${moreInformation}`....co |
3b000 | 6e 73 6f 6c 65 2e 77 61 72 6e 28 27 25 63 45 6c 65 63 74 72 6f 6e 20 53 65 63 75 72 69 74 79 20 | nsole.warn('%cElectron.Security. |
3b020 | 57 61 72 6e 69 6e 67 20 28 65 78 70 65 72 69 6d 65 6e 74 61 6c 46 65 61 74 75 72 65 73 29 27 2c | Warning.(experimentalFeatures)', |
3b040 | 0a 20 20 20 20 27 66 6f 6e 74 2d 77 65 69 67 68 74 3a 20 62 6f 6c 64 3b 27 2c 20 77 61 72 6e 69 | .....'font-weight:.bold;',.warni |
3b060 | 6e 67 29 0a 7d 0a 0a 2f 2a 2a 0a 20 2a 20 23 31 30 20 6f 6e 20 74 68 65 20 63 68 65 63 6b 6c 69 | ng).}../**..*.#10.on.the.checkli |
3b080 | 73 74 3a 20 44 6f 20 6e 6f 74 20 75 73 65 20 65 6e 61 62 6c 65 42 6c 69 6e 6b 46 65 61 74 75 72 | st:.Do.not.use.enableBlinkFeatur |
3b0a0 | 65 73 0a 20 2a 0a 20 2a 20 4c 6f 67 73 20 61 20 77 61 72 6e 69 6e 67 20 6d 65 73 73 61 67 65 20 | es..*..*.Logs.a.warning.message. |
3b0c0 | 61 62 6f 75 74 20 65 6e 61 62 6c 65 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 0a 20 2a 2f 0a 63 6f | about.enableBlinkFeatures..*/.co |
3b0e0 | 6e 73 74 20 77 61 72 6e 41 62 6f 75 74 45 6e 61 62 6c 65 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 | nst.warnAboutEnableBlinkFeatures |
3b100 | 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 20 7b 0a 20 | .=.function.(webPreferences).{.. |
3b120 | 20 69 66 20 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d 3d 3d 20 6e 75 6c 6c 20 7c 7c 0a | .if.(webPreferences.===.null.||. |
3b140 | 20 20 20 20 21 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 | ....!webPreferences.hasOwnProper |
3b160 | 74 79 28 27 65 6e 61 62 6c 65 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 27 29 20 7c 7c 0a 20 20 20 | ty('enableBlinkFeatures').||.... |
3b180 | 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2e 65 6e 61 62 6c 65 42 6c 69 6e 6b 46 65 61 74 75 | .webPreferences.enableBlinkFeatu |
3b1a0 | 72 65 73 2e 6c 65 6e 67 74 68 20 3d 3d 3d 20 30 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 | res.length.===.0).{.....return.. |
3b1c0 | 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 77 61 72 6e 69 6e 67 20 3d 20 60 54 68 69 73 20 72 65 6e 64 | .}....const.warning.=.`This.rend |
3b1e0 | 65 72 65 72 20 70 72 6f 63 65 73 73 20 68 61 73 20 61 64 64 69 74 69 6f 6e 61 6c 20 22 65 6e 61 | erer.process.has.additional."ena |
3b200 | 62 6c 65 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 22 0a 20 20 65 6e 61 62 6c 65 64 2e 20 54 68 69 | bleBlinkFeatures"...enabled..Thi |
3b220 | 73 20 65 78 70 6f 73 65 73 20 75 73 65 72 73 20 6f 66 20 74 68 69 73 20 61 70 70 20 74 6f 20 73 | s.exposes.users.of.this.app.to.s |
3b240 | 6f 6d 65 20 73 65 63 75 72 69 74 79 20 72 69 73 6b 2e 20 49 66 20 79 6f 75 20 64 6f 20 6e 6f 74 | ome.security.risk..If.you.do.not |
3b260 | 0a 20 20 6e 65 65 64 20 74 68 69 73 20 66 65 61 74 75 72 65 2c 20 79 6f 75 20 73 68 6f 75 6c 64 | ...need.this.feature,.you.should |
3b280 | 20 64 69 73 61 62 6c 65 20 69 74 2e 5c 6e 20 24 7b 6d 6f 72 65 49 6e 66 6f 72 6d 61 74 69 6f 6e | .disable.it.\n.${moreInformation |
3b2a0 | 7d 60 0a 0a 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 27 25 63 45 6c 65 63 74 72 6f 6e 20 53 | }`....console.warn('%cElectron.S |
3b2c0 | 65 63 75 72 69 74 79 20 57 61 72 6e 69 6e 67 20 28 65 6e 61 62 6c 65 42 6c 69 6e 6b 46 65 61 74 | ecurity.Warning.(enableBlinkFeat |
3b2e0 | 75 72 65 73 29 27 2c 0a 20 20 20 20 27 66 6f 6e 74 2d 77 65 69 67 68 74 3a 20 62 6f 6c 64 3b 27 | ures)',.....'font-weight:.bold;' |
3b300 | 2c 20 77 61 72 6e 69 6e 67 29 0a 7d 0a 0a 2f 2a 2a 0a 20 2a 20 23 31 31 20 6f 6e 20 74 68 65 20 | ,.warning).}../**..*.#11.on.the. |
3b320 | 63 68 65 63 6b 6c 69 73 74 3a 20 44 6f 20 4e 6f 74 20 55 73 65 20 61 6c 6c 6f 77 70 6f 70 75 70 | checklist:.Do.Not.Use.allowpopup |
3b340 | 73 0a 20 2a 0a 20 2a 20 4c 6f 67 73 20 61 20 77 61 72 6e 69 6e 67 20 6d 65 73 73 61 67 65 20 61 | s..*..*.Logs.a.warning.message.a |
3b360 | 62 6f 75 74 20 61 6c 6c 6f 77 65 64 20 70 6f 70 75 70 73 0a 20 2a 2f 0a 63 6f 6e 73 74 20 77 61 | bout.allowed.popups..*/.const.wa |
3b380 | 72 6e 41 62 6f 75 74 41 6c 6c 6f 77 65 64 50 6f 70 75 70 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 | rnAboutAllowedPopups.=.function. |
3b3a0 | 28 29 20 7b 0a 20 20 69 66 20 28 64 6f 63 75 6d 65 6e 74 20 26 26 20 64 6f 63 75 6d 65 6e 74 2e | ().{...if.(document.&&.document. |
3b3c0 | 71 75 65 72 79 53 65 6c 65 63 74 6f 72 41 6c 6c 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 64 6f | querySelectorAll).{.....const.do |
3b3e0 | 6d 45 6c 65 6d 65 6e 74 73 20 3d 20 64 6f 63 75 6d 65 6e 74 2e 71 75 65 72 79 53 65 6c 65 63 74 | mElements.=.document.querySelect |
3b400 | 6f 72 41 6c 6c 28 27 5b 61 6c 6c 6f 77 70 6f 70 75 70 73 5d 27 29 0a 0a 20 20 20 20 69 66 20 28 | orAll('[allowpopups]')......if.( |
3b420 | 21 64 6f 6d 45 6c 65 6d 65 6e 74 73 20 7c 7c 20 64 6f 6d 45 6c 65 6d 65 6e 74 73 2e 6c 65 6e 67 | !domElements.||.domElements.leng |
3b440 | 74 68 20 3d 3d 3d 20 30 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a | th.===.0).{.......return.....}.. |
3b460 | 20 20 20 20 63 6f 6e 73 74 20 77 61 72 6e 69 6e 67 20 3d 20 60 41 20 3c 77 65 62 76 69 65 77 3e | ....const.warning.=.`A.<webview> |
3b480 | 20 68 61 73 20 22 61 6c 6c 6f 77 70 6f 70 75 70 73 22 20 73 65 74 20 74 6f 20 74 72 75 65 2e 20 | .has."allowpopups".set.to.true.. |
3b4a0 | 54 68 69 73 20 65 78 70 6f 73 65 73 0a 20 20 20 20 75 73 65 72 73 20 6f 66 20 74 68 69 73 20 61 | This.exposes.....users.of.this.a |
3b4c0 | 70 70 20 74 6f 20 73 6f 6d 65 20 73 65 63 75 72 69 74 79 20 72 69 73 6b 2c 20 73 69 6e 63 65 20 | pp.to.some.security.risk,.since. |
3b4e0 | 70 6f 70 75 70 73 20 61 72 65 20 6a 75 73 74 0a 20 20 20 20 42 72 6f 77 73 65 72 57 69 6e 64 6f | popups.are.just.....BrowserWindo |
3b500 | 77 73 2e 20 49 66 20 79 6f 75 20 64 6f 20 6e 6f 74 20 6e 65 65 64 20 74 68 69 73 20 66 65 61 74 | ws..If.you.do.not.need.this.feat |
3b520 | 75 72 65 2c 20 79 6f 75 20 73 68 6f 75 6c 64 20 64 69 73 61 62 6c 65 20 69 74 2e 5c 6e 0a 20 20 | ure,.you.should.disable.it.\n... |
3b540 | 20 20 24 7b 6d 6f 72 65 49 6e 66 6f 72 6d 61 74 69 6f 6e 7d 60 0a 0a 20 20 20 20 63 6f 6e 73 6f | ..${moreInformation}`......conso |
3b560 | 6c 65 2e 77 61 72 6e 28 27 25 63 45 6c 65 63 74 72 6f 6e 20 53 65 63 75 72 69 74 79 20 57 61 72 | le.warn('%cElectron.Security.War |
3b580 | 6e 69 6e 67 20 28 61 6c 6c 6f 77 70 6f 70 75 70 73 29 27 2c 0a 20 20 20 20 20 20 27 66 6f 6e 74 | ning.(allowpopups)',.......'font |
3b5a0 | 2d 77 65 69 67 68 74 3a 20 62 6f 6c 64 3b 27 2c 20 77 61 72 6e 69 6e 67 29 0a 20 20 7d 0a 7d 0a | -weight:.bold;',.warning)...}.}. |
3b5c0 | 0a 63 6f 6e 73 74 20 77 61 72 6e 41 62 6f 75 74 4e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 44 | .const.warnAboutNodeIntegrationD |
3b5e0 | 65 66 61 75 6c 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 | efault.=.function.(webPreference |
3b600 | 73 29 20 7b 0a 20 20 69 66 20 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 26 26 20 77 65 62 | s).{...if.(webPreferences.&&.web |
3b620 | 50 72 65 66 65 72 65 6e 63 65 73 2e 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 20 26 26 20 21 | Preferences.nodeIntegration.&&.! |
3b640 | 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2e 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 57 61 | webPreferences.nodeIntegrationWa |
3b660 | 73 45 78 70 6c 69 63 69 74 6c 79 45 6e 61 62 6c 65 64 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 | sExplicitlyEnabled).{.....const. |
3b680 | 77 61 72 6e 69 6e 67 20 3d 20 60 54 68 69 73 20 77 69 6e 64 6f 77 20 68 61 73 20 6e 6f 64 65 20 | warning.=.`This.window.has.node. |
3b6a0 | 69 6e 74 65 67 72 61 74 69 6f 6e 20 65 6e 61 62 6c 65 64 20 62 79 20 64 65 66 61 75 6c 74 2e 20 | integration.enabled.by.default.. |
3b6c0 | 49 6e 20 60 20 2b 0a 20 20 20 20 20 20 20 20 60 45 6c 65 63 74 72 6f 6e 20 35 2e 30 2e 30 2c 20 | In.`.+.........`Electron.5.0.0,. |
3b6e0 | 6e 6f 64 65 20 69 6e 74 65 67 72 61 74 69 6f 6e 20 77 69 6c 6c 20 62 65 20 64 69 73 61 62 6c 65 | node.integration.will.be.disable |
3b700 | 64 20 62 79 20 64 65 66 61 75 6c 74 2e 20 54 6f 20 70 72 65 70 61 72 65 20 60 20 2b 0a 20 20 20 | d.by.default..To.prepare.`.+.... |
3b720 | 20 20 20 20 20 60 66 6f 72 20 74 68 69 73 20 63 68 61 6e 67 65 2c 20 73 65 74 20 7b 6e 6f 64 65 | .....`for.this.change,.set.{node |
3b740 | 49 6e 74 65 67 72 61 74 69 6f 6e 3a 20 74 72 75 65 7d 20 69 6e 20 74 68 65 20 77 65 62 50 72 65 | Integration:.true}.in.the.webPre |
3b760 | 66 65 72 65 6e 63 65 73 20 66 6f 72 20 60 20 2b 0a 20 20 20 20 20 20 20 20 60 74 68 69 73 20 77 | ferences.for.`.+.........`this.w |
3b780 | 69 6e 64 6f 77 2c 20 6f 72 20 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 69 73 20 77 69 6e 64 6f | indow,.or.ensure.that.this.windo |
3b7a0 | 77 20 64 6f 65 73 20 6e 6f 74 20 72 65 6c 79 20 6f 6e 20 6e 6f 64 65 20 69 6e 74 65 67 72 61 74 | w.does.not.rely.on.node.integrat |
3b7c0 | 69 6f 6e 20 60 20 2b 0a 20 20 20 20 20 20 20 20 60 61 6e 64 20 73 65 74 20 7b 6e 6f 64 65 49 6e | ion.`.+.........`and.set.{nodeIn |
3b7e0 | 74 65 67 72 61 74 69 6f 6e 3a 20 66 61 6c 73 65 7d 2e 60 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e | tegration:.false}.`.....console. |
3b800 | 77 61 72 6e 28 27 25 63 45 6c 65 63 74 72 6f 6e 20 44 65 70 72 65 63 61 74 69 6f 6e 20 57 61 72 | warn('%cElectron.Deprecation.War |
3b820 | 6e 69 6e 67 20 28 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 20 64 65 66 61 75 6c 74 20 63 68 | ning.(nodeIntegration.default.ch |
3b840 | 61 6e 67 65 29 27 2c 20 27 66 6f 6e 74 2d 77 65 69 67 68 74 3a 20 62 6f 6c 64 3b 27 2c 20 77 61 | ange)',.'font-weight:.bold;',.wa |
3b860 | 72 6e 69 6e 67 29 0a 20 20 7d 0a 7d 0a 0a 63 6f 6e 73 74 20 77 61 72 6e 41 62 6f 75 74 43 6f 6e | rning)...}.}..const.warnAboutCon |
3b880 | 74 65 78 74 49 73 6f 6c 61 74 69 6f 6e 44 65 66 61 75 6c 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 | textIsolationDefault.=.function. |
3b8a0 | 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 20 7b 0a 20 20 69 66 20 28 77 65 62 50 72 65 66 | (webPreferences).{...if.(webPref |
3b8c0 | 65 72 65 6e 63 65 73 20 26 26 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2e 70 72 65 6c 6f 61 | erences.&&.webPreferences.preloa |
3b8e0 | 64 20 26 26 20 21 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2e 63 6f 6e 74 65 78 74 49 73 6f 6c | d.&&.!webPreferences.contextIsol |
3b900 | 61 74 69 6f 6e 20 26 26 20 21 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2e 63 6f 6e 74 65 78 74 | ation.&&.!webPreferences.context |
3b920 | 49 73 6f 6c 61 74 69 6f 6e 57 61 73 45 78 70 6c 69 63 69 74 6c 79 44 69 73 61 62 6c 65 64 29 20 | IsolationWasExplicitlyDisabled). |
3b940 | 7b 0a 20 20 20 20 63 6f 6e 73 74 20 75 72 6c 20 3d 20 27 68 74 74 70 73 3a 2f 2f 65 6c 65 63 74 | {.....const.url.=.'https://elect |
3b960 | 72 6f 6e 6a 73 2e 6f 72 67 2f 64 6f 63 73 2f 74 75 74 6f 72 69 61 6c 2f 73 65 63 75 72 69 74 79 | ronjs.org/docs/tutorial/security |
3b980 | 23 33 2d 65 6e 61 62 6c 65 2d 63 6f 6e 74 65 78 74 2d 69 73 6f 6c 61 74 69 6f 6e 2d 66 6f 72 2d | #3-enable-context-isolation-for- |
3b9a0 | 72 65 6d 6f 74 65 2d 63 6f 6e 74 65 6e 74 27 0a 20 20 20 20 63 6f 6e 73 74 20 77 61 72 6e 69 6e | remote-content'.....const.warnin |
3b9c0 | 67 20 3d 20 60 54 68 69 73 20 77 69 6e 64 6f 77 20 68 61 73 20 63 6f 6e 74 65 78 74 20 69 73 6f | g.=.`This.window.has.context.iso |
3b9e0 | 6c 61 74 69 6f 6e 20 64 69 73 61 62 6c 65 64 20 62 79 20 64 65 66 61 75 6c 74 2e 20 49 6e 20 60 | lation.disabled.by.default..In.` |
3ba00 | 20 2b 0a 20 20 20 20 20 20 20 20 60 45 6c 65 63 74 72 6f 6e 20 35 2e 30 2e 30 2c 20 63 6f 6e 74 | .+.........`Electron.5.0.0,.cont |
3ba20 | 65 78 74 20 69 73 6f 6c 61 74 69 6f 6e 20 77 69 6c 6c 20 62 65 20 65 6e 61 62 6c 65 64 20 62 79 | ext.isolation.will.be.enabled.by |
3ba40 | 20 64 65 66 61 75 6c 74 2e 20 54 6f 20 70 72 65 70 61 72 65 20 60 20 2b 0a 20 20 20 20 20 20 20 | .default..To.prepare.`.+........ |
3ba60 | 20 60 66 6f 72 20 74 68 69 73 20 63 68 61 6e 67 65 2c 20 73 65 74 20 7b 63 6f 6e 74 65 78 74 49 | .`for.this.change,.set.{contextI |
3ba80 | 73 6f 6c 61 74 69 6f 6e 3a 20 66 61 6c 73 65 7d 20 69 6e 20 74 68 65 20 77 65 62 50 72 65 66 65 | solation:.false}.in.the.webPrefe |
3baa0 | 72 65 6e 63 65 73 20 66 6f 72 20 60 20 2b 0a 20 20 20 20 20 20 20 20 60 74 68 69 73 20 77 69 6e | rences.for.`.+.........`this.win |
3bac0 | 64 6f 77 2c 20 6f 72 20 65 6e 73 75 72 65 20 74 68 61 74 20 74 68 69 73 20 77 69 6e 64 6f 77 20 | dow,.or.ensure.that.this.window. |
3bae0 | 64 6f 65 73 20 6e 6f 74 20 72 65 6c 79 20 6f 6e 20 63 6f 6e 74 65 78 74 20 60 20 2b 0a 20 20 20 | does.not.rely.on.context.`.+.... |
3bb00 | 20 20 20 20 20 60 69 73 6f 6c 61 74 69 6f 6e 20 62 65 69 6e 67 20 64 69 73 61 62 6c 65 64 2c 20 | .....`isolation.being.disabled,. |
3bb20 | 61 6e 64 20 73 65 74 20 7b 63 6f 6e 74 65 78 74 49 73 6f 6c 61 74 69 6f 6e 3a 20 74 72 75 65 7d | and.set.{contextIsolation:.true} |
3bb40 | 2e 5c 6e 5c 6e 60 20 2b 0a 20 20 20 20 20 20 20 20 60 46 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 72 | .\n\n`.+.........`For.more.infor |
3bb60 | 6d 61 74 69 6f 6e 2c 20 73 65 65 20 24 7b 75 72 6c 7d 60 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e | mation,.see.${url}`.....console. |
3bb80 | 77 61 72 6e 28 27 25 63 45 6c 65 63 74 72 6f 6e 20 44 65 70 72 65 63 61 74 69 6f 6e 20 57 61 72 | warn('%cElectron.Deprecation.War |
3bba0 | 6e 69 6e 67 20 28 63 6f 6e 74 65 78 74 49 73 6f 6c 61 74 69 6f 6e 20 64 65 66 61 75 6c 74 20 63 | ning.(contextIsolation.default.c |
3bbc0 | 68 61 6e 67 65 29 27 2c 20 27 66 6f 6e 74 2d 77 65 69 67 68 74 3a 20 62 6f 6c 64 3b 27 2c 20 77 | hange)',.'font-weight:.bold;',.w |
3bbe0 | 61 72 6e 69 6e 67 29 0a 20 20 7d 0a 7d 0a 0a 63 6f 6e 73 74 20 77 61 72 6e 41 62 6f 75 74 44 65 | arning)...}.}..const.warnAboutDe |
3bc00 | 70 72 65 63 61 74 65 64 57 65 62 76 69 65 77 54 61 67 44 65 66 61 75 6c 74 20 3d 20 66 75 6e 63 | precatedWebviewTagDefault.=.func |
3bc20 | 74 69 6f 6e 20 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 20 7b 0a 20 20 69 66 20 28 21 77 | tion.(webPreferences).{...if.(!w |
3bc40 | 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 0a 20 20 7d 0a | ebPreferences).{.....return...}. |
3bc60 | 20 20 69 66 20 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 2e 77 65 62 76 69 65 77 54 61 67 57 | ..if.(webPreferences.webviewTagW |
3bc80 | 61 73 45 78 70 6c 69 63 69 74 6c 79 45 6e 61 62 6c 65 64 29 20 7b 0a 20 20 20 20 72 65 74 75 72 | asExplicitlyEnabled).{.....retur |
3bca0 | 6e 0a 20 20 7d 0a 20 20 69 66 20 28 21 64 6f 63 75 6d 65 6e 74 20 7c 7c 20 21 64 6f 63 75 6d 65 | n...}...if.(!document.||.!docume |
3bcc0 | 6e 74 2e 67 65 74 45 6c 65 6d 65 6e 74 73 42 79 54 61 67 4e 61 6d 65 29 20 7b 0a 20 20 20 20 72 | nt.getElementsByTagName).{.....r |
3bce0 | 65 74 75 72 6e 0a 20 20 7d 0a 20 20 63 6f 6e 73 74 20 77 65 62 76 69 65 77 73 20 3d 20 64 6f 63 | eturn...}...const.webviews.=.doc |
3bd00 | 75 6d 65 6e 74 2e 67 65 74 45 6c 65 6d 65 6e 74 73 42 79 54 61 67 4e 61 6d 65 28 27 77 65 62 76 | ument.getElementsByTagName('webv |
3bd20 | 69 65 77 27 29 0a 20 20 69 66 20 28 77 65 62 76 69 65 77 73 20 26 26 20 77 65 62 76 69 65 77 73 | iew')...if.(webviews.&&.webviews |
3bd40 | 2e 6c 65 6e 67 74 68 20 3e 20 30 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 75 72 6c 20 3d 20 27 | .length.>.0).{.....const.url.=.' |
3bd60 | 68 74 74 70 73 3a 2f 2f 67 69 74 68 75 62 2e 63 6f 6d 2f 65 6c 65 63 74 72 6f 6e 2f 65 6c 65 63 | https://github.com/electron/elec |
3bd80 | 74 72 6f 6e 2f 62 6c 6f 62 2f 6d 61 73 74 65 72 2f 64 6f 63 73 2f 61 70 69 2f 62 72 65 61 6b 69 | tron/blob/master/docs/api/breaki |
3bda0 | 6e 67 2d 63 68 61 6e 67 65 73 2e 6d 64 23 6e 65 77 2d 62 72 6f 77 73 65 72 77 69 6e 64 6f 77 2d | ng-changes.md#new-browserwindow- |
3bdc0 | 77 65 62 70 72 65 66 65 72 65 6e 63 65 73 2d 27 0a 20 20 20 20 63 6f 6e 73 74 20 77 61 72 6e 69 | webpreferences-'.....const.warni |
3bde0 | 6e 67 20 3d 20 60 54 68 69 73 20 77 69 6e 64 6f 77 20 68 61 73 20 74 68 65 20 3c 77 65 62 76 69 | ng.=.`This.window.has.the.<webvi |
3be00 | 65 77 3e 20 74 61 67 20 65 6e 61 62 6c 65 64 20 62 79 20 64 65 66 61 75 6c 74 2e 20 49 6e 20 60 | ew>.tag.enabled.by.default..In.` |
3be20 | 20 2b 0a 20 20 20 20 20 20 60 45 6c 65 63 74 72 6f 6e 20 35 2e 30 2e 30 2c 20 3c 77 65 62 76 69 | .+.......`Electron.5.0.0,.<webvi |
3be40 | 65 77 3e 20 74 61 67 73 20 77 69 6c 6c 20 62 65 20 64 69 73 61 62 6c 65 64 20 62 79 20 64 65 66 | ew>.tags.will.be.disabled.by.def |
3be60 | 61 75 6c 74 2e 20 54 6f 20 70 72 65 70 61 72 65 20 60 20 2b 0a 20 20 20 20 20 20 60 66 6f 72 20 | ault..To.prepare.`.+.......`for. |
3be80 | 74 68 69 73 20 63 68 61 6e 67 65 2c 20 73 65 74 20 7b 77 65 62 76 69 65 77 54 61 67 3a 20 74 72 | this.change,.set.{webviewTag:.tr |
3bea0 | 75 65 7d 20 69 6e 20 74 68 65 20 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 66 6f 72 20 60 20 | ue}.in.the.webPreferences.for.`. |
3bec0 | 2b 0a 20 20 20 20 20 20 60 74 68 69 73 20 77 69 6e 64 6f 77 2e 5c 6e 5c 6e 60 20 2b 0a 20 20 20 | +.......`this.window.\n\n`.+.... |
3bee0 | 20 20 20 60 46 6f 72 20 6d 6f 72 65 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 2c 20 73 65 65 20 24 7b | ...`For.more.information,.see.${ |
3bf00 | 75 72 6c 7d 60 0a 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 72 6e 28 27 25 63 45 6c 65 63 74 | url}`......console.warn('%cElect |
3bf20 | 72 6f 6e 20 44 65 70 72 65 63 61 74 69 6f 6e 20 57 61 72 6e 69 6e 67 20 28 77 65 62 76 69 65 77 | ron.Deprecation.Warning.(webview |
3bf40 | 54 61 67 20 64 65 66 61 75 6c 74 20 63 68 61 6e 67 65 29 27 2c 0a 20 20 20 20 20 20 27 66 6f 6e | Tag.default.change)',.......'fon |
3bf60 | 74 2d 77 65 69 67 68 74 3a 20 62 6f 6c 64 3b 27 2c 20 77 61 72 6e 69 6e 67 29 0a 20 20 7d 0a 7d | t-weight:.bold;',.warning)...}.} |
3bf80 | 0a 0a 2f 2f 20 43 75 72 72 65 6e 74 6c 79 20 6d 69 73 73 69 6e 67 20 73 69 6e 63 65 20 77 65 20 | ..//.Currently.missing.since.we. |
3bfa0 | 63 61 6e 27 74 20 65 61 73 69 6c 79 20 70 72 6f 67 72 61 6d 6d 61 74 69 63 61 6c 6c 79 20 63 68 | can't.easily.programmatically.ch |
3bfc0 | 65 63 6b 20 66 6f 72 20 69 74 3a 0a 2f 2f 20 20 20 23 31 32 57 65 62 56 69 65 77 73 3a 20 56 65 | eck.for.it:.//...#12WebViews:.Ve |
3bfe0 | 72 69 66 79 20 74 68 65 20 6f 70 74 69 6f 6e 73 20 61 6e 64 20 70 61 72 61 6d 73 20 6f 66 20 61 | rify.the.options.and.params.of.a |
3c000 | 6c 6c 20 60 3c 77 65 62 76 69 65 77 3e 60 20 74 61 67 73 0a 0a 63 6f 6e 73 74 20 6c 6f 67 53 65 | ll.`<webview>`.tags..const.logSe |
3c020 | 63 75 72 69 74 79 57 61 72 6e 69 6e 67 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 77 65 62 50 72 | curityWarnings.=.function.(webPr |
3c040 | 65 66 65 72 65 6e 63 65 73 2c 20 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 29 20 7b 0a 20 20 | eferences,.nodeIntegration).{... |
3c060 | 77 61 72 6e 41 62 6f 75 74 4e 6f 64 65 57 69 74 68 52 65 6d 6f 74 65 43 6f 6e 74 65 6e 74 28 6e | warnAboutNodeWithRemoteContent(n |
3c080 | 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 29 0a 20 20 77 61 72 6e 41 62 6f 75 74 44 69 73 61 62 | odeIntegration)...warnAboutDisab |
3c0a0 | 6c 65 64 57 65 62 53 65 63 75 72 69 74 79 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 0a 20 | ledWebSecurity(webPreferences).. |
3c0c0 | 20 77 61 72 6e 41 62 6f 75 74 49 6e 73 65 63 75 72 65 52 65 73 6f 75 72 63 65 73 28 29 0a 20 20 | .warnAboutInsecureResources()... |
3c0e0 | 77 61 72 6e 41 62 6f 75 74 49 6e 73 65 63 75 72 65 43 6f 6e 74 65 6e 74 41 6c 6c 6f 77 65 64 28 | warnAboutInsecureContentAllowed( |
3c100 | 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 0a 20 20 77 61 72 6e 41 62 6f 75 74 45 78 70 65 72 | webPreferences)...warnAboutExper |
3c120 | 69 6d 65 6e 74 61 6c 46 65 61 74 75 72 65 73 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 0a | imentalFeatures(webPreferences). |
3c140 | 20 20 77 61 72 6e 41 62 6f 75 74 45 6e 61 62 6c 65 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 28 77 | ..warnAboutEnableBlinkFeatures(w |
3c160 | 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 0a 20 20 77 61 72 6e 41 62 6f 75 74 49 6e 73 65 63 75 | ebPreferences)...warnAboutInsecu |
3c180 | 72 65 43 53 50 28 29 0a 20 20 77 61 72 6e 41 62 6f 75 74 41 6c 6c 6f 77 65 64 50 6f 70 75 70 73 | reCSP()...warnAboutAllowedPopups |
3c1a0 | 28 29 0a 20 20 77 61 72 6e 41 62 6f 75 74 4e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 44 65 66 | ()...warnAboutNodeIntegrationDef |
3c1c0 | 61 75 6c 74 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 0a 20 20 77 61 72 6e 41 62 6f 75 74 | ault(webPreferences)...warnAbout |
3c1e0 | 43 6f 6e 74 65 78 74 49 73 6f 6c 61 74 69 6f 6e 44 65 66 61 75 6c 74 28 77 65 62 50 72 65 66 65 | ContextIsolationDefault(webPrefe |
3c200 | 72 65 6e 63 65 73 29 0a 20 20 77 61 72 6e 41 62 6f 75 74 44 65 70 72 65 63 61 74 65 64 57 65 62 | rences)...warnAboutDeprecatedWeb |
3c220 | 76 69 65 77 54 61 67 44 65 66 61 75 6c 74 28 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 29 0a 7d | viewTagDefault(webPreferences).} |
3c240 | 0a 0a 63 6f 6e 73 74 20 67 65 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d 20 66 75 6e 63 | ..const.getWebPreferences.=.func |
3c260 | 74 69 6f 6e 20 28 29 20 7b 0a 20 20 63 6f 6e 73 74 20 69 70 63 52 65 6e 64 65 72 65 72 20 3d 20 | tion.().{...const.ipcRenderer.=. |
3c280 | 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 | require('@electron/internal/rend |
3c2a0 | 65 72 65 72 2f 69 70 63 2d 72 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 20 20 63 | erer/ipc-renderer-internal')...c |
3c2c0 | 6f 6e 73 74 20 65 72 72 6f 72 55 74 69 6c 73 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 | onst.errorUtils.=.require('@elec |
3c2e0 | 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 65 72 72 6f 72 2d 75 74 69 6c 73 | tron/internal/common/error-utils |
3c300 | 27 29 0a 0a 20 20 63 6f 6e 73 74 20 5b 20 65 72 72 6f 72 2c 20 72 65 73 75 6c 74 20 5d 20 3d 20 | ')....const.[.error,.result.].=. |
3c320 | 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 27 45 4c 45 43 54 52 4f 4e 5f 42 | ipcRenderer.sendSync('ELECTRON_B |
3c340 | 52 4f 57 53 45 52 5f 47 45 54 5f 4c 41 53 54 5f 57 45 42 5f 50 52 45 46 45 52 45 4e 43 45 53 27 | ROWSER_GET_LAST_WEB_PREFERENCES' |
3c360 | 29 0a 0a 20 20 69 66 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 77 61 | )....if.(error).{.....console.wa |
3c380 | 72 6e 28 60 67 65 74 4c 61 73 74 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 28 29 20 66 61 69 6c | rn(`getLastWebPreferences().fail |
3c3a0 | 65 64 3a 20 24 7b 65 72 72 6f 72 55 74 69 6c 73 2e 64 65 73 65 72 69 61 6c 69 7a 65 28 65 72 72 | ed:.${errorUtils.deserialize(err |
3c3c0 | 6f 72 29 7d 60 29 0a 20 20 20 20 72 65 74 75 72 6e 20 6e 75 6c 6c 0a 20 20 7d 20 65 6c 73 65 20 | or)}`).....return.null...}.else. |
3c3e0 | 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 72 65 73 75 6c 74 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c | {.....return.result...}.}..modul |
3c400 | 65 2e 65 78 70 6f 72 74 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6e 6f 64 65 49 6e 74 65 67 72 | e.exports.=.function.(nodeIntegr |
3c420 | 61 74 69 6f 6e 29 20 7b 0a 20 20 63 6f 6e 73 74 20 6c 6f 61 64 48 61 6e 64 6c 65 72 20 3d 20 66 | ation).{...const.loadHandler.=.f |
3c440 | 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 73 68 6f 75 6c 64 4c 6f 67 53 65 | unction.().{.....if.(shouldLogSe |
3c460 | 63 75 72 69 74 79 57 61 72 6e 69 6e 67 73 28 29 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 | curityWarnings()).{.......const. |
3c480 | 77 65 62 50 72 65 66 65 72 65 6e 63 65 73 20 3d 20 67 65 74 57 65 62 50 72 65 66 65 72 65 6e 63 | webPreferences.=.getWebPreferenc |
3c4a0 | 65 73 28 29 0a 20 20 20 20 20 20 6c 6f 67 53 65 63 75 72 69 74 79 57 61 72 6e 69 6e 67 73 28 77 | es().......logSecurityWarnings(w |
3c4c0 | 65 62 50 72 65 66 65 72 65 6e 63 65 73 2c 20 6e 6f 64 65 49 6e 74 65 67 72 61 74 69 6f 6e 29 0a | ebPreferences,.nodeIntegration). |
3c4e0 | 20 20 20 20 7d 0a 20 20 7d 0a 20 20 77 69 6e 64 6f 77 2e 61 64 64 45 76 65 6e 74 4c 69 73 74 65 | ....}...}...window.addEventListe |
3c500 | 6e 65 72 28 27 6c 6f 61 64 27 2c 20 6c 6f 61 64 48 61 6e 64 6c 65 72 2c 20 7b 20 6f 6e 63 65 3a | ner('load',.loadHandler,.{.once: |
3c520 | 20 74 72 75 65 20 7d 29 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b | .true.}).}.'use.strict'..const.{ |
3c540 | 20 77 65 62 46 72 61 6d 65 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 | .webFrame.}.=.require('electron' |
3c560 | 29 0a 63 6f 6e 73 74 20 69 70 63 52 65 6e 64 65 72 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 40 | ).const.ipcRenderer.=.require('@ |
3c580 | 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 69 70 63 2d 72 | electron/internal/renderer/ipc-r |
3c5a0 | 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 63 6f 6e 73 74 20 65 72 72 6f 72 55 74 | enderer-internal').const.errorUt |
3c5c0 | 69 6c 73 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 | ils.=.require('@electron/interna |
3c5e0 | 6c 2f 63 6f 6d 6d 6f 6e 2f 65 72 72 6f 72 2d 75 74 69 6c 73 27 29 0a 0a 6d 6f 64 75 6c 65 2e 65 | l/common/error-utils')..module.e |
3c600 | 78 70 6f 72 74 73 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 2f 2f 20 43 61 6c 6c 20 77 65 62 46 72 | xports.=.().=>.{...//.Call.webFr |
3c620 | 61 6d 65 20 6d 65 74 68 6f 64 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 45 4c 45 | ame.method...ipcRenderer.on('ELE |
3c640 | 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 52 45 4e 44 45 52 45 52 5f 57 45 42 5f 46 52 41 4d | CTRON_INTERNAL_RENDERER_WEB_FRAM |
3c660 | 45 5f 4d 45 54 48 4f 44 27 2c 20 28 65 76 65 6e 74 2c 20 6d 65 74 68 6f 64 2c 20 61 72 67 73 29 | E_METHOD',.(event,.method,.args) |
3c680 | 20 3d 3e 20 7b 0a 20 20 20 20 77 65 62 46 72 61 6d 65 5b 6d 65 74 68 6f 64 5d 28 2e 2e 2e 61 72 | .=>.{.....webFrame[method](...ar |
3c6a0 | 67 73 29 0a 20 20 7d 29 0a 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 45 4c 45 43 | gs)...})....ipcRenderer.on('ELEC |
3c6c0 | 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 52 45 4e 44 45 52 45 52 5f 41 53 59 4e 43 5f 57 45 42 | TRON_INTERNAL_RENDERER_ASYNC_WEB |
3c6e0 | 5f 46 52 41 4d 45 5f 4d 45 54 48 4f 44 27 2c 20 28 65 76 65 6e 74 2c 20 72 65 71 75 65 73 74 49 | _FRAME_METHOD',.(event,.requestI |
3c700 | 64 2c 20 6d 65 74 68 6f 64 2c 20 61 72 67 73 29 20 3d 3e 20 7b 0a 20 20 20 20 6e 65 77 20 50 72 | d,.method,.args).=>.{.....new.Pr |
3c720 | 6f 6d 69 73 65 28 72 65 73 6f 6c 76 65 20 3d 3e 0a 20 20 20 20 20 20 77 65 62 46 72 61 6d 65 5b | omise(resolve.=>.......webFrame[ |
3c740 | 6d 65 74 68 6f 64 5d 28 2e 2e 2e 61 72 67 73 2c 20 72 65 73 6f 6c 76 65 29 0a 20 20 20 20 29 2e | method](...args,.resolve).....). |
3c760 | 74 68 65 6e 28 72 65 73 75 6c 74 20 3d 3e 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 5b 6e | then(result.=>.{.......return.[n |
3c780 | 75 6c 6c 2c 20 72 65 73 75 6c 74 5d 0a 20 20 20 20 7d 2c 20 65 72 72 6f 72 20 3d 3e 20 7b 0a 20 | ull,.result].....},.error.=>.{.. |
3c7a0 | 20 20 20 20 20 72 65 74 75 72 6e 20 5b 65 72 72 6f 72 55 74 69 6c 73 2e 73 65 72 69 61 6c 69 7a | .....return.[errorUtils.serializ |
3c7c0 | 65 28 65 72 72 6f 72 29 5d 0a 20 20 20 20 7d 29 2e 74 68 65 6e 28 72 65 73 70 6f 6e 73 65 41 72 | e(error)].....}).then(responseAr |
3c7e0 | 67 73 20 3d 3e 20 7b 0a 20 20 20 20 20 20 65 76 65 6e 74 2e 73 65 6e 64 65 72 2e 73 65 6e 64 28 | gs.=>.{.......event.sender.send( |
3c800 | 60 45 4c 45 43 54 52 4f 4e 5f 49 4e 54 45 52 4e 41 4c 5f 42 52 4f 57 53 45 52 5f 41 53 59 4e 43 | `ELECTRON_INTERNAL_BROWSER_ASYNC |
3c820 | 5f 57 45 42 5f 46 52 41 4d 45 5f 52 45 53 50 4f 4e 53 45 5f 24 7b 72 65 71 75 65 73 74 49 64 7d | _WEB_FRAME_RESPONSE_${requestId} |
3c840 | 60 2c 20 2e 2e 2e 72 65 73 70 6f 6e 73 65 41 72 67 73 29 0a 20 20 20 20 7d 29 0a 20 20 7d 29 0a | `,....responseArgs).....})...}). |
3c860 | 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 77 65 62 46 72 61 6d 65 | }.'use.strict'..const.{.webFrame |
3c880 | 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 63 6f 6e 73 74 20 69 | .}.=.require('electron').const.i |
3c8a0 | 70 63 52 65 6e 64 65 72 65 72 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f | pcRenderer.=.require('@electron/ |
3c8c0 | 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 69 70 63 2d 72 65 6e 64 65 72 65 72 2d 69 | internal/renderer/ipc-renderer-i |
3c8e0 | 6e 74 65 72 6e 61 6c 27 29 0a 0a 6c 65 74 20 72 65 71 75 65 73 74 49 64 20 3d 20 30 0a 0a 63 6f | nternal')..let.requestId.=.0..co |
3c900 | 6e 73 74 20 57 45 42 5f 56 49 45 57 5f 45 56 45 4e 54 53 20 3d 20 7b 0a 20 20 27 6c 6f 61 64 2d | nst.WEB_VIEW_EVENTS.=.{...'load- |
3c920 | 63 6f 6d 6d 69 74 27 3a 20 5b 27 75 72 6c 27 2c 20 27 69 73 4d 61 69 6e 46 72 61 6d 65 27 5d 2c | commit':.['url',.'isMainFrame'], |
3c940 | 0a 20 20 27 64 69 64 2d 61 74 74 61 63 68 27 3a 20 5b 5d 2c 0a 20 20 27 64 69 64 2d 66 69 6e 69 | ...'did-attach':.[],...'did-fini |
3c960 | 73 68 2d 6c 6f 61 64 27 3a 20 5b 5d 2c 0a 20 20 27 64 69 64 2d 66 61 69 6c 2d 6c 6f 61 64 27 3a | sh-load':.[],...'did-fail-load': |
3c980 | 20 5b 27 65 72 72 6f 72 43 6f 64 65 27 2c 20 27 65 72 72 6f 72 44 65 73 63 72 69 70 74 69 6f 6e | .['errorCode',.'errorDescription |
3c9a0 | 27 2c 20 27 76 61 6c 69 64 61 74 65 64 55 52 4c 27 2c 20 27 69 73 4d 61 69 6e 46 72 61 6d 65 27 | ',.'validatedURL',.'isMainFrame' |
3c9c0 | 2c 20 27 66 72 61 6d 65 50 72 6f 63 65 73 73 49 64 27 2c 20 27 66 72 61 6d 65 52 6f 75 74 69 6e | ,.'frameProcessId',.'frameRoutin |
3c9e0 | 67 49 64 27 5d 2c 0a 20 20 27 64 69 64 2d 66 72 61 6d 65 2d 66 69 6e 69 73 68 2d 6c 6f 61 64 27 | gId'],...'did-frame-finish-load' |
3ca00 | 3a 20 5b 27 69 73 4d 61 69 6e 46 72 61 6d 65 27 2c 20 27 66 72 61 6d 65 50 72 6f 63 65 73 73 49 | :.['isMainFrame',.'frameProcessI |
3ca20 | 64 27 2c 20 27 66 72 61 6d 65 52 6f 75 74 69 6e 67 49 64 27 5d 2c 0a 20 20 27 64 69 64 2d 73 74 | d',.'frameRoutingId'],...'did-st |
3ca40 | 61 72 74 2d 6c 6f 61 64 69 6e 67 27 3a 20 5b 5d 2c 0a 20 20 27 64 69 64 2d 73 74 6f 70 2d 6c 6f | art-loading':.[],...'did-stop-lo |
3ca60 | 61 64 69 6e 67 27 3a 20 5b 5d 2c 0a 20 20 27 64 6f 6d 2d 72 65 61 64 79 27 3a 20 5b 5d 2c 0a 20 | ading':.[],...'dom-ready':.[],.. |
3ca80 | 20 27 63 6f 6e 73 6f 6c 65 2d 6d 65 73 73 61 67 65 27 3a 20 5b 27 6c 65 76 65 6c 27 2c 20 27 6d | .'console-message':.['level',.'m |
3caa0 | 65 73 73 61 67 65 27 2c 20 27 6c 69 6e 65 27 2c 20 27 73 6f 75 72 63 65 49 64 27 5d 2c 0a 20 20 | essage',.'line',.'sourceId'],... |
3cac0 | 27 63 6f 6e 74 65 78 74 2d 6d 65 6e 75 27 3a 20 5b 27 70 61 72 61 6d 73 27 5d 2c 0a 20 20 27 64 | 'context-menu':.['params'],...'d |
3cae0 | 65 76 74 6f 6f 6c 73 2d 6f 70 65 6e 65 64 27 3a 20 5b 5d 2c 0a 20 20 27 64 65 76 74 6f 6f 6c 73 | evtools-opened':.[],...'devtools |
3cb00 | 2d 63 6c 6f 73 65 64 27 3a 20 5b 5d 2c 0a 20 20 27 64 65 76 74 6f 6f 6c 73 2d 66 6f 63 75 73 65 | -closed':.[],...'devtools-focuse |
3cb20 | 64 27 3a 20 5b 5d 2c 0a 20 20 27 6e 65 77 2d 77 69 6e 64 6f 77 27 3a 20 5b 27 75 72 6c 27 2c 20 | d':.[],...'new-window':.['url',. |
3cb40 | 27 66 72 61 6d 65 4e 61 6d 65 27 2c 20 27 64 69 73 70 6f 73 69 74 69 6f 6e 27 2c 20 27 6f 70 74 | 'frameName',.'disposition',.'opt |
3cb60 | 69 6f 6e 73 27 5d 2c 0a 20 20 27 77 69 6c 6c 2d 6e 61 76 69 67 61 74 65 27 3a 20 5b 27 75 72 6c | ions'],...'will-navigate':.['url |
3cb80 | 27 5d 2c 0a 20 20 27 64 69 64 2d 73 74 61 72 74 2d 6e 61 76 69 67 61 74 69 6f 6e 27 3a 20 5b 27 | '],...'did-start-navigation':.[' |
3cba0 | 75 72 6c 27 2c 20 27 69 73 49 6e 50 6c 61 63 65 27 2c 20 27 69 73 4d 61 69 6e 46 72 61 6d 65 27 | url',.'isInPlace',.'isMainFrame' |
3cbc0 | 2c 20 27 66 72 61 6d 65 50 72 6f 63 65 73 73 49 64 27 2c 20 27 66 72 61 6d 65 52 6f 75 74 69 6e | ,.'frameProcessId',.'frameRoutin |
3cbe0 | 67 49 64 27 5d 2c 0a 20 20 27 64 69 64 2d 6e 61 76 69 67 61 74 65 27 3a 20 5b 27 75 72 6c 27 2c | gId'],...'did-navigate':.['url', |
3cc00 | 20 27 68 74 74 70 52 65 73 70 6f 6e 73 65 43 6f 64 65 27 2c 20 27 68 74 74 70 53 74 61 74 75 73 | .'httpResponseCode',.'httpStatus |
3cc20 | 54 65 78 74 27 5d 2c 0a 20 20 27 64 69 64 2d 66 72 61 6d 65 2d 6e 61 76 69 67 61 74 65 27 3a 20 | Text'],...'did-frame-navigate':. |
3cc40 | 5b 27 75 72 6c 27 2c 20 27 68 74 74 70 52 65 73 70 6f 6e 73 65 43 6f 64 65 27 2c 20 27 68 74 74 | ['url',.'httpResponseCode',.'htt |
3cc60 | 70 53 74 61 74 75 73 54 65 78 74 27 2c 20 27 69 73 4d 61 69 6e 46 72 61 6d 65 27 2c 20 27 66 72 | pStatusText',.'isMainFrame',.'fr |
3cc80 | 61 6d 65 50 72 6f 63 65 73 73 49 64 27 2c 20 27 66 72 61 6d 65 52 6f 75 74 69 6e 67 49 64 27 5d | ameProcessId',.'frameRoutingId'] |
3cca0 | 2c 0a 20 20 27 64 69 64 2d 6e 61 76 69 67 61 74 65 2d 69 6e 2d 70 61 67 65 27 3a 20 5b 27 75 72 | ,...'did-navigate-in-page':.['ur |
3ccc0 | 6c 27 2c 20 27 69 73 4d 61 69 6e 46 72 61 6d 65 27 2c 20 27 66 72 61 6d 65 50 72 6f 63 65 73 73 | l',.'isMainFrame',.'frameProcess |
3cce0 | 49 64 27 2c 20 27 66 72 61 6d 65 52 6f 75 74 69 6e 67 49 64 27 5d 2c 0a 20 20 27 66 6f 63 75 73 | Id',.'frameRoutingId'],...'focus |
3cd00 | 2d 63 68 61 6e 67 65 27 3a 20 5b 27 66 6f 63 75 73 27 2c 20 27 67 75 65 73 74 49 6e 73 74 61 6e | -change':.['focus',.'guestInstan |
3cd20 | 63 65 49 64 27 5d 2c 0a 20 20 27 63 6c 6f 73 65 27 3a 20 5b 5d 2c 0a 20 20 27 63 72 61 73 68 65 | ceId'],...'close':.[],...'crashe |
3cd40 | 64 27 3a 20 5b 5d 2c 0a 20 20 27 70 6c 75 67 69 6e 2d 63 72 61 73 68 65 64 27 3a 20 5b 27 6e 61 | d':.[],...'plugin-crashed':.['na |
3cd60 | 6d 65 27 2c 20 27 76 65 72 73 69 6f 6e 27 5d 2c 0a 20 20 27 64 65 73 74 72 6f 79 65 64 27 3a 20 | me',.'version'],...'destroyed':. |
3cd80 | 5b 5d 2c 0a 20 20 27 70 61 67 65 2d 74 69 74 6c 65 2d 75 70 64 61 74 65 64 27 3a 20 5b 27 74 69 | [],...'page-title-updated':.['ti |
3cda0 | 74 6c 65 27 2c 20 27 65 78 70 6c 69 63 69 74 53 65 74 27 5d 2c 0a 20 20 27 70 61 67 65 2d 66 61 | tle',.'explicitSet'],...'page-fa |
3cdc0 | 76 69 63 6f 6e 2d 75 70 64 61 74 65 64 27 3a 20 5b 27 66 61 76 69 63 6f 6e 73 27 5d 2c 0a 20 20 | vicon-updated':.['favicons'],... |
3cde0 | 27 65 6e 74 65 72 2d 68 74 6d 6c 2d 66 75 6c 6c 2d 73 63 72 65 65 6e 27 3a 20 5b 5d 2c 0a 20 20 | 'enter-html-full-screen':.[],... |
3ce00 | 27 6c 65 61 76 65 2d 68 74 6d 6c 2d 66 75 6c 6c 2d 73 63 72 65 65 6e 27 3a 20 5b 5d 2c 0a 20 20 | 'leave-html-full-screen':.[],... |
3ce20 | 27 6d 65 64 69 61 2d 73 74 61 72 74 65 64 2d 70 6c 61 79 69 6e 67 27 3a 20 5b 5d 2c 0a 20 20 27 | 'media-started-playing':.[],...' |
3ce40 | 6d 65 64 69 61 2d 70 61 75 73 65 64 27 3a 20 5b 5d 2c 0a 20 20 27 66 6f 75 6e 64 2d 69 6e 2d 70 | media-paused':.[],...'found-in-p |
3ce60 | 61 67 65 27 3a 20 5b 27 72 65 73 75 6c 74 27 5d 2c 0a 20 20 27 64 69 64 2d 63 68 61 6e 67 65 2d | age':.['result'],...'did-change- |
3ce80 | 74 68 65 6d 65 2d 63 6f 6c 6f 72 27 3a 20 5b 27 74 68 65 6d 65 43 6f 6c 6f 72 27 5d 2c 0a 20 20 | theme-color':.['themeColor'],... |
3cea0 | 27 75 70 64 61 74 65 2d 74 61 72 67 65 74 2d 75 72 6c 27 3a 20 5b 27 75 72 6c 27 5d 0a 7d 0a 0a | 'update-target-url':.['url'].}.. |
3cec0 | 63 6f 6e 73 74 20 44 45 50 52 45 43 41 54 45 44 5f 45 56 45 4e 54 53 20 3d 20 7b 0a 20 20 27 70 | const.DEPRECATED_EVENTS.=.{...'p |
3cee0 | 61 67 65 2d 74 69 74 6c 65 2d 75 70 64 61 74 65 64 27 3a 20 27 70 61 67 65 2d 74 69 74 6c 65 2d | age-title-updated':.'page-title- |
3cf00 | 73 65 74 27 0a 7d 0a 0a 63 6f 6e 73 74 20 64 69 73 70 61 74 63 68 45 76 65 6e 74 20 3d 20 66 75 | set'.}..const.dispatchEvent.=.fu |
3cf20 | 6e 63 74 69 6f 6e 20 28 77 65 62 56 69 65 77 2c 20 65 76 65 6e 74 4e 61 6d 65 2c 20 65 76 65 6e | nction.(webView,.eventName,.even |
3cf40 | 74 4b 65 79 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 69 66 20 28 44 45 50 52 45 43 41 54 45 | tKey,....args).{...if.(DEPRECATE |
3cf60 | 44 5f 45 56 45 4e 54 53 5b 65 76 65 6e 74 4e 61 6d 65 5d 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 | D_EVENTS[eventName].!=.null).{.. |
3cf80 | 20 20 20 64 69 73 70 61 74 63 68 45 76 65 6e 74 28 77 65 62 56 69 65 77 2c 20 44 45 50 52 45 43 | ...dispatchEvent(webView,.DEPREC |
3cfa0 | 41 54 45 44 5f 45 56 45 4e 54 53 5b 65 76 65 6e 74 4e 61 6d 65 5d 2c 20 65 76 65 6e 74 4b 65 79 | ATED_EVENTS[eventName],.eventKey |
3cfc0 | 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 7d 0a 20 20 63 6f 6e 73 74 20 64 6f 6d 45 76 65 6e 74 20 | ,....args)...}...const.domEvent. |
3cfe0 | 3d 20 6e 65 77 20 45 76 65 6e 74 28 65 76 65 6e 74 4e 61 6d 65 29 0a 20 20 57 45 42 5f 56 49 45 | =.new.Event(eventName)...WEB_VIE |
3d000 | 57 5f 45 56 45 4e 54 53 5b 65 76 65 6e 74 4b 65 79 5d 2e 66 6f 72 45 61 63 68 28 28 70 72 6f 70 | W_EVENTS[eventKey].forEach((prop |
3d020 | 2c 20 69 6e 64 65 78 29 20 3d 3e 20 7b 0a 20 20 20 20 64 6f 6d 45 76 65 6e 74 5b 70 72 6f 70 5d | ,.index).=>.{.....domEvent[prop] |
3d040 | 20 3d 20 61 72 67 73 5b 69 6e 64 65 78 5d 0a 20 20 7d 29 0a 20 20 77 65 62 56 69 65 77 2e 64 69 | .=.args[index]...})...webView.di |
3d060 | 73 70 61 74 63 68 45 76 65 6e 74 28 64 6f 6d 45 76 65 6e 74 29 0a 20 20 69 66 20 28 65 76 65 6e | spatchEvent(domEvent)...if.(even |
3d080 | 74 4e 61 6d 65 20 3d 3d 3d 20 27 6c 6f 61 64 2d 63 6f 6d 6d 69 74 27 29 20 7b 0a 20 20 20 20 77 | tName.===.'load-commit').{.....w |
3d0a0 | 65 62 56 69 65 77 2e 6f 6e 4c 6f 61 64 43 6f 6d 6d 69 74 28 64 6f 6d 45 76 65 6e 74 29 0a 20 20 | ebView.onLoadCommit(domEvent)... |
3d0c0 | 7d 20 65 6c 73 65 20 69 66 20 28 65 76 65 6e 74 4e 61 6d 65 20 3d 3d 3d 20 27 66 6f 63 75 73 2d | }.else.if.(eventName.===.'focus- |
3d0e0 | 63 68 61 6e 67 65 27 29 20 7b 0a 20 20 20 20 77 65 62 56 69 65 77 2e 6f 6e 46 6f 63 75 73 43 68 | change').{.....webView.onFocusCh |
3d100 | 61 6e 67 65 28 64 6f 6d 45 76 65 6e 74 29 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 | ange(domEvent)...}.}..module.exp |
3d120 | 6f 72 74 73 20 3d 20 7b 0a 20 20 72 65 67 69 73 74 65 72 45 76 65 6e 74 73 3a 20 66 75 6e 63 74 | orts.=.{...registerEvents:.funct |
3d140 | 69 6f 6e 20 28 77 65 62 56 69 65 77 2c 20 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a | ion.(webView,.viewInstanceId).{. |
3d160 | 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 | ....ipcRenderer.on(`ELECTRON_GUE |
3d180 | 53 54 5f 56 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 44 45 53 54 52 4f 59 5f 47 55 45 53 54 2d 24 | ST_VIEW_INTERNAL_DESTROY_GUEST-$ |
3d1a0 | 7b 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 7d 60 2c 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b | {viewInstanceId}`,.function.().{ |
3d1c0 | 0a 20 20 20 20 20 20 77 65 62 56 69 65 77 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d | .......webView.guestInstanceId.= |
3d1e0 | 20 75 6e 64 65 66 69 6e 65 64 0a 20 20 20 20 20 20 77 65 62 56 69 65 77 2e 72 65 73 65 74 28 29 | .undefined.......webView.reset() |
3d200 | 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 64 6f 6d 45 76 65 6e 74 20 3d 20 6e 65 77 20 45 76 65 6e | .......const.domEvent.=.new.Even |
3d220 | 74 28 27 64 65 73 74 72 6f 79 65 64 27 29 0a 20 20 20 20 20 20 77 65 62 56 69 65 77 2e 64 69 73 | t('destroyed').......webView.dis |
3d240 | 70 61 74 63 68 45 76 65 6e 74 28 64 6f 6d 45 76 65 6e 74 29 0a 20 20 20 20 7d 29 0a 0a 20 20 20 | patchEvent(domEvent).....})..... |
3d260 | 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f | .ipcRenderer.on(`ELECTRON_GUEST_ |
3d280 | 56 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 44 49 53 50 41 54 43 48 5f 45 56 45 4e 54 2d 24 7b 76 | VIEW_INTERNAL_DISPATCH_EVENT-${v |
3d2a0 | 69 65 77 49 6e 73 74 61 6e 63 65 49 64 7d 60 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 | iewInstanceId}`,.function.(event |
3d2c0 | 2c 20 65 76 65 6e 74 4e 61 6d 65 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 64 69 | ,.eventName,....args).{.......di |
3d2e0 | 73 70 61 74 63 68 45 76 65 6e 74 28 77 65 62 56 69 65 77 2c 20 65 76 65 6e 74 4e 61 6d 65 2c 20 | spatchEvent(webView,.eventName,. |
3d300 | 65 76 65 6e 74 4e 61 6d 65 2c 20 2e 2e 2e 61 72 67 73 29 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 | eventName,....args).....})...... |
3d320 | 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 | ipcRenderer.on(`ELECTRON_GUEST_V |
3d340 | 49 45 57 5f 49 4e 54 45 52 4e 41 4c 5f 49 50 43 5f 4d 45 53 53 41 47 45 2d 24 7b 76 69 65 77 49 | IEW_INTERNAL_IPC_MESSAGE-${viewI |
3d360 | 6e 73 74 61 6e 63 65 49 64 7d 60 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 63 68 | nstanceId}`,.function.(event,.ch |
3d380 | 61 6e 6e 65 6c 2c 20 2e 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 64 6f | annel,....args).{.......const.do |
3d3a0 | 6d 45 76 65 6e 74 20 3d 20 6e 65 77 20 45 76 65 6e 74 28 27 69 70 63 2d 6d 65 73 73 61 67 65 27 | mEvent.=.new.Event('ipc-message' |
3d3c0 | 29 0a 20 20 20 20 20 20 64 6f 6d 45 76 65 6e 74 2e 63 68 61 6e 6e 65 6c 20 3d 20 63 68 61 6e 6e | ).......domEvent.channel.=.chann |
3d3e0 | 65 6c 0a 20 20 20 20 20 20 64 6f 6d 45 76 65 6e 74 2e 61 72 67 73 20 3d 20 61 72 67 73 0a 20 20 | el.......domEvent.args.=.args... |
3d400 | 20 20 20 20 77 65 62 56 69 65 77 2e 64 69 73 70 61 74 63 68 45 76 65 6e 74 28 64 6f 6d 45 76 65 | ....webView.dispatchEvent(domEve |
3d420 | 6e 74 29 0a 20 20 20 20 7d 29 0a 20 20 7d 2c 0a 20 20 64 65 72 65 67 69 73 74 65 72 45 76 65 6e | nt).....})...},...deregisterEven |
3d440 | 74 73 3a 20 66 75 6e 63 74 69 6f 6e 20 28 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a | ts:.function.(viewInstanceId).{. |
3d460 | 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 72 65 6d 6f 76 65 41 6c 6c 4c 69 73 74 65 6e 65 | ....ipcRenderer.removeAllListene |
3d480 | 72 73 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 49 4e 54 45 52 4e 41 4c | rs(`ELECTRON_GUEST_VIEW_INTERNAL |
3d4a0 | 5f 44 45 53 54 52 4f 59 5f 47 55 45 53 54 2d 24 7b 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 7d | _DESTROY_GUEST-${viewInstanceId} |
3d4c0 | 60 29 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 72 65 6d 6f 76 65 41 6c 6c 4c 69 73 74 | `).....ipcRenderer.removeAllList |
3d4e0 | 65 6e 65 72 73 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 49 4e 54 45 52 | eners(`ELECTRON_GUEST_VIEW_INTER |
3d500 | 4e 41 4c 5f 44 49 53 50 41 54 43 48 5f 45 56 45 4e 54 2d 24 7b 76 69 65 77 49 6e 73 74 61 6e 63 | NAL_DISPATCH_EVENT-${viewInstanc |
3d520 | 65 49 64 7d 60 29 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 72 65 6d 6f 76 65 41 6c 6c | eId}`).....ipcRenderer.removeAll |
3d540 | 4c 69 73 74 65 6e 65 72 73 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 49 | Listeners(`ELECTRON_GUEST_VIEW_I |
3d560 | 4e 54 45 52 4e 41 4c 5f 49 50 43 5f 4d 45 53 53 41 47 45 2d 24 7b 76 69 65 77 49 6e 73 74 61 6e | NTERNAL_IPC_MESSAGE-${viewInstan |
3d580 | 63 65 49 64 7d 60 29 0a 20 20 7d 2c 0a 20 20 63 72 65 61 74 65 47 75 65 73 74 3a 20 66 75 6e 63 | ceId}`)...},...createGuest:.func |
3d5a0 | 74 69 6f 6e 20 28 70 61 72 61 6d 73 2c 20 63 61 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 72 65 | tion.(params,.callback).{.....re |
3d5c0 | 71 75 65 73 74 49 64 2b 2b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 | questId++.....ipcRenderer.send(' |
3d5e0 | 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 43 52 45 41 | ELECTRON_GUEST_VIEW_MANAGER_CREA |
3d600 | 54 45 5f 47 55 45 53 54 27 2c 20 70 61 72 61 6d 73 2c 20 72 65 71 75 65 73 74 49 64 29 0a 20 20 | TE_GUEST',.params,.requestId)... |
3d620 | 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 63 65 28 60 45 4c 45 43 54 52 4f 4e 5f 52 45 53 | ..ipcRenderer.once(`ELECTRON_RES |
3d640 | 50 4f 4e 53 45 5f 24 7b 72 65 71 75 65 73 74 49 64 7d 60 2c 20 63 61 6c 6c 62 61 63 6b 29 0a 20 | PONSE_${requestId}`,.callback).. |
3d660 | 20 7d 2c 0a 20 20 63 72 65 61 74 65 47 75 65 73 74 53 79 6e 63 3a 20 66 75 6e 63 74 69 6f 6e 20 | .},...createGuestSync:.function. |
3d680 | 28 70 61 72 61 6d 73 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 69 70 63 52 65 6e 64 65 72 65 | (params).{.....return.ipcRendere |
3d6a0 | 72 2e 73 65 6e 64 53 79 6e 63 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f | r.sendSync('ELECTRON_GUEST_VIEW_ |
3d6c0 | 4d 41 4e 41 47 45 52 5f 43 52 45 41 54 45 5f 47 55 45 53 54 5f 53 59 4e 43 27 2c 20 70 61 72 61 | MANAGER_CREATE_GUEST_SYNC',.para |
3d6e0 | 6d 73 29 0a 20 20 7d 2c 0a 20 20 64 65 73 74 72 6f 79 47 75 65 73 74 3a 20 66 75 6e 63 74 69 6f | ms)...},...destroyGuest:.functio |
3d700 | 6e 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 20 20 69 70 63 52 65 6e | n.(guestInstanceId).{.....ipcRen |
3d720 | 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f | derer.send('ELECTRON_GUEST_VIEW_ |
3d740 | 4d 41 4e 41 47 45 52 5f 44 45 53 54 52 4f 59 5f 47 55 45 53 54 27 2c 20 67 75 65 73 74 49 6e 73 | MANAGER_DESTROY_GUEST',.guestIns |
3d760 | 74 61 6e 63 65 49 64 29 0a 20 20 7d 2c 0a 20 20 61 74 74 61 63 68 47 75 65 73 74 3a 20 66 75 6e | tanceId)...},...attachGuest:.fun |
3d780 | 63 74 69 6f 6e 20 28 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 67 75 65 73 74 49 | ction.(elementInstanceId,.guestI |
3d7a0 | 6e 73 74 61 6e 63 65 49 64 2c 20 70 61 72 61 6d 73 2c 20 63 6f 6e 74 65 6e 74 57 69 6e 64 6f 77 | nstanceId,.params,.contentWindow |
3d7c0 | 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 65 6d 62 65 64 64 65 72 46 72 61 6d 65 49 64 20 3d 20 | ).{.....const.embedderFrameId.=. |
3d7e0 | 77 65 62 46 72 61 6d 65 2e 67 65 74 57 65 62 46 72 61 6d 65 49 64 28 63 6f 6e 74 65 6e 74 57 69 | webFrame.getWebFrameId(contentWi |
3d800 | 6e 64 6f 77 29 0a 20 20 20 20 69 66 20 28 65 6d 62 65 64 64 65 72 46 72 61 6d 65 49 64 20 3c 20 | ndow).....if.(embedderFrameId.<. |
3d820 | 30 29 20 7b 20 2f 2f 20 74 68 69 73 20 65 72 72 6f 72 20 73 68 6f 75 6c 64 20 6e 6f 74 20 68 61 | 0).{.//.this.error.should.not.ha |
3d840 | 70 70 65 6e 2e 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 49 6e 76 | ppen........throw.new.Error('Inv |
3d860 | 61 6c 69 64 20 65 6d 62 65 64 64 65 72 20 66 72 61 6d 65 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 | alid.embedder.frame').....}..... |
3d880 | 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 | ipcRenderer.send('ELECTRON_GUEST |
3d8a0 | 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 41 54 54 41 43 48 5f 47 55 45 53 54 27 2c 20 65 6d 62 | _VIEW_MANAGER_ATTACH_GUEST',.emb |
3d8c0 | 65 64 64 65 72 46 72 61 6d 65 49 64 2c 20 65 6c 65 6d 65 6e 74 49 6e 73 74 61 6e 63 65 49 64 2c | edderFrameId,.elementInstanceId, |
3d8e0 | 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 70 61 72 61 6d 73 29 0a 20 20 7d 0a 7d 0a | .guestInstanceId,.params)...}.}. |
3d900 | 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 69 70 63 52 65 6e 64 65 72 65 72 20 | 'use.strict'..const.ipcRenderer. |
3d920 | 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 | =.require('@electron/internal/re |
3d940 | 6e 64 65 72 65 72 2f 69 70 63 2d 72 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 63 | nderer/ipc-renderer-internal').c |
3d960 | 6f 6e 73 74 20 7b 20 57 65 62 56 69 65 77 49 6d 70 6c 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 | onst.{.WebViewImpl.}.=.require(' |
3d980 | 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 77 65 62 2d | @electron/internal/renderer/web- |
3d9a0 | 76 69 65 77 2f 77 65 62 2d 76 69 65 77 27 29 0a 63 6f 6e 73 74 20 77 65 62 56 69 65 77 43 6f 6e | view/web-view').const.webViewCon |
3d9c0 | 73 74 61 6e 74 73 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 | stants.=.require('@electron/inte |
3d9e0 | 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 77 65 62 2d 76 69 65 77 2f 77 65 62 2d 76 69 65 77 2d | rnal/renderer/web-view/web-view- |
3da00 | 63 6f 6e 73 74 61 6e 74 73 27 29 0a 63 6f 6e 73 74 20 65 72 72 6f 72 55 74 69 6c 73 20 3d 20 72 | constants').const.errorUtils.=.r |
3da20 | 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d 6f | equire('@electron/internal/commo |
3da40 | 6e 2f 65 72 72 6f 72 2d 75 74 69 6c 73 27 29 0a 0a 2f 2f 20 48 65 6c 70 65 72 20 66 75 6e 63 74 | n/error-utils')..//.Helper.funct |
3da60 | 69 6f 6e 20 74 6f 20 72 65 73 6f 6c 76 65 20 75 72 6c 20 73 65 74 20 69 6e 20 61 74 74 72 69 62 | ion.to.resolve.url.set.in.attrib |
3da80 | 75 74 65 2e 0a 63 6f 6e 73 74 20 61 20 3d 20 64 6f 63 75 6d 65 6e 74 2e 63 72 65 61 74 65 45 6c | ute..const.a.=.document.createEl |
3daa0 | 65 6d 65 6e 74 28 27 61 27 29 0a 0a 63 6f 6e 73 74 20 72 65 73 6f 6c 76 65 55 52 4c 20 3d 20 66 | ement('a')..const.resolveURL.=.f |
3dac0 | 75 6e 63 74 69 6f 6e 20 28 75 72 6c 29 20 7b 0a 20 20 69 66 20 28 75 72 6c 20 3d 3d 3d 20 27 27 | unction.(url).{...if.(url.===.'' |
3dae0 | 29 20 72 65 74 75 72 6e 20 27 27 0a 20 20 61 2e 68 72 65 66 20 3d 20 75 72 6c 0a 20 20 72 65 74 | ).return.''...a.href.=.url...ret |
3db00 | 75 72 6e 20 61 2e 68 72 65 66 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 6f 62 6a 65 63 | urn.a.href.}..//.Attribute.objec |
3db20 | 74 73 2e 0a 2f 2f 20 44 65 66 61 75 6c 74 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 | ts..//.Default.implementation.of |
3db40 | 20 61 20 57 65 62 56 69 65 77 20 61 74 74 72 69 62 75 74 65 2e 0a 63 6c 61 73 73 20 57 65 62 56 | .a.WebView.attribute..class.WebV |
3db60 | 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 6e 61 | iewAttribute.{...constructor.(na |
3db80 | 6d 65 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 6e 61 6d 65 | me,.webViewImpl).{.....this.name |
3dba0 | 20 3d 20 6e 61 6d 65 0a 20 20 20 20 74 68 69 73 2e 76 61 6c 75 65 20 3d 20 77 65 62 56 69 65 77 | .=.name.....this.value.=.webView |
3dbc0 | 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 5b 6e 61 6d 65 5d 20 7c 7c 20 27 27 0a 20 20 20 | Impl.webviewNode[name].||.''.... |
3dbe0 | 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 20 3d 20 77 65 62 56 69 65 77 49 6d 70 6c 0a | .this.webViewImpl.=.webViewImpl. |
3dc00 | 20 20 20 20 74 68 69 73 2e 69 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 20 3d 20 66 61 6c 73 65 0a | ....this.ignoreMutation.=.false. |
3dc20 | 20 20 20 20 74 68 69 73 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 29 0a 20 20 7d 0a 0a 20 | ....this.defineProperty()...}... |
3dc40 | 20 2f 2f 20 52 65 74 72 69 65 76 65 73 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 68 65 20 61 74 | .//.Retrieves.and.returns.the.at |
3dc60 | 74 72 69 62 75 74 65 27 73 20 76 61 6c 75 65 2e 0a 20 20 67 65 74 56 61 6c 75 65 20 28 29 20 7b | tribute's.value....getValue.().{ |
3dc80 | 0a 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 | .....return.this.webViewImpl.web |
3dca0 | 76 69 65 77 4e 6f 64 65 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 29 | viewNode.getAttribute(this.name) |
3dcc0 | 20 7c 7c 20 74 68 69 73 2e 76 61 6c 75 65 0a 20 20 7d 0a 0a 20 20 2f 2f 20 53 65 74 73 20 74 68 | .||.this.value...}....//.Sets.th |
3dce0 | 65 20 61 74 74 72 69 62 75 74 65 27 73 20 76 61 6c 75 65 2e 0a 20 20 73 65 74 56 61 6c 75 65 20 | e.attribute's.value....setValue. |
3dd00 | 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 | (value).{.....this.webViewImpl.w |
3dd20 | 65 62 76 69 65 77 4e 6f 64 65 2e 73 65 74 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d | ebviewNode.setAttribute(this.nam |
3dd40 | 65 2c 20 76 61 6c 75 65 20 7c 7c 20 27 27 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 43 68 61 6e 67 65 | e,.value.||.'')...}....//.Change |
3dd60 | 73 20 74 68 65 20 61 74 74 72 69 62 75 74 65 27 73 20 76 61 6c 75 65 20 77 69 74 68 6f 75 74 20 | s.the.attribute's.value.without. |
3dd80 | 74 72 69 67 67 65 72 69 6e 67 20 69 74 73 20 6d 75 74 61 74 69 6f 6e 20 68 61 6e 64 6c 65 72 2e | triggering.its.mutation.handler. |
3dda0 | 0a 20 20 73 65 74 56 61 6c 75 65 49 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 20 28 76 61 6c 75 65 | ...setValueIgnoreMutation.(value |
3ddc0 | 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 69 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 20 3d 20 74 72 | ).{.....this.ignoreMutation.=.tr |
3dde0 | 75 65 0a 20 20 20 20 74 68 69 73 2e 73 65 74 56 61 6c 75 65 28 76 61 6c 75 65 29 0a 20 20 20 20 | ue.....this.setValue(value)..... |
3de00 | 74 68 69 73 2e 69 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 20 3d 20 66 61 6c 73 65 0a 20 20 7d 0a | this.ignoreMutation.=.false...}. |
3de20 | 0a 20 20 2f 2f 20 44 65 66 69 6e 65 73 20 74 68 69 73 20 61 74 74 72 69 62 75 74 65 20 61 73 20 | ...//.Defines.this.attribute.as. |
3de40 | 61 20 70 72 6f 70 65 72 74 79 20 6f 6e 20 74 68 65 20 77 65 62 76 69 65 77 20 6e 6f 64 65 2e 0a | a.property.on.the.webview.node.. |
3de60 | 20 20 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e | ..defineProperty.().{.....return |
3de80 | 20 4f 62 6a 65 63 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 74 68 69 73 2e 77 65 62 56 | .Object.defineProperty(this.webV |
3dea0 | 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2c 20 74 68 69 73 2e 6e 61 6d 65 2c 20 | iewImpl.webviewNode,.this.name,. |
3dec0 | 7b 0a 20 20 20 20 20 20 67 65 74 3a 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 | {.......get:.().=>.{.........ret |
3dee0 | 75 72 6e 20 74 68 69 73 2e 67 65 74 56 61 6c 75 65 28 29 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 | urn.this.getValue().......},.... |
3df00 | 20 20 20 73 65 74 3a 20 28 76 61 6c 75 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 | ...set:.(value).=>.{.........ret |
3df20 | 75 72 6e 20 74 68 69 73 2e 73 65 74 56 61 6c 75 65 28 76 61 6c 75 65 29 0a 20 20 20 20 20 20 7d | urn.this.setValue(value).......} |
3df40 | 2c 0a 20 20 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 0a 20 20 20 20 7d 29 0a | ,.......enumerable:.true.....}). |
3df60 | 20 20 7d 0a 0a 20 20 2f 2f 20 43 61 6c 6c 65 64 20 77 68 65 6e 20 74 68 65 20 61 74 74 72 69 62 | ..}....//.Called.when.the.attrib |
3df80 | 75 74 65 27 73 20 76 61 6c 75 65 20 63 68 61 6e 67 65 73 2e 0a 20 20 68 61 6e 64 6c 65 4d 75 74 | ute's.value.changes....handleMut |
3dfa0 | 61 74 69 6f 6e 20 28 29 20 7b 7d 0a 7d 0a 0a 2f 2f 20 41 6e 20 61 74 74 72 69 62 75 74 65 20 74 | ation.().{}.}..//.An.attribute.t |
3dfc0 | 68 61 74 20 69 73 20 74 72 65 61 74 65 64 20 61 73 20 61 20 42 6f 6f 6c 65 61 6e 2e 0a 63 6c 61 | hat.is.treated.as.a.Boolean..cla |
3dfe0 | 73 73 20 42 6f 6f 6c 65 61 6e 41 74 74 72 69 62 75 74 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 | ss.BooleanAttribute.extends.WebV |
3e000 | 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 67 65 74 56 61 6c 75 65 20 28 29 20 7b 0a 20 | iewAttribute.{...getValue.().{.. |
3e020 | 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 | ...return.this.webViewImpl.webvi |
3e040 | 65 77 4e 6f 64 65 2e 68 61 73 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 29 0a 20 | ewNode.hasAttribute(this.name).. |
3e060 | 20 7d 0a 0a 20 20 73 65 74 56 61 6c 75 65 20 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 69 66 20 | .}....setValue.(value).{.....if. |
3e080 | 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c | (value).{.......this.webViewImpl |
3e0a0 | 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 73 65 74 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e | .webviewNode.setAttribute(this.n |
3e0c0 | 61 6d 65 2c 20 27 27 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 74 68 69 73 | ame,.'').....}.else.{.......this |
3e0e0 | 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 72 65 6d 6f 76 65 41 | .webViewImpl.webviewNode.removeA |
3e100 | 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a | ttribute(this.name).....}...}.}. |
3e120 | 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74 68 65 20 73 | .//.Attribute.representing.the.s |
3e140 | 74 61 74 65 20 6f 66 20 74 68 65 20 73 74 6f 72 61 67 65 20 70 61 72 74 69 74 69 6f 6e 2e 0a 63 | tate.of.the.storage.partition..c |
3e160 | 6c 61 73 73 20 50 61 72 74 69 74 69 6f 6e 41 74 74 72 69 62 75 74 65 20 65 78 74 65 6e 64 73 20 | lass.PartitionAttribute.extends. |
3e180 | 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 | WebViewAttribute.{...constructor |
3e1a0 | 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 77 65 62 56 69 | .(webViewImpl).{.....super(webVi |
3e1c0 | 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 50 41 52 54 49 54 49 4f 4e 2c | ewConstants.ATTRIBUTE_PARTITION, |
3e1e0 | 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a 20 20 20 20 74 68 69 73 2e 76 61 6c 69 64 50 61 72 74 | .webViewImpl).....this.validPart |
3e200 | 69 74 69 6f 6e 49 64 20 3d 20 74 72 75 65 0a 20 20 7d 0a 0a 20 20 68 61 6e 64 6c 65 4d 75 74 61 | itionId.=.true...}....handleMuta |
3e220 | 74 69 6f 6e 20 28 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 6c 75 65 29 20 7b 0a 20 20 20 20 | tion.(oldValue,.newValue).{..... |
3e240 | 6e 65 77 56 61 6c 75 65 20 3d 20 6e 65 77 56 61 6c 75 65 20 7c 7c 20 27 27 0a 0a 20 20 20 20 2f | newValue.=.newValue.||.''....../ |
3e260 | 2f 20 54 68 65 20 70 61 72 74 69 74 69 6f 6e 20 63 61 6e 6e 6f 74 20 63 68 61 6e 67 65 20 69 66 | /.The.partition.cannot.change.if |
3e280 | 20 74 68 65 20 77 65 62 76 69 65 77 20 68 61 73 20 61 6c 72 65 61 64 79 20 6e 61 76 69 67 61 74 | .the.webview.has.already.navigat |
3e2a0 | 65 64 2e 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 62 65 | ed......if.(!this.webViewImpl.be |
3e2c0 | 66 6f 72 65 46 69 72 73 74 4e 61 76 69 67 61 74 69 6f 6e 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e | foreFirstNavigation).{.......con |
3e2e0 | 73 6f 6c 65 2e 65 72 72 6f 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 45 52 52 4f | sole.error(webViewConstants.ERRO |
3e300 | 52 5f 4d 53 47 5f 41 4c 52 45 41 44 59 5f 4e 41 56 49 47 41 54 45 44 29 0a 20 20 20 20 20 20 74 | R_MSG_ALREADY_NAVIGATED).......t |
3e320 | 68 69 73 2e 73 65 74 56 61 6c 75 65 49 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 28 6f 6c 64 56 61 | his.setValueIgnoreMutation(oldVa |
3e340 | 6c 75 65 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 28 | lue).......return.....}.....if.( |
3e360 | 6e 65 77 56 61 6c 75 65 20 3d 3d 3d 20 27 70 65 72 73 69 73 74 3a 27 29 20 7b 0a 20 20 20 20 20 | newValue.===.'persist:').{...... |
3e380 | 20 74 68 69 73 2e 76 61 6c 69 64 50 61 72 74 69 74 69 6f 6e 49 64 20 3d 20 66 61 6c 73 65 0a 20 | .this.validPartitionId.=.false.. |
3e3a0 | 20 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 | .....console.error(webViewConsta |
3e3c0 | 6e 74 73 2e 45 52 52 4f 52 5f 4d 53 47 5f 49 4e 56 41 4c 49 44 5f 50 41 52 54 49 54 49 4f 4e 5f | nts.ERROR_MSG_INVALID_PARTITION_ |
3e3e0 | 41 54 54 52 49 42 55 54 45 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 | ATTRIBUTE).....}...}.}..//.Attri |
3e400 | 62 75 74 65 20 74 68 61 74 20 68 61 6e 64 6c 65 73 20 74 68 65 20 6c 6f 63 61 74 69 6f 6e 20 61 | bute.that.handles.the.location.a |
3e420 | 6e 64 20 6e 61 76 69 67 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 77 65 62 76 69 65 77 2e 0a 63 6c | nd.navigation.of.the.webview..cl |
3e440 | 61 73 73 20 53 72 63 41 74 74 72 69 62 75 74 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 69 65 77 | ass.SrcAttribute.extends.WebView |
3e460 | 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 62 56 69 | Attribute.{...constructor.(webVi |
3e480 | 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 | ewImpl).{.....super(webViewConst |
3e4a0 | 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 53 52 43 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 | ants.ATTRIBUTE_SRC,.webViewImpl) |
3e4c0 | 0a 20 20 20 20 74 68 69 73 2e 73 65 74 75 70 4d 75 74 61 74 69 6f 6e 4f 62 73 65 72 76 65 72 28 | .....this.setupMutationObserver( |
3e4e0 | 29 0a 20 20 7d 0a 0a 20 20 67 65 74 56 61 6c 75 65 20 28 29 20 7b 0a 20 20 20 20 69 66 20 28 74 | )...}....getValue.().{.....if.(t |
3e500 | 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 68 61 73 41 | his.webViewImpl.webviewNode.hasA |
3e520 | 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 | ttribute(this.name)).{.......ret |
3e540 | 75 72 6e 20 72 65 73 6f 6c 76 65 55 52 4c 28 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e | urn.resolveURL(this.webViewImpl. |
3e560 | 77 65 62 76 69 65 77 4e 6f 64 65 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 | webviewNode.getAttribute(this.na |
3e580 | 6d 65 29 29 0a 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 | me)).....}.else.{.......return.t |
3e5a0 | 68 69 73 2e 76 61 6c 75 65 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 73 65 74 56 61 6c 75 65 49 | his.value.....}...}....setValueI |
3e5c0 | 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 20 28 76 61 6c 75 65 29 20 7b 0a 20 20 20 20 73 75 70 65 | gnoreMutation.(value).{.....supe |
3e5e0 | 72 2e 73 65 74 56 61 6c 75 65 49 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 28 76 61 6c 75 65 29 0a | r.setValueIgnoreMutation(value). |
3e600 | 0a 20 20 20 20 2f 2f 20 74 61 6b 65 52 65 63 6f 72 64 73 28 29 20 69 73 20 6e 65 65 64 65 64 20 | .....//.takeRecords().is.needed. |
3e620 | 74 6f 20 63 6c 65 61 72 20 71 75 65 75 65 64 20 75 70 20 73 72 63 20 6d 75 74 61 74 69 6f 6e 73 | to.clear.queued.up.src.mutations |
3e640 | 2e 20 57 69 74 68 6f 75 74 20 69 74 2c 20 69 74 0a 20 20 20 20 2f 2f 20 69 73 20 70 6f 73 73 69 | ..Without.it,.it.....//.is.possi |
3e660 | 62 6c 65 20 66 6f 72 20 74 68 69 73 20 63 68 61 6e 67 65 20 74 6f 20 67 65 74 20 70 69 63 6b 65 | ble.for.this.change.to.get.picke |
3e680 | 64 20 75 70 20 61 73 79 6e 63 72 6f 6e 6f 75 73 6c 79 20 62 79 20 73 72 63 27 73 0a 20 20 20 20 | d.up.asyncronously.by.src's..... |
3e6a0 | 2f 2f 20 6d 75 74 61 74 69 6f 6e 20 6f 62 73 65 72 76 65 72 20 7c 6f 62 73 65 72 76 65 72 7c 2c | //.mutation.observer.|observer|, |
3e6c0 | 20 61 6e 64 20 74 68 65 6e 20 67 65 74 20 68 61 6e 64 6c 65 64 20 65 76 65 6e 20 74 68 6f 75 67 | .and.then.get.handled.even.thoug |
3e6e0 | 68 20 77 65 20 64 6f 20 6e 6f 74 0a 20 20 20 20 2f 2f 20 77 61 6e 74 20 74 6f 20 68 61 6e 64 6c | h.we.do.not.....//.want.to.handl |
3e700 | 65 20 74 68 69 73 20 6d 75 74 61 74 69 6f 6e 2e 0a 20 20 20 20 74 68 69 73 2e 6f 62 73 65 72 76 | e.this.mutation......this.observ |
3e720 | 65 72 2e 74 61 6b 65 52 65 63 6f 72 64 73 28 29 0a 20 20 7d 0a 0a 20 20 68 61 6e 64 6c 65 4d 75 | er.takeRecords()...}....handleMu |
3e740 | 74 61 74 69 6f 6e 20 28 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 6c 75 65 29 20 7b 0a 20 20 | tation.(oldValue,.newValue).{... |
3e760 | 20 20 2f 2f 20 4f 6e 63 65 20 77 65 20 68 61 76 65 20 6e 61 76 69 67 61 74 65 64 2c 20 77 65 20 | ..//.Once.we.have.navigated,.we. |
3e780 | 64 6f 6e 27 74 20 61 6c 6c 6f 77 20 63 6c 65 61 72 69 6e 67 20 74 68 65 20 73 72 63 20 61 74 74 | don't.allow.clearing.the.src.att |
3e7a0 | 72 69 62 75 74 65 2e 0a 20 20 20 20 2f 2f 20 4f 6e 63 65 20 3c 77 65 62 76 69 65 77 3e 20 65 6e | ribute......//.Once.<webview>.en |
3e7c0 | 74 65 72 73 20 61 20 6e 61 76 69 67 61 74 65 64 20 73 74 61 74 65 2c 20 69 74 20 63 61 6e 6e 6f | ters.a.navigated.state,.it.canno |
3e7e0 | 74 20 72 65 74 75 72 6e 20 74 6f 20 61 0a 20 20 20 20 2f 2f 20 70 6c 61 63 65 68 6f 6c 64 65 72 | t.return.to.a.....//.placeholder |
3e800 | 20 73 74 61 74 65 2e 0a 20 20 20 20 69 66 20 28 21 6e 65 77 56 61 6c 75 65 20 26 26 20 6f 6c 64 | .state......if.(!newValue.&&.old |
3e820 | 56 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 73 72 63 20 61 74 74 72 69 62 75 74 65 20 | Value).{.......//.src.attribute. |
3e840 | 63 68 61 6e 67 65 73 20 6e 6f 72 6d 61 6c 6c 79 20 69 6e 69 74 69 61 74 65 20 61 20 6e 61 76 69 | changes.normally.initiate.a.navi |
3e860 | 67 61 74 69 6f 6e 2e 20 57 65 20 73 75 70 70 72 65 73 73 0a 20 20 20 20 20 20 2f 2f 20 74 68 65 | gation..We.suppress.......//.the |
3e880 | 20 6e 65 78 74 20 73 72 63 20 61 74 74 72 69 62 75 74 65 20 68 61 6e 64 6c 65 72 20 63 61 6c 6c | .next.src.attribute.handler.call |
3e8a0 | 20 74 6f 20 61 76 6f 69 64 20 72 65 6c 6f 61 64 69 6e 67 20 74 68 65 20 70 61 67 65 0a 20 20 20 | .to.avoid.reloading.the.page.... |
3e8c0 | 20 20 20 2f 2f 20 6f 6e 20 65 76 65 72 79 20 67 75 65 73 74 2d 69 6e 69 74 69 61 74 65 64 20 6e | ...//.on.every.guest-initiated.n |
3e8e0 | 61 76 69 67 61 74 69 6f 6e 2e 0a 20 20 20 20 20 20 74 68 69 73 2e 73 65 74 56 61 6c 75 65 49 67 | avigation........this.setValueIg |
3e900 | 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 28 6f 6c 64 56 61 6c 75 65 29 0a 20 20 20 20 20 20 72 65 74 | noreMutation(oldValue).......ret |
3e920 | 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 73 2e 70 61 72 73 65 28 29 0a 20 20 7d 0a 0a | urn.....}.....this.parse()...}.. |
3e940 | 20 20 2f 2f 20 54 68 65 20 70 75 72 70 6f 73 65 20 6f 66 20 74 68 69 73 20 6d 75 74 61 74 69 6f | ..//.The.purpose.of.this.mutatio |
3e960 | 6e 20 6f 62 73 65 72 76 65 72 20 69 73 20 74 6f 20 63 61 74 63 68 20 61 73 73 69 67 6e 6d 65 6e | n.observer.is.to.catch.assignmen |
3e980 | 74 20 74 6f 20 74 68 65 20 73 72 63 0a 20 20 2f 2f 20 61 74 74 72 69 62 75 74 65 20 77 69 74 68 | t.to.the.src...//.attribute.with |
3e9a0 | 6f 75 74 20 61 6e 79 20 63 68 61 6e 67 65 73 20 74 6f 20 69 74 73 20 76 61 6c 75 65 2e 20 54 68 | out.any.changes.to.its.value..Th |
3e9c0 | 69 73 20 69 73 20 75 73 65 66 75 6c 20 69 6e 20 74 68 65 20 63 61 73 65 0a 20 20 2f 2f 20 77 68 | is.is.useful.in.the.case...//.wh |
3e9e0 | 65 72 65 20 74 68 65 20 77 65 62 76 69 65 77 20 67 75 65 73 74 20 68 61 73 20 63 72 61 73 68 65 | ere.the.webview.guest.has.crashe |
3ea00 | 64 20 61 6e 64 20 6e 61 76 69 67 61 74 69 6e 67 20 74 6f 20 74 68 65 20 73 61 6d 65 20 61 64 64 | d.and.navigating.to.the.same.add |
3ea20 | 72 65 73 73 0a 20 20 2f 2f 20 73 70 61 77 6e 73 20 6f 66 66 20 61 20 6e 65 77 20 70 72 6f 63 65 | ress...//.spawns.off.a.new.proce |
3ea40 | 73 73 2e 0a 20 20 73 65 74 75 70 4d 75 74 61 74 69 6f 6e 4f 62 73 65 72 76 65 72 20 28 29 20 7b | ss....setupMutationObserver.().{ |
3ea60 | 0a 20 20 20 20 74 68 69 73 2e 6f 62 73 65 72 76 65 72 20 3d 20 6e 65 77 20 4d 75 74 61 74 69 6f | .....this.observer.=.new.Mutatio |
3ea80 | 6e 4f 62 73 65 72 76 65 72 28 28 6d 75 74 61 74 69 6f 6e 73 29 20 3d 3e 20 7b 0a 20 20 20 20 20 | nObserver((mutations).=>.{...... |
3eaa0 | 20 66 6f 72 20 28 63 6f 6e 73 74 20 6d 75 74 61 74 69 6f 6e 20 6f 66 20 6d 75 74 61 74 69 6f 6e | .for.(const.mutation.of.mutation |
3eac0 | 73 29 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 7b 20 6f 6c 64 56 61 6c 75 65 20 7d 20 | s).{.........const.{.oldValue.}. |
3eae0 | 3d 20 6d 75 74 61 74 69 6f 6e 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 6e 65 77 56 61 6c 75 | =.mutation.........const.newValu |
3eb00 | 65 20 3d 20 74 68 69 73 2e 67 65 74 56 61 6c 75 65 28 29 0a 20 20 20 20 20 20 20 20 69 66 20 28 | e.=.this.getValue().........if.( |
3eb20 | 6f 6c 64 56 61 6c 75 65 20 21 3d 3d 20 6e 65 77 56 61 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 20 | oldValue.!==.newValue).{........ |
3eb40 | 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 74 68 69 73 | ...return.........}.........this |
3eb60 | 2e 68 61 6e 64 6c 65 4d 75 74 61 74 69 6f 6e 28 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 6c | .handleMutation(oldValue,.newVal |
3eb80 | 75 65 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 29 0a 20 20 20 20 63 6f 6e 73 74 20 70 61 72 | ue).......}.....}).....const.par |
3eba0 | 61 6d 73 20 3d 20 7b 0a 20 20 20 20 20 20 61 74 74 72 69 62 75 74 65 73 3a 20 74 72 75 65 2c 0a | ams.=.{.......attributes:.true,. |
3ebc0 | 20 20 20 20 20 20 61 74 74 72 69 62 75 74 65 4f 6c 64 56 61 6c 75 65 3a 20 74 72 75 65 2c 0a 20 | ......attributeOldValue:.true,.. |
3ebe0 | 20 20 20 20 20 61 74 74 72 69 62 75 74 65 46 69 6c 74 65 72 3a 20 5b 74 68 69 73 2e 6e 61 6d 65 | .....attributeFilter:.[this.name |
3ec00 | 5d 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 73 2e 6f 62 73 65 72 76 65 72 2e 6f 62 73 65 72 76 | ].....}.....this.observer.observ |
3ec20 | 65 28 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2c 20 | e(this.webViewImpl.webviewNode,. |
3ec40 | 70 61 72 61 6d 73 29 0a 20 20 7d 0a 0a 20 20 70 61 72 73 65 20 28 29 20 7b 0a 20 20 20 20 69 66 | params)...}....parse.().{.....if |
3ec60 | 20 28 21 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 65 6c 65 6d 65 6e 74 41 74 74 61 63 | .(!this.webViewImpl.elementAttac |
3ec80 | 68 65 64 20 7c 7c 20 21 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 61 74 74 72 69 62 75 | hed.||.!this.webViewImpl.attribu |
3eca0 | 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 50 | tes[webViewConstants.ATTRIBUTE_P |
3ecc0 | 41 52 54 49 54 49 4f 4e 5d 2e 76 61 6c 69 64 50 61 72 74 69 74 69 6f 6e 49 64 20 7c 7c 20 21 74 | ARTITION].validPartitionId.||.!t |
3ece0 | 68 69 73 2e 67 65 74 56 61 6c 75 65 28 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a 20 | his.getValue()).{.......return.. |
3ed00 | 20 20 20 7d 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 67 75 | ...}.....if.(this.webViewImpl.gu |
3ed20 | 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 69 | estInstanceId.==.null).{.......i |
3ed40 | 66 20 28 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 62 65 66 6f 72 65 46 69 72 73 74 4e | f.(this.webViewImpl.beforeFirstN |
3ed60 | 61 76 69 67 61 74 69 6f 6e 29 20 7b 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 77 65 62 56 69 65 | avigation).{.........this.webVie |
3ed80 | 77 49 6d 70 6c 2e 62 65 66 6f 72 65 46 69 72 73 74 4e 61 76 69 67 61 74 69 6f 6e 20 3d 20 66 61 | wImpl.beforeFirstNavigation.=.fa |
3eda0 | 6c 73 65 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 63 72 65 | lse.........this.webViewImpl.cre |
3edc0 | 61 74 65 47 75 65 73 74 28 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a | ateGuest().......}.......return. |
3ede0 | 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 4e 61 76 69 67 61 74 65 20 74 6f 20 7c 74 68 69 73 2e | ....}......//.Navigate.to.|this. |
3ee00 | 73 72 63 7c 2e 0a 20 20 20 20 63 6f 6e 73 74 20 6f 70 74 73 20 3d 20 7b 7d 0a 20 20 20 20 63 6f | src|......const.opts.=.{}.....co |
3ee20 | 6e 73 74 20 68 74 74 70 72 65 66 65 72 72 65 72 20 3d 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 | nst.httpreferrer.=.this.webViewI |
3ee40 | 6d 70 6c 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e | mpl.attributes[webViewConstants. |
3ee60 | 41 54 54 52 49 42 55 54 45 5f 48 54 54 50 52 45 46 45 52 52 45 52 5d 2e 67 65 74 56 61 6c 75 65 | ATTRIBUTE_HTTPREFERRER].getValue |
3ee80 | 28 29 0a 20 20 20 20 69 66 20 28 68 74 74 70 72 65 66 65 72 72 65 72 29 20 7b 0a 20 20 20 20 20 | ().....if.(httpreferrer).{...... |
3eea0 | 20 6f 70 74 73 2e 68 74 74 70 52 65 66 65 72 72 65 72 20 3d 20 68 74 74 70 72 65 66 65 72 72 65 | .opts.httpReferrer.=.httpreferre |
3eec0 | 72 0a 20 20 20 20 7d 0a 20 20 20 20 63 6f 6e 73 74 20 75 73 65 72 61 67 65 6e 74 20 3d 20 74 68 | r.....}.....const.useragent.=.th |
3eee0 | 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 | is.webViewImpl.attributes[webVie |
3ef00 | 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 55 53 45 52 41 47 45 4e 54 5d 2e | wConstants.ATTRIBUTE_USERAGENT]. |
3ef20 | 67 65 74 56 61 6c 75 65 28 29 0a 20 20 20 20 69 66 20 28 75 73 65 72 61 67 65 6e 74 29 20 7b 0a | getValue().....if.(useragent).{. |
3ef40 | 20 20 20 20 20 20 6f 70 74 73 2e 75 73 65 72 41 67 65 6e 74 20 3d 20 75 73 65 72 61 67 65 6e 74 | ......opts.userAgent.=.useragent |
3ef60 | 0a 20 20 20 20 7d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 | .....}......const.guestInstanceI |
3ef80 | 64 20 3d 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 67 75 65 73 74 49 6e 73 74 61 6e | d.=.this.webViewImpl.guestInstan |
3efa0 | 63 65 49 64 0a 20 20 20 20 63 6f 6e 73 74 20 6d 65 74 68 6f 64 20 3d 20 27 6c 6f 61 64 55 52 4c | ceId.....const.method.=.'loadURL |
3efc0 | 27 0a 20 20 20 20 63 6f 6e 73 74 20 61 72 67 73 20 3d 20 5b 74 68 69 73 2e 67 65 74 56 61 6c 75 | '.....const.args.=.[this.getValu |
3efe0 | 65 28 29 2c 20 6f 70 74 73 5d 0a 0a 20 20 20 20 63 6f 6e 73 74 20 5b 65 72 72 6f 72 5d 20 3d 20 | e(),.opts]......const.[error].=. |
3f000 | 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 27 45 4c 45 43 54 52 4f 4e 5f 47 | ipcRenderer.sendSync('ELECTRON_G |
3f020 | 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 53 59 4e 43 5f 43 41 4c 4c 27 2c 20 67 75 | UEST_VIEW_MANAGER_SYNC_CALL',.gu |
3f040 | 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 6d 65 74 68 6f 64 2c 20 61 72 67 73 29 0a 20 20 20 | estInstanceId,.method,.args).... |
3f060 | 20 69 66 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 65 72 72 6f 72 55 | .if.(error).{.......throw.errorU |
3f080 | 74 69 6c 73 2e 64 65 73 65 72 69 61 6c 69 7a 65 28 65 72 72 6f 72 29 0a 20 20 20 20 7d 0a 20 20 | tils.deserialize(error).....}... |
3f0a0 | 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 73 70 65 63 69 66 69 65 73 20 48 54 54 50 | }.}..//.Attribute.specifies.HTTP |
3f0c0 | 20 72 65 66 65 72 72 65 72 2e 0a 63 6c 61 73 73 20 48 74 74 70 52 65 66 65 72 72 65 72 41 74 74 | .referrer..class.HttpReferrerAtt |
3f0e0 | 72 69 62 75 74 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 | ribute.extends.WebViewAttribute. |
3f100 | 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a | {...constructor.(webViewImpl).{. |
3f120 | 20 20 20 20 73 75 70 65 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 | ....super(webViewConstants.ATTRI |
3f140 | 42 55 54 45 5f 48 54 54 50 52 45 46 45 52 52 45 52 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a | BUTE_HTTPREFERRER,.webViewImpl). |
3f160 | 20 20 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 73 70 65 63 69 66 69 65 73 20 75 73 | ..}.}..//.Attribute.specifies.us |
3f180 | 65 72 20 61 67 65 6e 74 0a 63 6c 61 73 73 20 55 73 65 72 41 67 65 6e 74 41 74 74 72 69 62 75 74 | er.agent.class.UserAgentAttribut |
3f1a0 | 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 63 | e.extends.WebViewAttribute.{...c |
3f1c0 | 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 20 73 | onstructor.(webViewImpl).{.....s |
3f1e0 | 75 70 65 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f | uper(webViewConstants.ATTRIBUTE_ |
3f200 | 55 53 45 52 41 47 45 4e 54 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a 20 20 7d 0a 7d 0a 0a 2f | USERAGENT,.webViewImpl)...}.}../ |
3f220 | 2f 20 41 74 74 72 69 62 75 74 65 20 74 68 61 74 20 73 65 74 20 70 72 65 6c 6f 61 64 20 73 63 72 | /.Attribute.that.set.preload.scr |
3f240 | 69 70 74 2e 0a 63 6c 61 73 73 20 50 72 65 6c 6f 61 64 41 74 74 72 69 62 75 74 65 20 65 78 74 65 | ipt..class.PreloadAttribute.exte |
3f260 | 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 63 6f 6e 73 74 72 75 | nds.WebViewAttribute.{...constru |
3f280 | 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 77 | ctor.(webViewImpl).{.....super(w |
3f2a0 | 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 50 52 45 4c 4f 41 | ebViewConstants.ATTRIBUTE_PRELOA |
3f2c0 | 44 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a 20 20 7d 0a 0a 20 20 67 65 74 56 61 6c 75 65 20 | D,.webViewImpl)...}....getValue. |
3f2e0 | 28 29 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 | ().{.....if.(!this.webViewImpl.w |
3f300 | 65 62 76 69 65 77 4e 6f 64 65 2e 68 61 73 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d | ebviewNode.hasAttribute(this.nam |
3f320 | 65 29 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 76 61 6c 75 65 0a 20 20 | e)).{.......return.this.value... |
3f340 | 20 20 7d 0a 20 20 20 20 6c 65 74 20 70 72 65 6c 6f 61 64 20 3d 20 72 65 73 6f 6c 76 65 55 52 4c | ..}.....let.preload.=.resolveURL |
3f360 | 28 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 67 65 | (this.webViewImpl.webviewNode.ge |
3f380 | 74 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 29 29 0a 20 20 20 20 63 6f 6e 73 74 | tAttribute(this.name)).....const |
3f3a0 | 20 70 72 6f 74 6f 63 6f 6c 20 3d 20 70 72 65 6c 6f 61 64 2e 73 75 62 73 74 72 28 30 2c 20 35 29 | .protocol.=.preload.substr(0,.5) |
3f3c0 | 0a 20 20 20 20 69 66 20 28 70 72 6f 74 6f 63 6f 6c 20 21 3d 3d 20 27 66 69 6c 65 3a 27 29 20 7b | .....if.(protocol.!==.'file:').{ |
3f3e0 | 0a 20 20 20 20 20 20 63 6f 6e 73 6f 6c 65 2e 65 72 72 6f 72 28 77 65 62 56 69 65 77 43 6f 6e 73 | .......console.error(webViewCons |
3f400 | 74 61 6e 74 73 2e 45 52 52 4f 52 5f 4d 53 47 5f 49 4e 56 41 4c 49 44 5f 50 52 45 4c 4f 41 44 5f | tants.ERROR_MSG_INVALID_PRELOAD_ |
3f420 | 41 54 54 52 49 42 55 54 45 29 0a 20 20 20 20 20 20 70 72 65 6c 6f 61 64 20 3d 20 27 27 0a 20 20 | ATTRIBUTE).......preload.=.''... |
3f440 | 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 70 72 65 6c 6f 61 64 0a 20 20 7d 0a 7d 0a 0a 2f 2f | ..}.....return.preload...}.}..// |
3f460 | 20 41 74 74 72 69 62 75 74 65 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 20 74 68 65 20 62 6c | .Attribute.that.specifies.the.bl |
3f480 | 69 6e 6b 20 66 65 61 74 75 72 65 73 20 74 6f 20 62 65 20 65 6e 61 62 6c 65 64 2e 0a 63 6c 61 73 | ink.features.to.be.enabled..clas |
3f4a0 | 73 20 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 41 74 74 72 69 62 75 74 65 20 65 78 74 65 6e 64 73 | s.BlinkFeaturesAttribute.extends |
3f4c0 | 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f | .WebViewAttribute.{...constructo |
3f4e0 | 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 77 65 62 56 | r.(webViewImpl).{.....super(webV |
3f500 | 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 42 4c 49 4e 4b 46 45 41 54 | iewConstants.ATTRIBUTE_BLINKFEAT |
3f520 | 55 52 45 53 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 | URES,.webViewImpl)...}.}..//.Att |
3f540 | 72 69 62 75 74 65 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 20 74 68 65 20 62 6c 69 6e 6b 20 | ribute.that.specifies.the.blink. |
3f560 | 66 65 61 74 75 72 65 73 20 74 6f 20 62 65 20 64 69 73 61 62 6c 65 64 2e 0a 63 6c 61 73 73 20 44 | features.to.be.disabled..class.D |
3f580 | 69 73 61 62 6c 65 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 41 74 74 72 69 62 75 74 65 20 65 78 74 | isableBlinkFeaturesAttribute.ext |
3f5a0 | 65 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 63 6f 6e 73 74 72 | ends.WebViewAttribute.{...constr |
3f5c0 | 75 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 20 73 75 70 65 72 28 | uctor.(webViewImpl).{.....super( |
3f5e0 | 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 44 49 53 41 42 | webViewConstants.ATTRIBUTE_DISAB |
3f600 | 4c 45 42 4c 49 4e 4b 46 45 41 54 55 52 45 53 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a 20 20 | LEBLINKFEATURES,.webViewImpl)... |
3f620 | 7d 0a 7d 0a 0a 2f 2f 20 41 74 74 72 69 62 75 74 65 20 74 68 61 74 20 73 70 65 63 69 66 69 65 73 | }.}..//.Attribute.that.specifies |
3f640 | 20 74 68 65 20 77 65 62 20 70 72 65 66 65 72 65 6e 63 65 73 20 74 6f 20 62 65 20 65 6e 61 62 6c | .the.web.preferences.to.be.enabl |
3f660 | 65 64 2e 0a 63 6c 61 73 73 20 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 41 74 74 72 69 62 75 74 | ed..class.WebPreferencesAttribut |
3f680 | 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 7b 0a 20 20 63 | e.extends.WebViewAttribute.{...c |
3f6a0 | 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 20 20 20 73 | onstructor.(webViewImpl).{.....s |
3f6c0 | 75 70 65 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f | uper(webViewConstants.ATTRIBUTE_ |
3f6e0 | 57 45 42 50 52 45 46 45 52 45 4e 43 45 53 2c 20 77 65 62 56 69 65 77 49 6d 70 6c 29 0a 20 20 7d | WEBPREFERENCES,.webViewImpl)...} |
3f700 | 0a 7d 0a 0a 63 6c 61 73 73 20 45 6e 61 62 6c 65 52 65 6d 6f 74 65 4d 6f 64 75 6c 65 41 74 74 72 | .}..class.EnableRemoteModuleAttr |
3f720 | 69 62 75 74 65 20 65 78 74 65 6e 64 73 20 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 20 7b | ibute.extends.WebViewAttribute.{ |
3f740 | 0a 20 20 63 6f 6e 73 74 72 75 63 74 6f 72 20 28 77 65 62 56 69 65 77 49 6d 70 6c 29 20 7b 0a 20 | ...constructor.(webViewImpl).{.. |
3f760 | 20 20 20 73 75 70 65 72 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 | ...super(webViewConstants.ATTRIB |
3f780 | 55 54 45 5f 45 4e 41 42 4c 45 52 45 4d 4f 54 45 4d 4f 44 55 4c 45 2c 20 77 65 62 56 69 65 77 49 | UTE_ENABLEREMOTEMODULE,.webViewI |
3f7a0 | 6d 70 6c 29 0a 20 20 7d 0a 0a 20 20 67 65 74 56 61 6c 75 65 20 28 29 20 7b 0a 20 20 20 20 72 65 | mpl)...}....getValue.().{.....re |
3f7c0 | 74 75 72 6e 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 | turn.this.webViewImpl.webviewNod |
3f7e0 | 65 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 29 20 21 3d 3d 20 27 66 | e.getAttribute(this.name).!==.'f |
3f800 | 61 6c 73 65 27 0a 20 20 7d 0a 0a 20 20 73 65 74 56 61 6c 75 65 20 28 76 61 6c 75 65 29 20 7b 0a | alse'...}....setValue.(value).{. |
3f820 | 20 20 20 20 74 68 69 73 2e 77 65 62 56 69 65 77 49 6d 70 6c 2e 77 65 62 76 69 65 77 4e 6f 64 65 | ....this.webViewImpl.webviewNode |
3f840 | 2e 73 65 74 41 74 74 72 69 62 75 74 65 28 74 68 69 73 2e 6e 61 6d 65 2c 20 76 61 6c 75 65 20 3f | .setAttribute(this.name,.value.? |
3f860 | 20 27 74 72 75 65 27 20 3a 20 27 66 61 6c 73 65 27 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 53 65 74 | .'true'.:.'false')...}.}..//.Set |
3f880 | 73 20 75 70 20 61 6c 6c 20 6f 66 20 74 68 65 20 77 65 62 76 69 65 77 20 61 74 74 72 69 62 75 74 | s.up.all.of.the.webview.attribut |
3f8a0 | 65 73 2e 0a 57 65 62 56 69 65 77 49 6d 70 6c 2e 70 72 6f 74 6f 74 79 70 65 2e 73 65 74 75 70 57 | es..WebViewImpl.prototype.setupW |
3f8c0 | 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b | ebViewAttributes.=.function.().{ |
3f8e0 | 0a 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 20 3d 20 7b 7d 0a 20 20 74 68 69 73 2e 61 | ...this.attributes.=.{}...this.a |
3f900 | 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 | ttributes[webViewConstants.ATTRI |
3f920 | 42 55 54 45 5f 50 41 52 54 49 54 49 4f 4e 5d 20 3d 20 6e 65 77 20 50 61 72 74 69 74 69 6f 6e 41 | BUTE_PARTITION].=.new.PartitionA |
3f940 | 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 | ttribute(this)...this.attributes |
3f960 | 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 53 52 43 5d | [webViewConstants.ATTRIBUTE_SRC] |
3f980 | 20 3d 20 6e 65 77 20 53 72 63 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 74 68 69 73 | .=.new.SrcAttribute(this)...this |
3f9a0 | 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 | .attributes[webViewConstants.ATT |
3f9c0 | 52 49 42 55 54 45 5f 48 54 54 50 52 45 46 45 52 52 45 52 5d 20 3d 20 6e 65 77 20 48 74 74 70 52 | RIBUTE_HTTPREFERRER].=.new.HttpR |
3f9e0 | 65 66 65 72 72 65 72 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 74 | eferrerAttribute(this)...this.at |
3fa00 | 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 | tributes[webViewConstants.ATTRIB |
3fa20 | 55 54 45 5f 55 53 45 52 41 47 45 4e 54 5d 20 3d 20 6e 65 77 20 55 73 65 72 41 67 65 6e 74 41 74 | UTE_USERAGENT].=.new.UserAgentAt |
3fa40 | 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b | tribute(this)...this.attributes[ |
3fa60 | 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 4e 4f 44 45 49 | webViewConstants.ATTRIBUTE_NODEI |
3fa80 | 4e 54 45 47 52 41 54 49 4f 4e 5d 20 3d 20 6e 65 77 20 42 6f 6f 6c 65 61 6e 41 74 74 72 69 62 75 | NTEGRATION].=.new.BooleanAttribu |
3faa0 | 74 65 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 4e 4f | te(webViewConstants.ATTRIBUTE_NO |
3fac0 | 44 45 49 4e 54 45 47 52 41 54 49 4f 4e 2c 20 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 74 74 72 | DEINTEGRATION,.this)...this.attr |
3fae0 | 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 | ibutes[webViewConstants.ATTRIBUT |
3fb00 | 45 5f 50 4c 55 47 49 4e 53 5d 20 3d 20 6e 65 77 20 42 6f 6f 6c 65 61 6e 41 74 74 72 69 62 75 74 | E_PLUGINS].=.new.BooleanAttribut |
3fb20 | 65 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 50 4c 55 | e(webViewConstants.ATTRIBUTE_PLU |
3fb40 | 47 49 4e 53 2c 20 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 | GINS,.this)...this.attributes[we |
3fb60 | 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 44 49 53 41 42 4c 45 | bViewConstants.ATTRIBUTE_DISABLE |
3fb80 | 57 45 42 53 45 43 55 52 49 54 59 5d 20 3d 20 6e 65 77 20 42 6f 6f 6c 65 61 6e 41 74 74 72 69 62 | WEBSECURITY].=.new.BooleanAttrib |
3fba0 | 75 74 65 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 44 | ute(webViewConstants.ATTRIBUTE_D |
3fbc0 | 49 53 41 42 4c 45 57 45 42 53 45 43 55 52 49 54 59 2c 20 74 68 69 73 29 0a 20 20 74 68 69 73 2e | ISABLEWEBSECURITY,.this)...this. |
3fbe0 | 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 | attributes[webViewConstants.ATTR |
3fc00 | 49 42 55 54 45 5f 41 4c 4c 4f 57 50 4f 50 55 50 53 5d 20 3d 20 6e 65 77 20 42 6f 6f 6c 65 61 6e | IBUTE_ALLOWPOPUPS].=.new.Boolean |
3fc20 | 41 74 74 72 69 62 75 74 65 28 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 | Attribute(webViewConstants.ATTRI |
3fc40 | 42 55 54 45 5f 41 4c 4c 4f 57 50 4f 50 55 50 53 2c 20 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 | BUTE_ALLOWPOPUPS,.this)...this.a |
3fc60 | 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 | ttributes[webViewConstants.ATTRI |
3fc80 | 42 55 54 45 5f 45 4e 41 42 4c 45 52 45 4d 4f 54 45 4d 4f 44 55 4c 45 5d 20 3d 20 6e 65 77 20 45 | BUTE_ENABLEREMOTEMODULE].=.new.E |
3fca0 | 6e 61 62 6c 65 52 65 6d 6f 74 65 4d 6f 64 75 6c 65 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 | nableRemoteModuleAttribute(this) |
3fcc0 | 0a 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 | ...this.attributes[webViewConsta |
3fce0 | 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 50 52 45 4c 4f 41 44 5d 20 3d 20 6e 65 77 20 50 72 65 | nts.ATTRIBUTE_PRELOAD].=.new.Pre |
3fd00 | 6c 6f 61 64 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 74 74 72 69 | loadAttribute(this)...this.attri |
3fd20 | 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 | butes[webViewConstants.ATTRIBUTE |
3fd40 | 5f 42 4c 49 4e 4b 46 45 41 54 55 52 45 53 5d 20 3d 20 6e 65 77 20 42 6c 69 6e 6b 46 65 61 74 75 | _BLINKFEATURES].=.new.BlinkFeatu |
3fd60 | 72 65 73 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a 20 20 74 68 69 73 2e 61 74 74 72 69 62 | resAttribute(this)...this.attrib |
3fd80 | 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f | utes[webViewConstants.ATTRIBUTE_ |
3fda0 | 44 49 53 41 42 4c 45 42 4c 49 4e 4b 46 45 41 54 55 52 45 53 5d 20 3d 20 6e 65 77 20 44 69 73 61 | DISABLEBLINKFEATURES].=.new.Disa |
3fdc0 | 62 6c 65 42 6c 69 6e 6b 46 65 61 74 75 72 65 73 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 0a | bleBlinkFeaturesAttribute(this). |
3fde0 | 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e | ..this.attributes[webViewConstan |
3fe00 | 74 73 2e 41 54 54 52 49 42 55 54 45 5f 57 45 42 50 52 45 46 45 52 45 4e 43 45 53 5d 20 3d 20 6e | ts.ATTRIBUTE_WEBPREFERENCES].=.n |
3fe20 | 65 77 20 57 65 62 50 72 65 66 65 72 65 6e 63 65 73 41 74 74 72 69 62 75 74 65 28 74 68 69 73 29 | ew.WebPreferencesAttribute(this) |
3fe40 | 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 | .}.'use.strict'..module.exports. |
3fe60 | 3d 20 7b 0a 20 20 2f 2f 20 41 74 74 72 69 62 75 74 65 73 2e 0a 20 20 41 54 54 52 49 42 55 54 45 | =.{...//.Attributes....ATTRIBUTE |
3fe80 | 5f 4e 41 4d 45 3a 20 27 6e 61 6d 65 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 50 41 52 54 49 | _NAME:.'name',...ATTRIBUTE_PARTI |
3fea0 | 54 49 4f 4e 3a 20 27 70 61 72 74 69 74 69 6f 6e 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 53 | TION:.'partition',...ATTRIBUTE_S |
3fec0 | 52 43 3a 20 27 73 72 63 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 48 54 54 50 52 45 46 45 52 | RC:.'src',...ATTRIBUTE_HTTPREFER |
3fee0 | 52 45 52 3a 20 27 68 74 74 70 72 65 66 65 72 72 65 72 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 | RER:.'httpreferrer',...ATTRIBUTE |
3ff00 | 5f 4e 4f 44 45 49 4e 54 45 47 52 41 54 49 4f 4e 3a 20 27 6e 6f 64 65 69 6e 74 65 67 72 61 74 69 | _NODEINTEGRATION:.'nodeintegrati |
3ff20 | 6f 6e 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 45 4e 41 42 4c 45 52 45 4d 4f 54 45 4d 4f 44 | on',...ATTRIBUTE_ENABLEREMOTEMOD |
3ff40 | 55 4c 45 3a 20 27 65 6e 61 62 6c 65 72 65 6d 6f 74 65 6d 6f 64 75 6c 65 27 2c 0a 20 20 41 54 54 | ULE:.'enableremotemodule',...ATT |
3ff60 | 52 49 42 55 54 45 5f 50 4c 55 47 49 4e 53 3a 20 27 70 6c 75 67 69 6e 73 27 2c 0a 20 20 41 54 54 | RIBUTE_PLUGINS:.'plugins',...ATT |
3ff80 | 52 49 42 55 54 45 5f 44 49 53 41 42 4c 45 57 45 42 53 45 43 55 52 49 54 59 3a 20 27 64 69 73 61 | RIBUTE_DISABLEWEBSECURITY:.'disa |
3ffa0 | 62 6c 65 77 65 62 73 65 63 75 72 69 74 79 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 41 4c 4c | blewebsecurity',...ATTRIBUTE_ALL |
3ffc0 | 4f 57 50 4f 50 55 50 53 3a 20 27 61 6c 6c 6f 77 70 6f 70 75 70 73 27 2c 0a 20 20 41 54 54 52 49 | OWPOPUPS:.'allowpopups',...ATTRI |
3ffe0 | 42 55 54 45 5f 50 52 45 4c 4f 41 44 3a 20 27 70 72 65 6c 6f 61 64 27 2c 0a 20 20 41 54 54 52 49 | BUTE_PRELOAD:.'preload',...ATTRI |
40000 | 42 55 54 45 5f 55 53 45 52 41 47 45 4e 54 3a 20 27 75 73 65 72 61 67 65 6e 74 27 2c 0a 20 20 41 | BUTE_USERAGENT:.'useragent',...A |
40020 | 54 54 52 49 42 55 54 45 5f 42 4c 49 4e 4b 46 45 41 54 55 52 45 53 3a 20 27 62 6c 69 6e 6b 66 65 | TTRIBUTE_BLINKFEATURES:.'blinkfe |
40040 | 61 74 75 72 65 73 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 44 49 53 41 42 4c 45 42 4c 49 4e | atures',...ATTRIBUTE_DISABLEBLIN |
40060 | 4b 46 45 41 54 55 52 45 53 3a 20 27 64 69 73 61 62 6c 65 62 6c 69 6e 6b 66 65 61 74 75 72 65 73 | KFEATURES:.'disableblinkfeatures |
40080 | 27 2c 0a 20 20 41 54 54 52 49 42 55 54 45 5f 57 45 42 50 52 45 46 45 52 45 4e 43 45 53 3a 20 27 | ',...ATTRIBUTE_WEBPREFERENCES:.' |
400a0 | 77 65 62 70 72 65 66 65 72 65 6e 63 65 73 27 2c 0a 0a 20 20 2f 2f 20 49 6e 74 65 72 6e 61 6c 20 | webpreferences',....//.Internal. |
400c0 | 61 74 74 72 69 62 75 74 65 2e 0a 20 20 41 54 54 52 49 42 55 54 45 5f 49 4e 54 45 52 4e 41 4c 49 | attribute....ATTRIBUTE_INTERNALI |
400e0 | 4e 53 54 41 4e 43 45 49 44 3a 20 27 69 6e 74 65 72 6e 61 6c 69 6e 73 74 61 6e 63 65 69 64 27 2c | NSTANCEID:.'internalinstanceid', |
40100 | 0a 0a 20 20 2f 2f 20 45 72 72 6f 72 20 6d 65 73 73 61 67 65 73 2e 0a 20 20 45 52 52 4f 52 5f 4d | ....//.Error.messages....ERROR_M |
40120 | 53 47 5f 41 4c 52 45 41 44 59 5f 4e 41 56 49 47 41 54 45 44 3a 20 27 54 68 65 20 6f 62 6a 65 63 | SG_ALREADY_NAVIGATED:.'The.objec |
40140 | 74 20 68 61 73 20 61 6c 72 65 61 64 79 20 6e 61 76 69 67 61 74 65 64 2c 20 73 6f 20 69 74 73 20 | t.has.already.navigated,.so.its. |
40160 | 70 61 72 74 69 74 69 6f 6e 20 63 61 6e 6e 6f 74 20 62 65 20 63 68 61 6e 67 65 64 2e 27 2c 0a 20 | partition.cannot.be.changed.',.. |
40180 | 20 45 52 52 4f 52 5f 4d 53 47 5f 43 41 4e 4e 4f 54 5f 49 4e 4a 45 43 54 5f 53 43 52 49 50 54 3a | .ERROR_MSG_CANNOT_INJECT_SCRIPT: |
401a0 | 20 27 3c 77 65 62 76 69 65 77 3e 3a 20 27 20 2b 20 27 53 63 72 69 70 74 20 63 61 6e 6e 6f 74 20 | .'<webview>:.'.+.'Script.cannot. |
401c0 | 62 65 20 69 6e 6a 65 63 74 65 64 20 69 6e 74 6f 20 63 6f 6e 74 65 6e 74 20 75 6e 74 69 6c 20 74 | be.injected.into.content.until.t |
401e0 | 68 65 20 70 61 67 65 20 68 61 73 20 6c 6f 61 64 65 64 2e 27 2c 0a 20 20 45 52 52 4f 52 5f 4d 53 | he.page.has.loaded.',...ERROR_MS |
40200 | 47 5f 49 4e 56 41 4c 49 44 5f 50 41 52 54 49 54 49 4f 4e 5f 41 54 54 52 49 42 55 54 45 3a 20 27 | G_INVALID_PARTITION_ATTRIBUTE:.' |
40220 | 49 6e 76 61 6c 69 64 20 70 61 72 74 69 74 69 6f 6e 20 61 74 74 72 69 62 75 74 65 2e 27 2c 0a 20 | Invalid.partition.attribute.',.. |
40240 | 20 45 52 52 4f 52 5f 4d 53 47 5f 49 4e 56 41 4c 49 44 5f 50 52 45 4c 4f 41 44 5f 41 54 54 52 49 | .ERROR_MSG_INVALID_PRELOAD_ATTRI |
40260 | 42 55 54 45 3a 20 27 4f 6e 6c 79 20 22 66 69 6c 65 3a 22 20 70 72 6f 74 6f 63 6f 6c 20 69 73 20 | BUTE:.'Only."file:".protocol.is. |
40280 | 73 75 70 70 6f 72 74 65 64 20 69 6e 20 22 70 72 65 6c 6f 61 64 22 20 61 74 74 72 69 62 75 74 65 | supported.in."preload".attribute |
402a0 | 2e 27 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 63 6f 6e 73 74 20 7b 20 77 65 62 46 72 | .'.}.'use.strict'..const.{.webFr |
402c0 | 61 6d 65 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 65 6c 65 63 74 72 6f 6e 27 29 0a 0a 63 6f 6e | ame.}.=.require('electron')..con |
402e0 | 73 74 20 76 38 55 74 69 6c 20 3d 20 70 72 6f 63 65 73 73 2e 61 74 6f 6d 42 69 6e 64 69 6e 67 28 | st.v8Util.=.process.atomBinding( |
40300 | 27 76 38 5f 75 74 69 6c 27 29 0a 63 6f 6e 73 74 20 69 70 63 52 65 6e 64 65 72 65 72 20 3d 20 72 | 'v8_util').const.ipcRenderer.=.r |
40320 | 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 | equire('@electron/internal/rende |
40340 | 72 65 72 2f 69 70 63 2d 72 65 6e 64 65 72 65 72 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 63 6f 6e 73 | rer/ipc-renderer-internal').cons |
40360 | 74 20 67 75 65 73 74 56 69 65 77 49 6e 74 65 72 6e 61 6c 20 3d 20 72 65 71 75 69 72 65 28 27 40 | t.guestViewInternal.=.require('@ |
40380 | 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 77 65 62 2d 76 | electron/internal/renderer/web-v |
403a0 | 69 65 77 2f 67 75 65 73 74 2d 76 69 65 77 2d 69 6e 74 65 72 6e 61 6c 27 29 0a 63 6f 6e 73 74 20 | iew/guest-view-internal').const. |
403c0 | 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 | webViewConstants.=.require('@ele |
403e0 | 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e 64 65 72 65 72 2f 77 65 62 2d 76 69 65 77 | ctron/internal/renderer/web-view |
40400 | 2f 77 65 62 2d 76 69 65 77 2d 63 6f 6e 73 74 61 6e 74 73 27 29 0a 63 6f 6e 73 74 20 65 72 72 6f | /web-view-constants').const.erro |
40420 | 72 55 74 69 6c 73 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 | rUtils.=.require('@electron/inte |
40440 | 72 6e 61 6c 2f 63 6f 6d 6d 6f 6e 2f 65 72 72 6f 72 2d 75 74 69 6c 73 27 29 0a 63 6f 6e 73 74 20 | rnal/common/error-utils').const. |
40460 | 7b 0a 20 20 73 79 6e 63 4d 65 74 68 6f 64 73 2c 0a 20 20 61 73 79 6e 63 43 61 6c 6c 62 61 63 6b | {...syncMethods,...asyncCallback |
40480 | 4d 65 74 68 6f 64 73 2c 0a 20 20 61 73 79 6e 63 50 72 6f 6d 69 73 65 4d 65 74 68 6f 64 73 0a 7d | Methods,...asyncPromiseMethods.} |
404a0 | 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 | .=.require('@electron/internal/c |
404c0 | 6f 6d 6d 6f 6e 2f 77 65 62 2d 76 69 65 77 2d 6d 65 74 68 6f 64 73 27 29 0a 0a 2f 2f 20 49 44 20 | ommon/web-view-methods')..//.ID. |
404e0 | 67 65 6e 65 72 61 74 6f 72 2e 0a 6c 65 74 20 6e 65 78 74 49 64 20 3d 20 30 0a 0a 63 6f 6e 73 74 | generator..let.nextId.=.0..const |
40500 | 20 67 65 74 4e 65 78 74 49 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 72 65 74 | .getNextId.=.function.().{...ret |
40520 | 75 72 6e 20 2b 2b 6e 65 78 74 49 64 0a 7d 0a 0a 2f 2f 20 52 65 70 72 65 73 65 6e 74 73 20 74 68 | urn.++nextId.}..//.Represents.th |
40540 | 65 20 69 6e 74 65 72 6e 61 6c 20 73 74 61 74 65 20 6f 66 20 74 68 65 20 57 65 62 56 69 65 77 20 | e.internal.state.of.the.WebView. |
40560 | 6e 6f 64 65 2e 0a 63 6c 61 73 73 20 57 65 62 56 69 65 77 49 6d 70 6c 20 7b 0a 20 20 63 6f 6e 73 | node..class.WebViewImpl.{...cons |
40580 | 74 72 75 63 74 6f 72 20 28 77 65 62 76 69 65 77 4e 6f 64 65 29 20 7b 0a 20 20 20 20 74 68 69 73 | tructor.(webviewNode).{.....this |
405a0 | 2e 77 65 62 76 69 65 77 4e 6f 64 65 20 3d 20 77 65 62 76 69 65 77 4e 6f 64 65 0a 20 20 20 20 76 | .webviewNode.=.webviewNode.....v |
405c0 | 38 55 74 69 6c 2e 73 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 74 68 69 73 2e 77 65 62 76 69 65 | 8Util.setHiddenValue(this.webvie |
405e0 | 77 4e 6f 64 65 2c 20 27 69 6e 74 65 72 6e 61 6c 27 2c 20 74 68 69 73 29 0a 20 20 20 20 74 68 69 | wNode,.'internal',.this).....thi |
40600 | 73 2e 65 6c 65 6d 65 6e 74 41 74 74 61 63 68 65 64 20 3d 20 66 61 6c 73 65 0a 20 20 20 20 74 68 | s.elementAttached.=.false.....th |
40620 | 69 73 2e 62 65 66 6f 72 65 46 69 72 73 74 4e 61 76 69 67 61 74 69 6f 6e 20 3d 20 74 72 75 65 0a | is.beforeFirstNavigation.=.true. |
40640 | 20 20 20 20 74 68 69 73 2e 68 61 73 46 6f 63 75 73 20 3d 20 66 61 6c 73 65 0a 0a 20 20 20 20 2f | ....this.hasFocus.=.false....../ |
40660 | 2f 20 6f 6e 2a 20 45 76 65 6e 74 20 68 61 6e 64 6c 65 72 73 2e 0a 20 20 20 20 74 68 69 73 2e 6f | /.on*.Event.handlers......this.o |
40680 | 6e 20 3d 20 7b 7d 0a 0a 20 20 20 20 2f 2f 20 43 72 65 61 74 65 20 69 6e 74 65 72 6e 61 6c 20 69 | n.=.{}......//.Create.internal.i |
406a0 | 66 72 61 6d 65 20 65 6c 65 6d 65 6e 74 2e 0a 20 20 20 20 74 68 69 73 2e 69 6e 74 65 72 6e 61 6c | frame.element......this.internal |
406c0 | 45 6c 65 6d 65 6e 74 20 3d 20 74 68 69 73 2e 63 72 65 61 74 65 49 6e 74 65 72 6e 61 6c 45 6c 65 | Element.=.this.createInternalEle |
406e0 | 6d 65 6e 74 28 29 0a 20 20 20 20 63 6f 6e 73 74 20 73 68 61 64 6f 77 52 6f 6f 74 20 3d 20 74 68 | ment().....const.shadowRoot.=.th |
40700 | 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 61 74 74 61 63 68 53 68 61 64 6f 77 28 7b 20 6d 6f | is.webviewNode.attachShadow({.mo |
40720 | 64 65 3a 20 27 6f 70 65 6e 27 20 7d 29 0a 20 20 20 20 73 68 61 64 6f 77 52 6f 6f 74 2e 69 6e 6e | de:.'open'.}).....shadowRoot.inn |
40740 | 65 72 48 54 4d 4c 20 3d 20 27 3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 3e 3c 73 74 79 6c 65 20 | erHTML.=.'<!DOCTYPE.html><style. |
40760 | 74 79 70 65 3d 22 74 65 78 74 2f 63 73 73 22 3e 3a 68 6f 73 74 20 7b 20 64 69 73 70 6c 61 79 3a | type="text/css">:host.{.display: |
40780 | 20 66 6c 65 78 3b 20 7d 3c 2f 73 74 79 6c 65 3e 27 0a 20 20 20 20 74 68 69 73 2e 73 65 74 75 70 | .flex;.}</style>'.....this.setup |
407a0 | 57 65 62 56 69 65 77 41 74 74 72 69 62 75 74 65 73 28 29 0a 20 20 20 20 74 68 69 73 2e 76 69 65 | WebViewAttributes().....this.vie |
407c0 | 77 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 67 65 74 4e 65 78 74 49 64 28 29 0a 20 20 20 20 73 68 | wInstanceId.=.getNextId().....sh |
407e0 | 61 64 6f 77 52 6f 6f 74 2e 61 70 70 65 6e 64 43 68 69 6c 64 28 74 68 69 73 2e 69 6e 74 65 72 6e | adowRoot.appendChild(this.intern |
40800 | 61 6c 45 6c 65 6d 65 6e 74 29 0a 0a 20 20 20 20 2f 2f 20 50 72 6f 76 69 64 65 20 61 63 63 65 73 | alElement)......//.Provide.acces |
40820 | 73 20 74 6f 20 63 6f 6e 74 65 6e 74 57 69 6e 64 6f 77 2e 0a 20 20 20 20 4f 62 6a 65 63 74 2e 64 | s.to.contentWindow......Object.d |
40840 | 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2c 20 | efineProperty(this.webviewNode,. |
40860 | 27 63 6f 6e 74 65 6e 74 57 69 6e 64 6f 77 27 2c 20 7b 0a 20 20 20 20 20 20 67 65 74 3a 20 28 29 | 'contentWindow',.{.......get:.() |
40880 | 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 69 6e 74 65 72 6e | .=>.{.........return.this.intern |
408a0 | 61 6c 45 6c 65 6d 65 6e 74 2e 63 6f 6e 74 65 6e 74 57 69 6e 64 6f 77 0a 20 20 20 20 20 20 7d 2c | alElement.contentWindow.......}, |
408c0 | 0a 20 20 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 0a 20 20 20 20 7d 29 0a 20 | .......enumerable:.true.....}).. |
408e0 | 20 7d 0a 0a 20 20 63 72 65 61 74 65 49 6e 74 65 72 6e 61 6c 45 6c 65 6d 65 6e 74 20 28 29 20 7b | .}....createInternalElement.().{ |
40900 | 0a 20 20 20 20 63 6f 6e 73 74 20 69 66 72 61 6d 65 45 6c 65 6d 65 6e 74 20 3d 20 64 6f 63 75 6d | .....const.iframeElement.=.docum |
40920 | 65 6e 74 2e 63 72 65 61 74 65 45 6c 65 6d 65 6e 74 28 27 69 66 72 61 6d 65 27 29 0a 20 20 20 20 | ent.createElement('iframe')..... |
40940 | 69 66 72 61 6d 65 45 6c 65 6d 65 6e 74 2e 73 74 79 6c 65 2e 66 6c 65 78 20 3d 20 27 31 20 31 20 | iframeElement.style.flex.=.'1.1. |
40960 | 61 75 74 6f 27 0a 20 20 20 20 69 66 72 61 6d 65 45 6c 65 6d 65 6e 74 2e 73 74 79 6c 65 2e 77 69 | auto'.....iframeElement.style.wi |
40980 | 64 74 68 20 3d 20 27 31 30 30 25 27 0a 20 20 20 20 69 66 72 61 6d 65 45 6c 65 6d 65 6e 74 2e 73 | dth.=.'100%'.....iframeElement.s |
409a0 | 74 79 6c 65 2e 62 6f 72 64 65 72 20 3d 20 27 30 27 0a 20 20 20 20 76 38 55 74 69 6c 2e 73 65 74 | tyle.border.=.'0'.....v8Util.set |
409c0 | 48 69 64 64 65 6e 56 61 6c 75 65 28 69 66 72 61 6d 65 45 6c 65 6d 65 6e 74 2c 20 27 69 6e 74 65 | HiddenValue(iframeElement,.'inte |
409e0 | 72 6e 61 6c 27 2c 20 74 68 69 73 29 0a 20 20 20 20 72 65 74 75 72 6e 20 69 66 72 61 6d 65 45 6c | rnal',.this).....return.iframeEl |
40a00 | 65 6d 65 6e 74 0a 20 20 7d 0a 0a 20 20 2f 2f 20 52 65 73 65 74 73 20 73 6f 6d 65 20 73 74 61 74 | ement...}....//.Resets.some.stat |
40a20 | 65 20 75 70 6f 6e 20 72 65 61 74 74 61 63 68 69 6e 67 20 3c 77 65 62 76 69 65 77 3e 20 65 6c 65 | e.upon.reattaching.<webview>.ele |
40a40 | 6d 65 6e 74 20 74 6f 20 74 68 65 20 44 4f 4d 2e 0a 20 20 72 65 73 65 74 20 28 29 20 7b 0a 20 20 | ment.to.the.DOM....reset.().{... |
40a60 | 20 20 2f 2f 20 49 66 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 69 73 20 64 65 66 69 6e | ..//.If.guestInstanceId.is.defin |
40a80 | 65 64 20 74 68 65 6e 20 74 68 65 20 3c 77 65 62 76 69 65 77 3e 20 68 61 73 20 6e 61 76 69 67 61 | ed.then.the.<webview>.has.naviga |
40aa0 | 74 65 64 20 61 6e 64 20 68 61 73 0a 20 20 20 20 2f 2f 20 61 6c 72 65 61 64 79 20 70 69 63 6b 65 | ted.and.has.....//.already.picke |
40ac0 | 64 20 75 70 20 61 20 70 61 72 74 69 74 69 6f 6e 20 49 44 2e 20 54 68 75 73 2c 20 77 65 20 6e 65 | d.up.a.partition.ID..Thus,.we.ne |
40ae0 | 65 64 20 74 6f 20 72 65 73 65 74 20 74 68 65 20 69 6e 69 74 69 61 6c 69 7a 61 74 69 6f 6e 0a 20 | ed.to.reset.the.initialization.. |
40b00 | 20 20 20 2f 2f 20 73 74 61 74 65 2e 20 48 6f 77 65 76 65 72 2c 20 69 74 20 6d 61 79 20 62 65 20 | ...//.state..However,.it.may.be. |
40b20 | 74 68 65 20 63 61 73 65 20 74 68 61 74 20 62 65 66 6f 72 65 46 69 72 73 74 4e 61 76 69 67 61 74 | the.case.that.beforeFirstNavigat |
40b40 | 69 6f 6e 20 69 73 20 66 61 6c 73 65 20 42 55 54 0a 20 20 20 20 2f 2f 20 67 75 65 73 74 49 6e 73 | ion.is.false.BUT.....//.guestIns |
40b60 | 74 61 6e 63 65 49 64 20 68 61 73 20 79 65 74 20 74 6f 20 62 65 20 69 6e 69 74 69 61 6c 69 7a 65 | tanceId.has.yet.to.be.initialize |
40b80 | 64 2e 20 54 68 69 73 20 6d 65 61 6e 73 20 74 68 61 74 20 77 65 20 68 61 76 65 20 6e 6f 74 0a 20 | d..This.means.that.we.have.not.. |
40ba0 | 20 20 20 2f 2f 20 68 65 61 72 64 20 62 61 63 6b 20 66 72 6f 6d 20 63 72 65 61 74 65 47 75 65 73 | ...//.heard.back.from.createGues |
40bc0 | 74 20 79 65 74 2e 20 57 65 20 77 69 6c 6c 20 6e 6f 74 20 72 65 73 65 74 20 74 68 65 20 66 6c 61 | t.yet..We.will.not.reset.the.fla |
40be0 | 67 20 69 6e 20 74 68 69 73 20 63 61 73 65 20 73 6f 0a 20 20 20 20 2f 2f 20 74 68 61 74 20 77 65 | g.in.this.case.so.....//.that.we |
40c00 | 20 64 6f 6e 27 74 20 65 6e 64 20 75 70 20 61 6c 6c 6f 63 61 74 69 6e 67 20 61 20 73 65 63 6f 6e | .don't.end.up.allocating.a.secon |
40c20 | 64 20 67 75 65 73 74 2e 0a 20 20 20 20 69 66 20 28 74 68 69 73 2e 67 75 65 73 74 49 6e 73 74 61 | d.guest......if.(this.guestInsta |
40c40 | 6e 63 65 49 64 29 20 7b 0a 20 20 20 20 20 20 67 75 65 73 74 56 69 65 77 49 6e 74 65 72 6e 61 6c | nceId).{.......guestViewInternal |
40c60 | 2e 64 65 73 74 72 6f 79 47 75 65 73 74 28 74 68 69 73 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 | .destroyGuest(this.guestInstance |
40c80 | 49 64 29 0a 20 20 20 20 20 20 74 68 69 73 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d | Id).......this.guestInstanceId.= |
40ca0 | 20 76 6f 69 64 20 30 0a 20 20 20 20 7d 0a 0a 20 20 20 20 74 68 69 73 2e 62 65 66 6f 72 65 46 69 | .void.0.....}......this.beforeFi |
40cc0 | 72 73 74 4e 61 76 69 67 61 74 69 6f 6e 20 3d 20 74 72 75 65 0a 20 20 20 20 74 68 69 73 2e 61 74 | rstNavigation.=.true.....this.at |
40ce0 | 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 | tributes[webViewConstants.ATTRIB |
40d00 | 55 54 45 5f 50 41 52 54 49 54 49 4f 4e 5d 2e 76 61 6c 69 64 50 61 72 74 69 74 69 6f 6e 49 64 20 | UTE_PARTITION].validPartitionId. |
40d20 | 3d 20 74 72 75 65 0a 0a 20 20 20 20 2f 2f 20 53 69 6e 63 65 20 61 74 74 61 63 68 6d 65 6e 74 20 | =.true......//.Since.attachment. |
40d40 | 73 77 61 70 73 20 61 20 6c 6f 63 61 6c 20 66 72 61 6d 65 20 66 6f 72 20 61 20 72 65 6d 6f 74 65 | swaps.a.local.frame.for.a.remote |
40d60 | 20 66 72 61 6d 65 2c 20 77 65 20 6e 65 65 64 20 6f 75 72 0a 20 20 20 20 2f 2f 20 69 6e 74 65 72 | .frame,.we.need.our.....//.inter |
40d80 | 6e 61 6c 20 69 66 72 61 6d 65 20 65 6c 65 6d 65 6e 74 20 74 6f 20 62 65 20 6c 6f 63 61 6c 20 61 | nal.iframe.element.to.be.local.a |
40da0 | 67 61 69 6e 20 62 65 66 6f 72 65 20 77 65 20 63 61 6e 20 72 65 61 74 74 61 63 68 2e 0a 20 20 20 | gain.before.we.can.reattach..... |
40dc0 | 20 63 6f 6e 73 74 20 6e 65 77 46 72 61 6d 65 20 3d 20 74 68 69 73 2e 63 72 65 61 74 65 49 6e 74 | .const.newFrame.=.this.createInt |
40de0 | 65 72 6e 61 6c 45 6c 65 6d 65 6e 74 28 29 0a 20 20 20 20 63 6f 6e 73 74 20 6f 6c 64 46 72 61 6d | ernalElement().....const.oldFram |
40e00 | 65 20 3d 20 74 68 69 73 2e 69 6e 74 65 72 6e 61 6c 45 6c 65 6d 65 6e 74 0a 20 20 20 20 74 68 69 | e.=.this.internalElement.....thi |
40e20 | 73 2e 69 6e 74 65 72 6e 61 6c 45 6c 65 6d 65 6e 74 20 3d 20 6e 65 77 46 72 61 6d 65 0a 20 20 20 | s.internalElement.=.newFrame.... |
40e40 | 20 6f 6c 64 46 72 61 6d 65 2e 70 61 72 65 6e 74 4e 6f 64 65 2e 72 65 70 6c 61 63 65 43 68 69 6c | .oldFrame.parentNode.replaceChil |
40e60 | 64 28 6e 65 77 46 72 61 6d 65 2c 20 6f 6c 64 46 72 61 6d 65 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 | d(newFrame,.oldFrame)...}....//. |
40e80 | 53 65 74 73 20 74 68 65 20 3c 77 65 62 76 69 65 77 3e 2e 72 65 71 75 65 73 74 20 70 72 6f 70 65 | Sets.the.<webview>.request.prope |
40ea0 | 72 74 79 2e 0a 20 20 73 65 74 52 65 71 75 65 73 74 50 72 6f 70 65 72 74 79 4f 6e 57 65 62 56 69 | rty....setRequestPropertyOnWebVi |
40ec0 | 65 77 4e 6f 64 65 20 28 72 65 71 75 65 73 74 29 20 7b 0a 20 20 20 20 4f 62 6a 65 63 74 2e 64 65 | ewNode.(request).{.....Object.de |
40ee0 | 66 69 6e 65 50 72 6f 70 65 72 74 79 28 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2c 20 27 | fineProperty(this.webviewNode,.' |
40f00 | 72 65 71 75 65 73 74 27 2c 20 7b 0a 20 20 20 20 20 20 76 61 6c 75 65 3a 20 72 65 71 75 65 73 74 | request',.{.......value:.request |
40f20 | 2c 0a 20 20 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 0a 20 20 20 20 7d 29 0a | ,.......enumerable:.true.....}). |
40f40 | 20 20 7d 0a 0a 20 20 2f 2f 20 54 68 69 73 20 6f 62 73 65 72 76 65 72 20 6d 6f 6e 69 74 6f 72 73 | ..}....//.This.observer.monitors |
40f60 | 20 6d 75 74 61 74 69 6f 6e 73 20 74 6f 20 61 74 74 72 69 62 75 74 65 73 20 6f 66 20 74 68 65 20 | .mutations.to.attributes.of.the. |
40f80 | 3c 77 65 62 76 69 65 77 3e 20 61 6e 64 0a 20 20 2f 2f 20 75 70 64 61 74 65 73 20 74 68 65 20 42 | <webview>.and...//.updates.the.B |
40fa0 | 72 6f 77 73 65 72 50 6c 75 67 69 6e 20 70 72 6f 70 65 72 74 69 65 73 20 61 63 63 6f 72 64 69 6e | rowserPlugin.properties.accordin |
40fc0 | 67 6c 79 2e 20 49 6e 20 74 75 72 6e 2c 20 75 70 64 61 74 69 6e 67 0a 20 20 2f 2f 20 61 20 42 72 | gly..In.turn,.updating...//.a.Br |
40fe0 | 6f 77 73 65 72 50 6c 75 67 69 6e 20 70 72 6f 70 65 72 74 79 20 77 69 6c 6c 20 75 70 64 61 74 65 | owserPlugin.property.will.update |
41000 | 20 74 68 65 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 42 72 6f 77 73 65 72 50 6c 75 67 69 6e | .the.corresponding.BrowserPlugin |
41020 | 0a 20 20 2f 2f 20 61 74 74 72 69 62 75 74 65 2c 20 69 66 20 6e 65 63 65 73 73 61 72 79 2e 20 53 | ...//.attribute,.if.necessary..S |
41040 | 65 65 20 42 72 6f 77 73 65 72 50 6c 75 67 69 6e 3a 3a 55 70 64 61 74 65 44 4f 4d 41 74 74 72 69 | ee.BrowserPlugin::UpdateDOMAttri |
41060 | 62 75 74 65 20 66 6f 72 20 6d 6f 72 65 0a 20 20 2f 2f 20 64 65 74 61 69 6c 73 2e 0a 20 20 68 61 | bute.for.more...//.details....ha |
41080 | 6e 64 6c 65 57 65 62 76 69 65 77 41 74 74 72 69 62 75 74 65 4d 75 74 61 74 69 6f 6e 20 28 61 74 | ndleWebviewAttributeMutation.(at |
410a0 | 74 72 69 62 75 74 65 4e 61 6d 65 2c 20 6f 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 6c 75 65 29 | tributeName,.oldValue,.newValue) |
410c0 | 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 61 74 74 72 | .{.....if.(!this.attributes[attr |
410e0 | 69 62 75 74 65 4e 61 6d 65 5d 20 7c 7c 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 61 74 | ibuteName].||.this.attributes[at |
41100 | 74 72 69 62 75 74 65 4e 61 6d 65 5d 2e 69 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 29 20 7b 0a 20 | tributeName].ignoreMutation).{.. |
41120 | 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 0a 20 20 20 20 2f 2f 20 4c 65 74 20 74 68 | .....return.....}......//.Let.th |
41140 | 65 20 63 68 61 6e 67 65 64 20 61 74 74 72 69 62 75 74 65 20 68 61 6e 64 6c 65 20 69 74 73 20 6f | e.changed.attribute.handle.its.o |
41160 | 77 6e 20 6d 75 74 61 74 69 6f 6e 0a 20 20 20 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b | wn.mutation.....this.attributes[ |
41180 | 61 74 74 72 69 62 75 74 65 4e 61 6d 65 5d 2e 68 61 6e 64 6c 65 4d 75 74 61 74 69 6f 6e 28 6f 6c | attributeName].handleMutation(ol |
411a0 | 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 6c 75 65 29 0a 20 20 7d 0a 0a 20 20 6f 6e 45 6c 65 6d 65 | dValue,.newValue)...}....onEleme |
411c0 | 6e 74 52 65 73 69 7a 65 20 28 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 72 65 73 69 7a 65 45 76 | ntResize.().{.....const.resizeEv |
411e0 | 65 6e 74 20 3d 20 6e 65 77 20 45 76 65 6e 74 28 27 72 65 73 69 7a 65 27 29 0a 20 20 20 20 72 65 | ent.=.new.Event('resize').....re |
41200 | 73 69 7a 65 45 76 65 6e 74 2e 6e 65 77 57 69 64 74 68 20 3d 20 74 68 69 73 2e 77 65 62 76 69 65 | sizeEvent.newWidth.=.this.webvie |
41220 | 77 4e 6f 64 65 2e 63 6c 69 65 6e 74 57 69 64 74 68 0a 20 20 20 20 72 65 73 69 7a 65 45 76 65 6e | wNode.clientWidth.....resizeEven |
41240 | 74 2e 6e 65 77 48 65 69 67 68 74 20 3d 20 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 65 2e 63 | t.newHeight.=.this.webviewNode.c |
41260 | 6c 69 65 6e 74 48 65 69 67 68 74 0a 20 20 20 20 74 68 69 73 2e 64 69 73 70 61 74 63 68 45 76 65 | lientHeight.....this.dispatchEve |
41280 | 6e 74 28 72 65 73 69 7a 65 45 76 65 6e 74 29 0a 20 20 7d 0a 0a 20 20 63 72 65 61 74 65 47 75 65 | nt(resizeEvent)...}....createGue |
412a0 | 73 74 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 67 75 65 73 74 56 69 65 77 49 6e 74 65 | st.().{.....return.guestViewInte |
412c0 | 72 6e 61 6c 2e 63 72 65 61 74 65 47 75 65 73 74 28 74 68 69 73 2e 62 75 69 6c 64 50 61 72 61 6d | rnal.createGuest(this.buildParam |
412e0 | 73 28 29 2c 20 28 65 76 65 6e 74 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 3d 3e | s(),.(event,.guestInstanceId).=> |
41300 | 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 61 74 74 61 63 68 47 75 65 73 74 49 6e 73 74 61 6e 63 | .{.......this.attachGuestInstanc |
41320 | 65 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 0a 20 | e(guestInstanceId).....})...}... |
41340 | 20 63 72 65 61 74 65 47 75 65 73 74 53 79 6e 63 20 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 62 | .createGuestSync.().{.....this.b |
41360 | 65 66 6f 72 65 46 69 72 73 74 4e 61 76 69 67 61 74 69 6f 6e 20 3d 20 66 61 6c 73 65 0a 20 20 20 | eforeFirstNavigation.=.false.... |
41380 | 20 74 68 69 73 2e 61 74 74 61 63 68 47 75 65 73 74 49 6e 73 74 61 6e 63 65 28 67 75 65 73 74 56 | .this.attachGuestInstance(guestV |
413a0 | 69 65 77 49 6e 74 65 72 6e 61 6c 2e 63 72 65 61 74 65 47 75 65 73 74 53 79 6e 63 28 74 68 69 73 | iewInternal.createGuestSync(this |
413c0 | 2e 62 75 69 6c 64 50 61 72 61 6d 73 28 29 29 29 0a 20 20 7d 0a 0a 20 20 64 69 73 70 61 74 63 68 | .buildParams()))...}....dispatch |
413e0 | 45 76 65 6e 74 20 28 77 65 62 56 69 65 77 45 76 65 6e 74 29 20 7b 0a 20 20 20 20 74 68 69 73 2e | Event.(webViewEvent).{.....this. |
41400 | 77 65 62 76 69 65 77 4e 6f 64 65 2e 64 69 73 70 61 74 63 68 45 76 65 6e 74 28 77 65 62 56 69 65 | webviewNode.dispatchEvent(webVie |
41420 | 77 45 76 65 6e 74 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 41 64 64 73 20 61 6e 20 27 6f 6e 3c 65 76 | wEvent)...}....//.Adds.an.'on<ev |
41440 | 65 6e 74 3e 27 20 70 72 6f 70 65 72 74 79 20 6f 6e 20 74 68 65 20 77 65 62 76 69 65 77 2c 20 77 | ent>'.property.on.the.webview,.w |
41460 | 68 69 63 68 20 63 61 6e 20 62 65 20 75 73 65 64 20 74 6f 20 73 65 74 2f 75 6e 73 65 74 0a 20 20 | hich.can.be.used.to.set/unset... |
41480 | 2f 2f 20 61 6e 20 65 76 65 6e 74 20 68 61 6e 64 6c 65 72 2e 0a 20 20 73 65 74 75 70 45 76 65 6e | //.an.event.handler....setupEven |
414a0 | 74 50 72 6f 70 65 72 74 79 20 28 65 76 65 6e 74 4e 61 6d 65 29 20 7b 0a 20 20 20 20 63 6f 6e 73 | tProperty.(eventName).{.....cons |
414c0 | 74 20 70 72 6f 70 65 72 74 79 4e 61 6d 65 20 3d 20 60 6f 6e 24 7b 65 76 65 6e 74 4e 61 6d 65 2e | t.propertyName.=.`on${eventName. |
414e0 | 74 6f 4c 6f 77 65 72 43 61 73 65 28 29 7d 60 0a 20 20 20 20 72 65 74 75 72 6e 20 4f 62 6a 65 63 | toLowerCase()}`.....return.Objec |
41500 | 74 2e 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 74 68 69 73 2e 77 65 62 76 69 65 77 4e 6f 64 | t.defineProperty(this.webviewNod |
41520 | 65 2c 20 70 72 6f 70 65 72 74 79 4e 61 6d 65 2c 20 7b 0a 20 20 20 20 20 20 67 65 74 3a 20 28 29 | e,.propertyName,.{.......get:.() |
41540 | 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 6f 6e 5b 70 72 6f | .=>.{.........return.this.on[pro |
41560 | 70 65 72 74 79 4e 61 6d 65 5d 0a 20 20 20 20 20 20 7d 2c 0a 20 20 20 20 20 20 73 65 74 3a 20 28 | pertyName].......},.......set:.( |
41580 | 76 61 6c 75 65 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 69 66 20 28 74 68 69 73 2e 6f 6e 5b | value).=>.{.........if.(this.on[ |
415a0 | 70 72 6f 70 65 72 74 79 4e 61 6d 65 5d 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 74 68 69 73 2e | propertyName]).{...........this. |
415c0 | 77 65 62 76 69 65 77 4e 6f 64 65 2e 72 65 6d 6f 76 65 45 76 65 6e 74 4c 69 73 74 65 6e 65 72 28 | webviewNode.removeEventListener( |
415e0 | 65 76 65 6e 74 4e 61 6d 65 2c 20 74 68 69 73 2e 6f 6e 5b 70 72 6f 70 65 72 74 79 4e 61 6d 65 5d | eventName,.this.on[propertyName] |
41600 | 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 74 68 69 73 2e 6f 6e 5b 70 72 6f 70 | ).........}.........this.on[prop |
41620 | 65 72 74 79 4e 61 6d 65 5d 20 3d 20 76 61 6c 75 65 0a 20 20 20 20 20 20 20 20 69 66 20 28 76 61 | ertyName].=.value.........if.(va |
41640 | 6c 75 65 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 74 68 69 73 2e 77 65 62 | lue).{...........return.this.web |
41660 | 76 69 65 77 4e 6f 64 65 2e 61 64 64 45 76 65 6e 74 4c 69 73 74 65 6e 65 72 28 65 76 65 6e 74 4e | viewNode.addEventListener(eventN |
41680 | 61 6d 65 2c 20 76 61 6c 75 65 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 2c 0a 20 | ame,.value).........}.......},.. |
416a0 | 20 20 20 20 20 65 6e 75 6d 65 72 61 62 6c 65 3a 20 74 72 75 65 0a 20 20 20 20 7d 29 0a 20 20 7d | .....enumerable:.true.....})...} |
416c0 | 0a 0a 20 20 2f 2f 20 55 70 64 61 74 65 73 20 73 74 61 74 65 20 75 70 6f 6e 20 6c 6f 61 64 63 6f | ....//.Updates.state.upon.loadco |
416e0 | 6d 6d 69 74 2e 0a 20 20 6f 6e 4c 6f 61 64 43 6f 6d 6d 69 74 20 28 77 65 62 56 69 65 77 45 76 65 | mmit....onLoadCommit.(webViewEve |
41700 | 6e 74 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 6f 6c 64 56 61 6c 75 65 20 3d 20 74 68 69 73 2e | nt).{.....const.oldValue.=.this. |
41720 | 77 65 62 76 69 65 77 4e 6f 64 65 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 77 65 62 56 69 65 77 | webviewNode.getAttribute(webView |
41740 | 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 53 52 43 29 0a 20 20 20 20 63 6f 6e | Constants.ATTRIBUTE_SRC).....con |
41760 | 73 74 20 6e 65 77 56 61 6c 75 65 20 3d 20 77 65 62 56 69 65 77 45 76 65 6e 74 2e 75 72 6c 0a 20 | st.newValue.=.webViewEvent.url.. |
41780 | 20 20 20 69 66 20 28 77 65 62 56 69 65 77 45 76 65 6e 74 2e 69 73 4d 61 69 6e 46 72 61 6d 65 20 | ...if.(webViewEvent.isMainFrame. |
417a0 | 26 26 20 28 6f 6c 64 56 61 6c 75 65 20 21 3d 3d 20 6e 65 77 56 61 6c 75 65 29 29 20 7b 0a 20 20 | &&.(oldValue.!==.newValue)).{... |
417c0 | 20 20 20 20 2f 2f 20 54 6f 75 63 68 69 6e 67 20 74 68 65 20 73 72 63 20 61 74 74 72 69 62 75 74 | ....//.Touching.the.src.attribut |
417e0 | 65 20 74 72 69 67 67 65 72 73 20 61 20 6e 61 76 69 67 61 74 69 6f 6e 2e 20 54 6f 20 61 76 6f 69 | e.triggers.a.navigation..To.avoi |
41800 | 64 0a 20 20 20 20 20 20 2f 2f 20 74 72 69 67 67 65 72 69 6e 67 20 61 20 70 61 67 65 20 72 65 6c | d.......//.triggering.a.page.rel |
41820 | 6f 61 64 20 6f 6e 20 65 76 65 72 79 20 67 75 65 73 74 2d 69 6e 69 74 69 61 74 65 64 20 6e 61 76 | oad.on.every.guest-initiated.nav |
41840 | 69 67 61 74 69 6f 6e 2c 0a 20 20 20 20 20 20 2f 2f 20 77 65 20 64 6f 20 6e 6f 74 20 68 61 6e 64 | igation,.......//.we.do.not.hand |
41860 | 6c 65 20 74 68 69 73 20 6d 75 74 61 74 69 6f 6e 2e 0a 20 20 20 20 20 20 74 68 69 73 2e 61 74 74 | le.this.mutation........this.att |
41880 | 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 | ributes[webViewConstants.ATTRIBU |
418a0 | 54 45 5f 53 52 43 5d 2e 73 65 74 56 61 6c 75 65 49 67 6e 6f 72 65 4d 75 74 61 74 69 6f 6e 28 6e | TE_SRC].setValueIgnoreMutation(n |
418c0 | 65 77 56 61 6c 75 65 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 45 6d 69 74 73 20 66 | ewValue).....}...}....//.Emits.f |
418e0 | 6f 63 75 73 2f 62 6c 75 72 20 65 76 65 6e 74 73 2e 0a 20 20 6f 6e 46 6f 63 75 73 43 68 61 6e 67 | ocus/blur.events....onFocusChang |
41900 | 65 20 28 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 68 61 73 46 6f 63 75 73 20 3d 20 64 6f 63 75 | e.().{.....const.hasFocus.=.docu |
41920 | 6d 65 6e 74 2e 61 63 74 69 76 65 45 6c 65 6d 65 6e 74 20 3d 3d 3d 20 74 68 69 73 2e 77 65 62 76 | ment.activeElement.===.this.webv |
41940 | 69 65 77 4e 6f 64 65 0a 20 20 20 20 69 66 20 28 68 61 73 46 6f 63 75 73 20 21 3d 3d 20 74 68 69 | iewNode.....if.(hasFocus.!==.thi |
41960 | 73 2e 68 61 73 46 6f 63 75 73 29 20 7b 0a 20 20 20 20 20 20 74 68 69 73 2e 68 61 73 46 6f 63 75 | s.hasFocus).{.......this.hasFocu |
41980 | 73 20 3d 20 68 61 73 46 6f 63 75 73 0a 20 20 20 20 20 20 74 68 69 73 2e 64 69 73 70 61 74 63 68 | s.=.hasFocus.......this.dispatch |
419a0 | 45 76 65 6e 74 28 6e 65 77 20 45 76 65 6e 74 28 68 61 73 46 6f 63 75 73 20 3f 20 27 66 6f 63 75 | Event(new.Event(hasFocus.?.'focu |
419c0 | 73 27 20 3a 20 27 62 6c 75 72 27 29 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 6f 6e 41 74 74 | s'.:.'blur')).....}...}....onAtt |
419e0 | 61 63 68 20 28 73 74 6f 72 61 67 65 50 61 72 74 69 74 69 6f 6e 49 64 29 20 7b 0a 20 20 20 20 72 | ach.(storagePartitionId).{.....r |
41a00 | 65 74 75 72 6e 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 5b 77 65 62 56 69 65 77 43 6f 6e | eturn.this.attributes[webViewCon |
41a20 | 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 50 41 52 54 49 54 49 4f 4e 5d 2e 73 65 74 56 | stants.ATTRIBUTE_PARTITION].setV |
41a40 | 61 6c 75 65 28 73 74 6f 72 61 67 65 50 61 72 74 69 74 69 6f 6e 49 64 29 0a 20 20 7d 0a 0a 20 20 | alue(storagePartitionId)...}.... |
41a60 | 62 75 69 6c 64 50 61 72 61 6d 73 20 28 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 70 61 72 61 6d | buildParams.().{.....const.param |
41a80 | 73 20 3d 20 7b 0a 20 20 20 20 20 20 69 6e 73 74 61 6e 63 65 49 64 3a 20 74 68 69 73 2e 76 69 65 | s.=.{.......instanceId:.this.vie |
41aa0 | 77 49 6e 73 74 61 6e 63 65 49 64 2c 0a 20 20 20 20 20 20 75 73 65 72 41 67 65 6e 74 4f 76 65 72 | wInstanceId,.......userAgentOver |
41ac0 | 72 69 64 65 3a 20 74 68 69 73 2e 75 73 65 72 41 67 65 6e 74 4f 76 65 72 72 69 64 65 0a 20 20 20 | ride:.this.userAgentOverride.... |
41ae0 | 20 7d 0a 20 20 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 61 74 74 72 69 62 75 74 65 4e 61 6d 65 20 | .}.....for.(const.attributeName. |
41b00 | 69 6e 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 29 20 7b 0a 20 20 20 20 20 20 69 66 20 28 | in.this.attributes).{.......if.( |
41b20 | 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 2e 68 61 73 4f 77 6e 50 72 6f 70 65 72 74 79 28 61 | this.attributes.hasOwnProperty(a |
41b40 | 74 74 72 69 62 75 74 65 4e 61 6d 65 29 29 20 7b 0a 20 20 20 20 20 20 20 20 70 61 72 61 6d 73 5b | ttributeName)).{.........params[ |
41b60 | 61 74 74 72 69 62 75 74 65 4e 61 6d 65 5d 20 3d 20 74 68 69 73 2e 61 74 74 72 69 62 75 74 65 73 | attributeName].=.this.attributes |
41b80 | 5b 61 74 74 72 69 62 75 74 65 4e 61 6d 65 5d 2e 67 65 74 56 61 6c 75 65 28 29 0a 20 20 20 20 20 | [attributeName].getValue()...... |
41ba0 | 20 7d 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 70 61 72 61 6d 73 0a 20 20 7d 0a 0a | .}.....}.....return.params...}.. |
41bc0 | 20 20 61 74 74 61 63 68 47 75 65 73 74 49 6e 73 74 61 6e 63 65 20 28 67 75 65 73 74 49 6e 73 74 | ..attachGuestInstance.(guestInst |
41be0 | 61 6e 63 65 49 64 29 20 7b 0a 20 20 20 20 69 66 20 28 21 74 68 69 73 2e 65 6c 65 6d 65 6e 74 41 | anceId).{.....if.(!this.elementA |
41c00 | 74 74 61 63 68 65 64 29 20 7b 0a 20 20 20 20 20 20 2f 2f 20 54 68 65 20 65 6c 65 6d 65 6e 74 20 | ttached).{.......//.The.element. |
41c20 | 63 6f 75 6c 64 20 62 65 20 64 65 74 61 63 68 65 64 20 62 65 66 6f 72 65 20 77 65 20 67 6f 74 20 | could.be.detached.before.we.got. |
41c40 | 72 65 73 70 6f 6e 73 65 20 66 72 6f 6d 20 62 72 6f 77 73 65 72 2e 0a 20 20 20 20 20 20 72 65 74 | response.from.browser........ret |
41c60 | 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 74 68 69 73 2e 69 6e 74 65 72 6e 61 6c 49 6e 73 74 61 | urn.....}.....this.internalInsta |
41c80 | 6e 63 65 49 64 20 3d 20 67 65 74 4e 65 78 74 49 64 28 29 0a 20 20 20 20 74 68 69 73 2e 67 75 65 | nceId.=.getNextId().....this.gue |
41ca0 | 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 0a 20 | stInstanceId.=.guestInstanceId.. |
41cc0 | 20 20 20 67 75 65 73 74 56 69 65 77 49 6e 74 65 72 6e 61 6c 2e 61 74 74 61 63 68 47 75 65 73 74 | ...guestViewInternal.attachGuest |
41ce0 | 28 74 68 69 73 2e 69 6e 74 65 72 6e 61 6c 49 6e 73 74 61 6e 63 65 49 64 2c 20 74 68 69 73 2e 67 | (this.internalInstanceId,.this.g |
41d00 | 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 74 68 69 73 2e 62 75 69 6c 64 50 61 72 61 6d 73 | uestInstanceId,.this.buildParams |
41d20 | 28 29 2c 20 74 68 69 73 2e 69 6e 74 65 72 6e 61 6c 45 6c 65 6d 65 6e 74 2e 63 6f 6e 74 65 6e 74 | (),.this.internalElement.content |
41d40 | 57 69 6e 64 6f 77 29 0a 20 20 20 20 2f 2f 20 52 65 73 69 7a 65 4f 62 73 65 72 76 65 72 20 69 73 | Window).....//.ResizeObserver.is |
41d60 | 20 61 20 62 72 6f 77 73 65 72 20 67 6c 6f 62 61 6c 20 6e 6f 74 20 72 65 63 6f 67 6e 69 7a 65 64 | .a.browser.global.not.recognized |
41d80 | 20 62 79 20 22 73 74 61 6e 64 61 72 64 22 2e 0a 20 20 20 20 2f 2a 20 67 6c 6f 62 61 6c 73 20 52 | .by."standard"....../*.globals.R |
41da0 | 65 73 69 7a 65 4f 62 73 65 72 76 65 72 20 2a 2f 0a 20 20 20 20 2f 2f 20 54 4f 44 4f 28 7a 63 62 | esizeObserver.*/.....//.TODO(zcb |
41dc0 | 65 6e 7a 29 3a 20 53 68 6f 75 6c 64 20 77 65 20 64 65 70 72 65 63 61 74 65 20 74 68 65 20 22 72 | enz):.Should.we.deprecate.the."r |
41de0 | 65 73 69 7a 65 22 20 65 76 65 6e 74 3f 20 57 61 69 74 2c 20 69 74 20 69 73 20 6e 6f 74 0a 20 20 | esize".event?.Wait,.it.is.not... |
41e00 | 20 20 2f 2f 20 65 76 65 6e 20 64 6f 63 75 6d 65 6e 74 65 64 2e 0a 20 20 20 20 74 68 69 73 2e 72 | ..//.even.documented......this.r |
41e20 | 65 73 69 7a 65 4f 62 73 65 72 76 65 72 20 3d 20 6e 65 77 20 52 65 73 69 7a 65 4f 62 73 65 72 76 | esizeObserver.=.new.ResizeObserv |
41e40 | 65 72 28 74 68 69 73 2e 6f 6e 45 6c 65 6d 65 6e 74 52 65 73 69 7a 65 2e 62 69 6e 64 28 74 68 69 | er(this.onElementResize.bind(thi |
41e60 | 73 29 29 2e 6f 62 73 65 72 76 65 28 74 68 69 73 2e 69 6e 74 65 72 6e 61 6c 45 6c 65 6d 65 6e 74 | s)).observe(this.internalElement |
41e80 | 29 0a 20 20 7d 0a 7d 0a 0a 2f 2f 20 52 65 67 69 73 74 65 72 73 20 3c 77 65 62 76 69 65 77 3e 20 | )...}.}..//.Registers.<webview>. |
41ea0 | 63 75 73 74 6f 6d 20 65 6c 65 6d 65 6e 74 2e 0a 63 6f 6e 73 74 20 72 65 67 69 73 74 65 72 57 65 | custom.element..const.registerWe |
41ec0 | 62 56 69 65 77 45 6c 65 6d 65 6e 74 20 3d 20 28 77 69 6e 64 6f 77 29 20 3d 3e 20 7b 0a 20 20 63 | bViewElement.=.(window).=>.{...c |
41ee0 | 6f 6e 73 74 20 70 72 6f 74 6f 20 3d 20 4f 62 6a 65 63 74 2e 63 72 65 61 74 65 28 77 69 6e 64 6f | onst.proto.=.Object.create(windo |
41f00 | 77 2e 48 54 4d 4c 4f 62 6a 65 63 74 45 6c 65 6d 65 6e 74 2e 70 72 6f 74 6f 74 79 70 65 29 0a 20 | w.HTMLObjectElement.prototype).. |
41f20 | 20 70 72 6f 74 6f 2e 63 72 65 61 74 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 66 75 6e 63 74 69 6f | .proto.createdCallback.=.functio |
41f40 | 6e 20 28 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 6e 65 77 20 57 65 62 56 69 65 77 49 6d 70 | n.().{.....return.new.WebViewImp |
41f60 | 6c 28 74 68 69 73 29 0a 20 20 7d 0a 20 20 70 72 6f 74 6f 2e 61 74 74 72 69 62 75 74 65 43 68 61 | l(this)...}...proto.attributeCha |
41f80 | 6e 67 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6e 61 6d 65 2c 20 6f | ngedCallback.=.function.(name,.o |
41fa0 | 6c 64 56 61 6c 75 65 2c 20 6e 65 77 56 61 6c 75 65 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 69 | ldValue,.newValue).{.....const.i |
41fc0 | 6e 74 65 72 6e 61 6c 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 | nternal.=.v8Util.getHiddenValue( |
41fe0 | 74 68 69 73 2c 20 27 69 6e 74 65 72 6e 61 6c 27 29 0a 20 20 20 20 69 66 20 28 69 6e 74 65 72 6e | this,.'internal').....if.(intern |
42000 | 61 6c 29 20 7b 0a 20 20 20 20 20 20 69 6e 74 65 72 6e 61 6c 2e 68 61 6e 64 6c 65 57 65 62 76 69 | al).{.......internal.handleWebvi |
42020 | 65 77 41 74 74 72 69 62 75 74 65 4d 75 74 61 74 69 6f 6e 28 6e 61 6d 65 2c 20 6f 6c 64 56 61 6c | ewAttributeMutation(name,.oldVal |
42040 | 75 65 2c 20 6e 65 77 56 61 6c 75 65 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 70 72 6f 74 6f 2e | ue,.newValue).....}...}...proto. |
42060 | 64 65 74 61 63 68 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b | detachedCallback.=.function.().{ |
42080 | 0a 20 20 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 6e 61 6c 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 | .....const.internal.=.v8Util.get |
420a0 | 48 69 64 64 65 6e 56 61 6c 75 65 28 74 68 69 73 2c 20 27 69 6e 74 65 72 6e 61 6c 27 29 0a 20 20 | HiddenValue(this,.'internal')... |
420c0 | 20 20 69 66 20 28 21 69 6e 74 65 72 6e 61 6c 29 20 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 0a | ..if.(!internal).{.......return. |
420e0 | 20 20 20 20 7d 0a 20 20 20 20 67 75 65 73 74 56 69 65 77 49 6e 74 65 72 6e 61 6c 2e 64 65 72 65 | ....}.....guestViewInternal.dere |
42100 | 67 69 73 74 65 72 45 76 65 6e 74 73 28 69 6e 74 65 72 6e 61 6c 2e 76 69 65 77 49 6e 73 74 61 6e | gisterEvents(internal.viewInstan |
42120 | 63 65 49 64 29 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 2e 65 6c 65 6d 65 6e 74 41 74 74 61 63 68 | ceId).....internal.elementAttach |
42140 | 65 64 20 3d 20 66 61 6c 73 65 0a 20 20 20 20 74 68 69 73 2e 69 6e 74 65 72 6e 61 6c 49 6e 73 74 | ed.=.false.....this.internalInst |
42160 | 61 6e 63 65 49 64 20 3d 20 30 0a 20 20 20 20 69 6e 74 65 72 6e 61 6c 2e 72 65 73 65 74 28 29 0a | anceId.=.0.....internal.reset(). |
42180 | 20 20 7d 0a 20 20 70 72 6f 74 6f 2e 61 74 74 61 63 68 65 64 43 61 6c 6c 62 61 63 6b 20 3d 20 66 | ..}...proto.attachedCallback.=.f |
421a0 | 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 6e 61 6c 20 | unction.().{.....const.internal. |
421c0 | 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 74 68 69 73 2c 20 27 69 | =.v8Util.getHiddenValue(this,.'i |
421e0 | 6e 74 65 72 6e 61 6c 27 29 0a 20 20 20 20 69 66 20 28 21 69 6e 74 65 72 6e 61 6c 29 20 7b 0a 20 | nternal').....if.(!internal).{.. |
42200 | 20 20 20 20 20 72 65 74 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 69 66 20 28 21 69 6e 74 65 72 | .....return.....}.....if.(!inter |
42220 | 6e 61 6c 2e 65 6c 65 6d 65 6e 74 41 74 74 61 63 68 65 64 29 20 7b 0a 20 20 20 20 20 20 67 75 65 | nal.elementAttached).{.......gue |
42240 | 73 74 56 69 65 77 49 6e 74 65 72 6e 61 6c 2e 72 65 67 69 73 74 65 72 45 76 65 6e 74 73 28 69 6e | stViewInternal.registerEvents(in |
42260 | 74 65 72 6e 61 6c 2c 20 69 6e 74 65 72 6e 61 6c 2e 76 69 65 77 49 6e 73 74 61 6e 63 65 49 64 29 | ternal,.internal.viewInstanceId) |
42280 | 0a 20 20 20 20 20 20 69 6e 74 65 72 6e 61 6c 2e 65 6c 65 6d 65 6e 74 41 74 74 61 63 68 65 64 20 | .......internal.elementAttached. |
422a0 | 3d 20 74 72 75 65 0a 20 20 20 20 20 20 69 6e 74 65 72 6e 61 6c 2e 61 74 74 72 69 62 75 74 65 73 | =.true.......internal.attributes |
422c0 | 5b 77 65 62 56 69 65 77 43 6f 6e 73 74 61 6e 74 73 2e 41 54 54 52 49 42 55 54 45 5f 53 52 43 5d | [webViewConstants.ATTRIBUTE_SRC] |
422e0 | 2e 70 61 72 73 65 28 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 67 65 74 47 | .parse().....}...}....const.getG |
42300 | 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 73 65 6c 66 29 | uestInstanceId.=.function.(self) |
42320 | 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 6e 61 6c 20 3d 20 76 38 55 74 69 6c 2e 67 | .{.....const.internal.=.v8Util.g |
42340 | 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 73 65 6c 66 2c 20 27 69 6e 74 65 72 6e 61 6c 27 29 0a | etHiddenValue(self,.'internal'). |
42360 | 20 20 20 20 69 66 20 28 21 69 6e 74 65 72 6e 61 6c 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 | ....if.(!internal.guestInstanceI |
42380 | 64 29 20 7b 0a 20 20 20 20 20 20 74 68 72 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 54 68 65 20 | d).{.......throw.new.Error('The. |
423a0 | 57 65 62 56 69 65 77 20 6d 75 73 74 20 62 65 20 61 74 74 61 63 68 65 64 20 74 6f 20 74 68 65 20 | WebView.must.be.attached.to.the. |
423c0 | 44 4f 4d 20 61 6e 64 20 74 68 65 20 64 6f 6d 2d 72 65 61 64 79 20 65 76 65 6e 74 20 65 6d 69 74 | DOM.and.the.dom-ready.event.emit |
423e0 | 74 65 64 20 62 65 66 6f 72 65 20 74 68 69 73 20 6d 65 74 68 6f 64 20 63 61 6e 20 62 65 20 63 61 | ted.before.this.method.can.be.ca |
42400 | 6c 6c 65 64 2e 27 29 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 6e 20 69 6e 74 65 72 6e 61 | lled.').....}.....return.interna |
42420 | 6c 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 0a 20 20 7d 0a 0a 20 20 2f 2f 20 46 6f 72 77 | l.guestInstanceId...}....//.Forw |
42440 | 61 72 64 20 70 72 6f 74 6f 2e 66 6f 6f 2a 20 6d 65 74 68 6f 64 20 63 61 6c 6c 73 20 74 6f 20 57 | ard.proto.foo*.method.calls.to.W |
42460 | 65 62 56 69 65 77 49 6d 70 6c 2e 66 6f 6f 2a 2e 0a 20 20 63 6f 6e 73 74 20 63 72 65 61 74 65 42 | ebViewImpl.foo*....const.createB |
42480 | 6c 6f 63 6b 48 61 6e 64 6c 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 65 74 68 6f 64 29 20 | lockHandler.=.function.(method). |
424a0 | 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 | {.....return.function.(...args). |
424c0 | 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 5b 65 72 72 6f 72 2c 20 72 65 73 75 6c 74 5d 20 3d 20 | {.......const.[error,.result].=. |
424e0 | 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 27 45 4c 45 43 54 52 4f 4e 5f 47 | ipcRenderer.sendSync('ELECTRON_G |
42500 | 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 53 59 4e 43 5f 43 41 4c 4c 27 2c 20 67 65 | UEST_VIEW_MANAGER_SYNC_CALL',.ge |
42520 | 74 47 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 28 74 68 69 73 29 2c 20 6d 65 74 68 6f 64 2c 20 | tGuestInstanceId(this),.method,. |
42540 | 61 72 67 73 29 0a 20 20 20 20 20 20 69 66 20 28 65 72 72 6f 72 29 20 7b 0a 20 20 20 20 20 20 20 | args).......if.(error).{........ |
42560 | 20 74 68 72 6f 77 20 65 72 72 6f 72 55 74 69 6c 73 2e 64 65 73 65 72 69 61 6c 69 7a 65 28 65 72 | .throw.errorUtils.deserialize(er |
42580 | 72 6f 72 29 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 | ror).......}.else.{.........retu |
425a0 | 72 6e 20 72 65 73 75 6c 74 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 20 20 66 6f | rn.result.......}.....}...}...fo |
425c0 | 72 20 28 63 6f 6e 73 74 20 6d 65 74 68 6f 64 20 6f 66 20 73 79 6e 63 4d 65 74 68 6f 64 73 29 20 | r.(const.method.of.syncMethods). |
425e0 | 7b 0a 20 20 20 20 70 72 6f 74 6f 5b 6d 65 74 68 6f 64 5d 20 3d 20 63 72 65 61 74 65 42 6c 6f 63 | {.....proto[method].=.createBloc |
42600 | 6b 48 61 6e 64 6c 65 72 28 6d 65 74 68 6f 64 29 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 63 72 | kHandler(method)...}....const.cr |
42620 | 65 61 74 65 4e 6f 6e 42 6c 6f 63 6b 48 61 6e 64 6c 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 | eateNonBlockHandler.=.function.( |
42640 | 6d 65 74 68 6f 64 29 20 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 66 75 6e 63 74 69 6f 6e 20 28 2e | method).{.....return.function.(. |
42660 | 2e 2e 61 72 67 73 29 20 7b 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 63 61 6c 6c 62 61 63 6b 20 3d | ..args).{.......const.callback.= |
42680 | 20 28 74 79 70 65 6f 66 20 61 72 67 73 5b 61 72 67 73 2e 6c 65 6e 67 74 68 20 2d 20 31 5d 20 3d | .(typeof.args[args.length.-.1].= |
426a0 | 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 3f 20 61 72 67 73 2e 70 6f 70 28 29 20 3a 20 6e 75 | ==.'function').?.args.pop().:.nu |
426c0 | 6c 6c 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 71 75 65 73 74 49 64 20 3d 20 67 65 74 4e 65 | ll.......const.requestId.=.getNe |
426e0 | 78 74 49 64 28 29 0a 20 20 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 63 65 28 60 45 | xtId().......ipcRenderer.once(`E |
42700 | 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e 41 47 45 52 5f 41 53 59 4e 43 | LECTRON_GUEST_VIEW_MANAGER_ASYNC |
42720 | 5f 43 41 4c 4c 5f 52 45 53 50 4f 4e 53 45 5f 24 7b 72 65 71 75 65 73 74 49 64 7d 60 2c 20 66 75 | _CALL_RESPONSE_${requestId}`,.fu |
42740 | 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 65 72 72 6f 72 2c 20 72 65 73 75 6c 74 29 20 7b 0a | nction.(event,.error,.result).{. |
42760 | 20 20 20 20 20 20 20 20 69 66 20 28 65 72 72 6f 72 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 | ........if.(error.==.null).{.... |
42780 | 20 20 20 20 20 20 20 69 66 20 28 63 61 6c 6c 62 61 63 6b 29 20 63 61 6c 6c 62 61 63 6b 28 72 65 | .......if.(callback).callback(re |
427a0 | 73 75 6c 74 29 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 20 | sult).........}.else.{.......... |
427c0 | 20 74 68 72 6f 77 20 65 72 72 6f 72 55 74 69 6c 73 2e 64 65 73 65 72 69 61 6c 69 7a 65 28 65 72 | .throw.errorUtils.deserialize(er |
427e0 | 72 6f 72 29 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 69 70 | ror).........}.......}).......ip |
42800 | 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 | cRenderer.send('ELECTRON_GUEST_V |
42820 | 49 45 57 5f 4d 41 4e 41 47 45 52 5f 41 53 59 4e 43 5f 43 41 4c 4c 27 2c 20 72 65 71 75 65 73 74 | IEW_MANAGER_ASYNC_CALL',.request |
42840 | 49 64 2c 20 67 65 74 47 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 28 74 68 69 73 29 2c 20 6d 65 | Id,.getGuestInstanceId(this),.me |
42860 | 74 68 6f 64 2c 20 61 72 67 73 2c 20 63 61 6c 6c 62 61 63 6b 20 21 3d 20 6e 75 6c 6c 29 0a 20 20 | thod,.args,.callback.!=.null)... |
42880 | 20 20 7d 0a 20 20 7d 0a 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 6d 65 74 68 6f 64 20 6f 66 20 | ..}...}....for.(const.method.of. |
428a0 | 61 73 79 6e 63 43 61 6c 6c 62 61 63 6b 4d 65 74 68 6f 64 73 29 20 7b 0a 20 20 20 20 70 72 6f 74 | asyncCallbackMethods).{.....prot |
428c0 | 6f 5b 6d 65 74 68 6f 64 5d 20 3d 20 63 72 65 61 74 65 4e 6f 6e 42 6c 6f 63 6b 48 61 6e 64 6c 65 | o[method].=.createNonBlockHandle |
428e0 | 72 28 6d 65 74 68 6f 64 29 0a 20 20 7d 0a 0a 20 20 63 6f 6e 73 74 20 63 72 65 61 74 65 50 72 6f | r(method)...}....const.createPro |
42900 | 6d 69 73 65 48 61 6e 64 6c 65 72 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6d 65 74 68 6f 64 29 20 | miseHandler.=.function.(method). |
42920 | 7b 0a 20 20 20 20 72 65 74 75 72 6e 20 66 75 6e 63 74 69 6f 6e 20 28 2e 2e 2e 61 72 67 73 29 20 | {.....return.function.(...args). |
42940 | 7b 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 65 77 20 50 72 6f 6d 69 73 65 28 28 72 65 73 6f | {.......return.new.Promise((reso |
42960 | 6c 76 65 2c 20 72 65 6a 65 63 74 29 20 3d 3e 20 7b 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 | lve,.reject).=>.{.........const. |
42980 | 63 61 6c 6c 62 61 63 6b 20 3d 20 28 74 79 70 65 6f 66 20 61 72 67 73 5b 61 72 67 73 2e 6c 65 6e | callback.=.(typeof.args[args.len |
429a0 | 67 74 68 20 2d 20 31 5d 20 3d 3d 3d 20 27 66 75 6e 63 74 69 6f 6e 27 29 20 3f 20 61 72 67 73 2e | gth.-.1].===.'function').?.args. |
429c0 | 70 6f 70 28 29 20 3a 20 6e 75 6c 6c 0a 20 20 20 20 20 20 20 20 63 6f 6e 73 74 20 72 65 71 75 65 | pop().:.null.........const.reque |
429e0 | 73 74 49 64 20 3d 20 67 65 74 4e 65 78 74 49 64 28 29 0a 0a 20 20 20 20 20 20 20 20 69 70 63 52 | stId.=.getNextId()..........ipcR |
42a00 | 65 6e 64 65 72 65 72 2e 6f 6e 63 65 28 60 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 | enderer.once(`ELECTRON_GUEST_VIE |
42a20 | 57 5f 4d 41 4e 41 47 45 52 5f 41 53 59 4e 43 5f 43 41 4c 4c 5f 52 45 53 50 4f 4e 53 45 5f 24 7b | W_MANAGER_ASYNC_CALL_RESPONSE_${ |
42a40 | 72 65 71 75 65 73 74 49 64 7d 60 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 65 72 | requestId}`,.function.(event,.er |
42a60 | 72 6f 72 2c 20 72 65 73 75 6c 74 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 69 66 20 28 65 72 72 | ror,.result).{...........if.(err |
42a80 | 6f 72 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 66 20 28 63 61 | or.==.null).{.............if.(ca |
42aa0 | 6c 6c 62 61 63 6b 29 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 63 61 6c 6c 62 61 63 6b | llback).{...............callback |
42ac0 | 28 72 65 73 75 6c 74 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 20 | (result).............}.......... |
42ae0 | 20 20 20 72 65 73 6f 6c 76 65 28 72 65 73 75 6c 74 29 0a 20 20 20 20 20 20 20 20 20 20 7d 20 65 | ...resolve(result)...........}.e |
42b00 | 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 20 20 20 20 72 65 6a 65 63 74 28 65 72 72 6f 72 55 74 | lse.{.............reject(errorUt |
42b20 | 69 6c 73 2e 64 65 73 65 72 69 61 6c 69 7a 65 28 65 72 72 6f 72 29 29 0a 20 20 20 20 20 20 20 20 | ils.deserialize(error))......... |
42b40 | 20 20 7d 0a 20 20 20 20 20 20 20 20 7d 29 0a 20 20 20 20 20 20 20 20 69 70 63 52 65 6e 64 65 72 | ..}.........}).........ipcRender |
42b60 | 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 56 49 45 57 5f 4d 41 4e | er.send('ELECTRON_GUEST_VIEW_MAN |
42b80 | 41 47 45 52 5f 41 53 59 4e 43 5f 43 41 4c 4c 27 2c 20 72 65 71 75 65 73 74 49 64 2c 20 67 65 74 | AGER_ASYNC_CALL',.requestId,.get |
42ba0 | 47 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 28 74 68 69 73 29 2c 20 6d 65 74 68 6f 64 2c 20 61 | GuestInstanceId(this),.method,.a |
42bc0 | 72 67 73 2c 20 63 61 6c 6c 62 61 63 6b 20 21 3d 20 6e 75 6c 6c 29 0a 20 20 20 20 20 20 7d 29 0a | rgs,.callback.!=.null).......}). |
42be0 | 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 66 6f 72 20 28 63 6f 6e 73 74 20 6d 65 74 68 6f 64 20 6f | ....}...}....for.(const.method.o |
42c00 | 66 20 61 73 79 6e 63 50 72 6f 6d 69 73 65 4d 65 74 68 6f 64 73 29 20 7b 0a 20 20 20 20 70 72 6f | f.asyncPromiseMethods).{.....pro |
42c20 | 74 6f 5b 6d 65 74 68 6f 64 5d 20 3d 20 63 72 65 61 74 65 50 72 6f 6d 69 73 65 48 61 6e 64 6c 65 | to[method].=.createPromiseHandle |
42c40 | 72 28 6d 65 74 68 6f 64 29 0a 20 20 7d 0a 0a 20 20 2f 2f 20 57 65 62 43 6f 6e 74 65 6e 74 73 20 | r(method)...}....//.WebContents. |
42c60 | 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 68 69 73 20 77 65 62 76 69 65 77 2e 0a 20 20 | associated.with.this.webview.... |
42c80 | 70 72 6f 74 6f 2e 67 65 74 57 65 62 43 6f 6e 74 65 6e 74 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 | proto.getWebContents.=.function. |
42ca0 | 28 29 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 7b 20 67 65 74 52 65 6d 6f 74 65 46 6f 72 55 73 61 | ().{.....const.{.getRemoteForUsa |
42cc0 | 67 65 20 7d 20 3d 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e | ge.}.=.require('@electron/intern |
42ce0 | 61 6c 2f 72 65 6e 64 65 72 65 72 2f 72 65 6d 6f 74 65 27 29 0a 20 20 20 20 63 6f 6e 73 74 20 72 | al/renderer/remote').....const.r |
42d00 | 65 6d 6f 74 65 20 3d 20 67 65 74 52 65 6d 6f 74 65 46 6f 72 55 73 61 67 65 28 27 67 65 74 57 65 | emote.=.getRemoteForUsage('getWe |
42d20 | 62 43 6f 6e 74 65 6e 74 73 28 29 27 29 0a 20 20 20 20 63 6f 6e 73 74 20 69 6e 74 65 72 6e 61 6c | bContents()').....const.internal |
42d40 | 20 3d 20 76 38 55 74 69 6c 2e 67 65 74 48 69 64 64 65 6e 56 61 6c 75 65 28 74 68 69 73 2c 20 27 | .=.v8Util.getHiddenValue(this,.' |
42d60 | 69 6e 74 65 72 6e 61 6c 27 29 0a 20 20 20 20 69 66 20 28 21 69 6e 74 65 72 6e 61 6c 2e 67 75 65 | internal').....if.(!internal.gue |
42d80 | 73 74 49 6e 73 74 61 6e 63 65 49 64 29 20 7b 0a 20 20 20 20 20 20 69 6e 74 65 72 6e 61 6c 2e 63 | stInstanceId).{.......internal.c |
42da0 | 72 65 61 74 65 47 75 65 73 74 53 79 6e 63 28 29 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 74 75 72 | reateGuestSync().....}.....retur |
42dc0 | 6e 20 72 65 6d 6f 74 65 2e 67 65 74 47 75 65 73 74 57 65 62 43 6f 6e 74 65 6e 74 73 28 69 6e 74 | n.remote.getGuestWebContents(int |
42de0 | 65 72 6e 61 6c 2e 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 29 0a 20 20 7d 0a 0a 20 20 2f 2f | ernal.guestInstanceId)...}....// |
42e00 | 20 46 6f 63 75 73 69 6e 67 20 74 68 65 20 77 65 62 76 69 65 77 20 73 68 6f 75 6c 64 20 6d 6f 76 | .Focusing.the.webview.should.mov |
42e20 | 65 20 70 61 67 65 20 66 6f 63 75 73 20 74 6f 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 20 69 | e.page.focus.to.the.underlying.i |
42e40 | 66 72 61 6d 65 2e 0a 20 20 70 72 6f 74 6f 2e 66 6f 63 75 73 20 3d 20 66 75 6e 63 74 69 6f 6e 20 | frame....proto.focus.=.function. |
42e60 | 28 29 20 7b 0a 20 20 20 20 74 68 69 73 2e 63 6f 6e 74 65 6e 74 57 69 6e 64 6f 77 2e 66 6f 63 75 | ().{.....this.contentWindow.focu |
42e80 | 73 28 29 0a 20 20 7d 0a 0a 20 20 77 69 6e 64 6f 77 2e 57 65 62 56 69 65 77 20 3d 20 77 65 62 46 | s()...}....window.WebView.=.webF |
42ea0 | 72 61 6d 65 2e 72 65 67 69 73 74 65 72 45 6d 62 65 64 64 65 72 43 75 73 74 6f 6d 45 6c 65 6d 65 | rame.registerEmbedderCustomEleme |
42ec0 | 6e 74 28 77 69 6e 64 6f 77 2c 20 27 77 65 62 76 69 65 77 27 2c 20 7b 0a 20 20 20 20 70 72 6f 74 | nt(window,.'webview',.{.....prot |
42ee0 | 6f 74 79 70 65 3a 20 70 72 6f 74 6f 0a 20 20 7d 29 0a 0a 20 20 2f 2f 20 44 65 6c 65 74 65 20 74 | otype:.proto...})....//.Delete.t |
42f00 | 68 65 20 63 61 6c 6c 62 61 63 6b 73 20 73 6f 20 64 65 76 65 6c 6f 70 65 72 73 20 63 61 6e 6e 6f | he.callbacks.so.developers.canno |
42f20 | 74 20 63 61 6c 6c 20 74 68 65 6d 20 61 6e 64 20 70 72 6f 64 75 63 65 20 75 6e 65 78 70 65 63 74 | t.call.them.and.produce.unexpect |
42f40 | 65 64 0a 20 20 2f 2f 20 62 65 68 61 76 69 6f 72 2e 0a 20 20 64 65 6c 65 74 65 20 70 72 6f 74 6f | ed...//.behavior....delete.proto |
42f60 | 2e 63 72 65 61 74 65 64 43 61 6c 6c 62 61 63 6b 0a 20 20 64 65 6c 65 74 65 20 70 72 6f 74 6f 2e | .createdCallback...delete.proto. |
42f80 | 61 74 74 61 63 68 65 64 43 61 6c 6c 62 61 63 6b 0a 20 20 64 65 6c 65 74 65 20 70 72 6f 74 6f 2e | attachedCallback...delete.proto. |
42fa0 | 64 65 74 61 63 68 65 64 43 61 6c 6c 62 61 63 6b 0a 20 20 64 65 6c 65 74 65 20 70 72 6f 74 6f 2e | detachedCallback...delete.proto. |
42fc0 | 61 74 74 72 69 62 75 74 65 43 68 61 6e 67 65 64 43 61 6c 6c 62 61 63 6b 0a 7d 0a 0a 63 6f 6e 73 | attributeChangedCallback.}..cons |
42fe0 | 74 20 73 65 74 75 70 57 65 62 56 69 65 77 20 3d 20 28 77 69 6e 64 6f 77 29 20 3d 3e 20 7b 0a 20 | t.setupWebView.=.(window).=>.{.. |
43000 | 20 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 72 65 6e | .require('@electron/internal/ren |
43020 | 64 65 72 65 72 2f 77 65 62 2d 76 69 65 77 2f 77 65 62 2d 76 69 65 77 2d 61 74 74 72 69 62 75 74 | derer/web-view/web-view-attribut |
43040 | 65 73 27 29 0a 0a 20 20 63 6f 6e 73 74 20 75 73 65 43 61 70 74 75 72 65 20 3d 20 74 72 75 65 0a | es')....const.useCapture.=.true. |
43060 | 20 20 77 69 6e 64 6f 77 2e 61 64 64 45 76 65 6e 74 4c 69 73 74 65 6e 65 72 28 27 72 65 61 64 79 | ..window.addEventListener('ready |
43080 | 73 74 61 74 65 63 68 61 6e 67 65 27 2c 20 66 75 6e 63 74 69 6f 6e 20 6c 69 73 74 65 6e 65 72 20 | statechange',.function.listener. |
430a0 | 28 65 76 65 6e 74 29 20 7b 0a 20 20 20 20 69 66 20 28 64 6f 63 75 6d 65 6e 74 2e 72 65 61 64 79 | (event).{.....if.(document.ready |
430c0 | 53 74 61 74 65 20 3d 3d 3d 20 27 6c 6f 61 64 69 6e 67 27 29 20 7b 0a 20 20 20 20 20 20 72 65 74 | State.===.'loading').{.......ret |
430e0 | 75 72 6e 0a 20 20 20 20 7d 0a 20 20 20 20 72 65 67 69 73 74 65 72 57 65 62 56 69 65 77 45 6c 65 | urn.....}.....registerWebViewEle |
43100 | 6d 65 6e 74 28 77 69 6e 64 6f 77 29 0a 20 20 20 20 77 69 6e 64 6f 77 2e 72 65 6d 6f 76 65 45 76 | ment(window).....window.removeEv |
43120 | 65 6e 74 4c 69 73 74 65 6e 65 72 28 65 76 65 6e 74 2e 74 79 70 65 2c 20 6c 69 73 74 65 6e 65 72 | entListener(event.type,.listener |
43140 | 2c 20 75 73 65 43 61 70 74 75 72 65 29 0a 20 20 7d 2c 20 75 73 65 43 61 70 74 75 72 65 29 0a 7d | ,.useCapture)...},.useCapture).} |
43160 | 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 7b 20 73 65 74 75 70 57 65 62 56 69 65 | ..module.exports.=.{.setupWebVie |
43180 | 77 2c 20 57 65 62 56 69 65 77 49 6d 70 6c 20 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 0a 0a 2f | w,.WebViewImpl.}.'use.strict'../ |
431a0 | 2f 20 54 68 69 73 20 66 69 6c 65 20 73 68 6f 75 6c 64 20 68 61 76 65 20 6e 6f 20 72 65 71 75 69 | /.This.file.should.have.no.requi |
431c0 | 72 65 73 20 73 69 6e 63 65 20 69 74 20 69 73 20 75 73 65 64 20 62 79 20 74 68 65 20 69 73 6f 6c | res.since.it.is.used.by.the.isol |
431e0 | 61 74 65 64 20 63 6f 6e 74 65 78 74 0a 2f 2f 20 70 72 65 6c 6f 61 64 20 62 75 6e 64 6c 65 2e 20 | ated.context.//.preload.bundle.. |
43200 | 49 6e 73 74 65 61 64 20 61 72 67 75 6d 65 6e 74 73 20 73 68 6f 75 6c 64 20 62 65 20 70 61 73 73 | Instead.arguments.should.be.pass |
43220 | 65 64 20 69 6e 20 66 6f 72 20 65 76 65 72 79 74 68 69 6e 67 20 69 74 0a 2f 2f 20 6e 65 65 64 73 | ed.in.for.everything.it.//.needs |
43240 | 2e 0a 0a 2f 2f 20 54 68 69 73 20 66 69 6c 65 20 69 6d 70 6c 65 6d 65 6e 74 73 20 74 68 65 20 66 | ...//.This.file.implements.the.f |
43260 | 6f 6c 6c 6f 77 69 6e 67 20 41 50 49 73 3a 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 61 6c 65 72 74 | ollowing.APIs:.//.-.window.alert |
43280 | 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 63 6f 6e 66 69 72 6d 28 29 0a 2f 2f 20 2d 20 77 69 | ().//.-.window.confirm().//.-.wi |
432a0 | 6e 64 6f 77 2e 68 69 73 74 6f 72 79 2e 62 61 63 6b 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e | ndow.history.back().//.-.window. |
432c0 | 68 69 73 74 6f 72 79 2e 66 6f 72 77 61 72 64 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 68 69 | history.forward().//.-.window.hi |
432e0 | 73 74 6f 72 79 2e 67 6f 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 68 69 73 74 6f 72 79 2e 6c | story.go().//.-.window.history.l |
43300 | 65 6e 67 74 68 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 28 29 0a 2f 2f 20 2d 20 77 69 | ength.//.-.window.open().//.-.wi |
43320 | 6e 64 6f 77 2e 6f 70 65 6e 65 72 2e 62 6c 75 72 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 6f | ndow.opener.blur().//.-.window.o |
43340 | 70 65 6e 65 72 2e 63 6c 6f 73 65 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 65 72 | pener.close().//.-.window.opener |
43360 | 2e 65 76 61 6c 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 65 72 2e 66 6f 63 75 73 | .eval().//.-.window.opener.focus |
43380 | 28 29 0a 2f 2f 20 2d 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 65 72 2e 6c 6f 63 61 74 69 6f 6e 0a 2f | ().//.-.window.opener.location./ |
433a0 | 2f 20 2d 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 65 72 2e 70 72 69 6e 74 28 29 0a 2f 2f 20 2d 20 77 | /.-.window.opener.print().//.-.w |
433c0 | 69 6e 64 6f 77 2e 6f 70 65 6e 65 72 2e 70 6f 73 74 4d 65 73 73 61 67 65 28 29 0a 2f 2f 20 2d 20 | indow.opener.postMessage().//.-. |
433e0 | 77 69 6e 64 6f 77 2e 70 72 6f 6d 70 74 28 29 0a 2f 2f 20 2d 20 64 6f 63 75 6d 65 6e 74 2e 68 69 | window.prompt().//.-.document.hi |
43400 | 64 64 65 6e 0a 2f 2f 20 2d 20 64 6f 63 75 6d 65 6e 74 2e 76 69 73 69 62 69 6c 69 74 79 53 74 61 | dden.//.-.document.visibilitySta |
43420 | 74 65 0a 0a 63 6f 6e 73 74 20 7b 20 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 20 7d 20 3d 20 4f | te..const.{.defineProperty.}.=.O |
43440 | 62 6a 65 63 74 0a 0a 2f 2f 20 48 65 6c 70 65 72 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 72 65 73 | bject..//.Helper.function.to.res |
43460 | 6f 6c 76 65 20 72 65 6c 61 74 69 76 65 20 75 72 6c 2e 0a 63 6f 6e 73 74 20 61 20 3d 20 77 69 6e | olve.relative.url..const.a.=.win |
43480 | 64 6f 77 2e 74 6f 70 2e 64 6f 63 75 6d 65 6e 74 2e 63 72 65 61 74 65 45 6c 65 6d 65 6e 74 28 27 | dow.top.document.createElement(' |
434a0 | 61 27 29 0a 63 6f 6e 73 74 20 72 65 73 6f 6c 76 65 55 52 4c 20 3d 20 66 75 6e 63 74 69 6f 6e 20 | a').const.resolveURL.=.function. |
434c0 | 28 75 72 6c 29 20 7b 0a 20 20 61 2e 68 72 65 66 20 3d 20 75 72 6c 0a 20 20 72 65 74 75 72 6e 20 | (url).{...a.href.=.url...return. |
434e0 | 61 2e 68 72 65 66 0a 7d 0a 0a 2f 2f 20 55 73 65 20 74 68 69 73 20 6d 65 74 68 6f 64 20 74 6f 20 | a.href.}..//.Use.this.method.to. |
43500 | 65 6e 73 75 72 65 20 76 61 6c 75 65 73 20 65 78 70 65 63 74 65 64 20 61 73 20 73 74 72 69 6e 67 | ensure.values.expected.as.string |
43520 | 73 20 69 6e 20 74 68 65 20 6d 61 69 6e 20 70 72 6f 63 65 73 73 0a 2f 2f 20 61 72 65 20 63 6f 6e | s.in.the.main.process.//.are.con |
43540 | 76 65 72 74 69 62 6c 65 20 74 6f 20 73 74 72 69 6e 67 73 20 69 6e 20 74 68 65 20 72 65 6e 64 65 | vertible.to.strings.in.the.rende |
43560 | 72 65 72 20 70 72 6f 63 65 73 73 2e 20 54 68 69 73 20 65 6e 73 75 72 65 73 20 65 78 63 65 70 74 | rer.process..This.ensures.except |
43580 | 69 6f 6e 73 0a 2f 2f 20 63 6f 6e 76 65 72 74 69 6e 67 20 76 61 6c 75 65 73 20 74 6f 20 73 74 72 | ions.//.converting.values.to.str |
435a0 | 69 6e 67 73 20 61 72 65 20 74 68 72 6f 77 6e 20 69 6e 20 74 68 69 73 20 70 72 6f 63 65 73 73 2e | ings.are.thrown.in.this.process. |
435c0 | 0a 63 6f 6e 73 74 20 74 6f 53 74 72 69 6e 67 20 3d 20 28 76 61 6c 75 65 29 20 3d 3e 20 7b 0a 20 | .const.toString.=.(value).=>.{.. |
435e0 | 20 72 65 74 75 72 6e 20 76 61 6c 75 65 20 21 3d 20 6e 75 6c 6c 20 3f 20 60 24 7b 76 61 6c 75 65 | .return.value.!=.null.?.`${value |
43600 | 7d 60 20 3a 20 76 61 6c 75 65 0a 7d 0a 0a 63 6f 6e 73 74 20 77 69 6e 64 6f 77 50 72 6f 78 69 65 | }`.:.value.}..const.windowProxie |
43620 | 73 20 3d 20 7b 7d 0a 0a 63 6f 6e 73 74 20 67 65 74 4f 72 43 72 65 61 74 65 50 72 6f 78 79 20 3d | s.=.{}..const.getOrCreateProxy.= |
43640 | 20 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 67 75 65 73 74 49 64 29 20 3d 3e 20 7b 0a 20 20 6c | .(ipcRenderer,.guestId).=>.{...l |
43660 | 65 74 20 70 72 6f 78 79 20 3d 20 77 69 6e 64 6f 77 50 72 6f 78 69 65 73 5b 67 75 65 73 74 49 64 | et.proxy.=.windowProxies[guestId |
43680 | 5d 0a 20 20 69 66 20 28 70 72 6f 78 79 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 70 72 6f | ]...if.(proxy.==.null).{.....pro |
436a0 | 78 79 20 3d 20 6e 65 77 20 42 72 6f 77 73 65 72 57 69 6e 64 6f 77 50 72 6f 78 79 28 69 70 63 52 | xy.=.new.BrowserWindowProxy(ipcR |
436c0 | 65 6e 64 65 72 65 72 2c 20 67 75 65 73 74 49 64 29 0a 20 20 20 20 77 69 6e 64 6f 77 50 72 6f 78 | enderer,.guestId).....windowProx |
436e0 | 69 65 73 5b 67 75 65 73 74 49 64 5d 20 3d 20 70 72 6f 78 79 0a 20 20 7d 0a 20 20 72 65 74 75 72 | ies[guestId].=.proxy...}...retur |
43700 | 6e 20 70 72 6f 78 79 0a 7d 0a 0a 63 6f 6e 73 74 20 72 65 6d 6f 76 65 50 72 6f 78 79 20 3d 20 28 | n.proxy.}..const.removeProxy.=.( |
43720 | 67 75 65 73 74 49 64 29 20 3d 3e 20 7b 0a 20 20 64 65 6c 65 74 65 20 77 69 6e 64 6f 77 50 72 6f | guestId).=>.{...delete.windowPro |
43740 | 78 69 65 73 5b 67 75 65 73 74 49 64 5d 0a 7d 0a 0a 66 75 6e 63 74 69 6f 6e 20 42 72 6f 77 73 65 | xies[guestId].}..function.Browse |
43760 | 72 57 69 6e 64 6f 77 50 72 6f 78 79 20 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 67 75 65 73 74 | rWindowProxy.(ipcRenderer,.guest |
43780 | 49 64 29 20 7b 0a 20 20 74 68 69 73 2e 63 6c 6f 73 65 64 20 3d 20 66 61 6c 73 65 0a 0a 20 20 64 | Id).{...this.closed.=.false....d |
437a0 | 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 74 68 69 73 2c 20 27 6c 6f 63 61 74 69 6f 6e 27 2c 20 | efineProperty(this,.'location',. |
437c0 | 7b 0a 20 20 20 20 67 65 74 3a 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 72 | {.....get:.function.().{.......r |
437e0 | 65 74 75 72 6e 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 27 45 4c 45 43 | eturn.ipcRenderer.sendSync('ELEC |
43800 | 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 45 42 5f 43 4f | TRON_GUEST_WINDOW_MANAGER_WEB_CO |
43820 | 4e 54 45 4e 54 53 5f 4d 45 54 48 4f 44 5f 53 59 4e 43 27 2c 20 67 75 65 73 74 49 64 2c 20 27 67 | NTENTS_METHOD_SYNC',.guestId,.'g |
43840 | 65 74 55 52 4c 27 29 0a 20 20 20 20 7d 2c 0a 20 20 20 20 73 65 74 3a 20 66 75 6e 63 74 69 6f 6e | etURL').....},.....set:.function |
43860 | 20 28 75 72 6c 29 20 7b 0a 20 20 20 20 20 20 75 72 6c 20 3d 20 72 65 73 6f 6c 76 65 55 52 4c 28 | .(url).{.......url.=.resolveURL( |
43880 | 75 72 6c 29 0a 20 20 20 20 20 20 72 65 74 75 72 6e 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 | url).......return.ipcRenderer.se |
438a0 | 6e 64 53 79 6e 63 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 | ndSync('ELECTRON_GUEST_WINDOW_MA |
438c0 | 4e 41 47 45 52 5f 57 45 42 5f 43 4f 4e 54 45 4e 54 53 5f 4d 45 54 48 4f 44 5f 53 59 4e 43 27 2c | NAGER_WEB_CONTENTS_METHOD_SYNC', |
438e0 | 20 67 75 65 73 74 49 64 2c 20 27 6c 6f 61 64 55 52 4c 27 2c 20 75 72 6c 29 0a 20 20 20 20 7d 0a | .guestId,.'loadURL',.url).....}. |
43900 | 20 20 7d 29 0a 0a 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 63 65 28 60 45 4c 45 43 54 52 | ..})....ipcRenderer.once(`ELECTR |
43920 | 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f 43 | ON_GUEST_WINDOW_MANAGER_WINDOW_C |
43940 | 4c 4f 53 45 44 5f 24 7b 67 75 65 73 74 49 64 7d 60 2c 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 72 | LOSED_${guestId}`,.().=>.{.....r |
43960 | 65 6d 6f 76 65 50 72 6f 78 79 28 67 75 65 73 74 49 64 29 0a 20 20 20 20 74 68 69 73 2e 63 6c 6f | emoveProxy(guestId).....this.clo |
43980 | 73 65 64 20 3d 20 74 72 75 65 0a 20 20 7d 29 0a 0a 20 20 74 68 69 73 2e 63 6c 6f 73 65 20 3d 20 | sed.=.true...})....this.close.=. |
439a0 | 28 29 20 3d 3e 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c | ().=>.{.....ipcRenderer.send('EL |
439c0 | 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e 44 | ECTRON_GUEST_WINDOW_MANAGER_WIND |
439e0 | 4f 57 5f 43 4c 4f 53 45 27 2c 20 67 75 65 73 74 49 64 29 0a 20 20 7d 0a 0a 20 20 74 68 69 73 2e | OW_CLOSE',.guestId)...}....this. |
43a00 | 66 6f 63 75 73 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e | focus.=.().=>.{.....ipcRenderer. |
43a20 | 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 | send('ELECTRON_GUEST_WINDOW_MANA |
43a40 | 47 45 52 5f 57 49 4e 44 4f 57 5f 4d 45 54 48 4f 44 27 2c 20 67 75 65 73 74 49 64 2c 20 27 66 6f | GER_WINDOW_METHOD',.guestId,.'fo |
43a60 | 63 75 73 27 29 0a 20 20 7d 0a 0a 20 20 74 68 69 73 2e 62 6c 75 72 20 3d 20 28 29 20 3d 3e 20 7b | cus')...}....this.blur.=.().=>.{ |
43a80 | 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f | .....ipcRenderer.send('ELECTRON_ |
43aa0 | 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f 4d 45 54 48 | GUEST_WINDOW_MANAGER_WINDOW_METH |
43ac0 | 4f 44 27 2c 20 67 75 65 73 74 49 64 2c 20 27 62 6c 75 72 27 29 0a 20 20 7d 0a 0a 20 20 74 68 69 | OD',.guestId,.'blur')...}....thi |
43ae0 | 73 2e 70 72 69 6e 74 20 3d 20 28 29 20 3d 3e 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 | s.print.=.().=>.{.....ipcRendere |
43b00 | 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 | r.send('ELECTRON_GUEST_WINDOW_MA |
43b20 | 4e 41 47 45 52 5f 57 45 42 5f 43 4f 4e 54 45 4e 54 53 5f 4d 45 54 48 4f 44 27 2c 20 67 75 65 73 | NAGER_WEB_CONTENTS_METHOD',.gues |
43b40 | 74 49 64 2c 20 27 70 72 69 6e 74 27 29 0a 20 20 7d 0a 0a 20 20 74 68 69 73 2e 70 6f 73 74 4d 65 | tId,.'print')...}....this.postMe |
43b60 | 73 73 61 67 65 20 3d 20 28 6d 65 73 73 61 67 65 2c 20 74 61 72 67 65 74 4f 72 69 67 69 6e 29 20 | ssage.=.(message,.targetOrigin). |
43b80 | 3d 3e 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 | =>.{.....ipcRenderer.send('ELECT |
43ba0 | 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f | RON_GUEST_WINDOW_MANAGER_WINDOW_ |
43bc0 | 50 4f 53 54 4d 45 53 53 41 47 45 27 2c 20 67 75 65 73 74 49 64 2c 20 6d 65 73 73 61 67 65 2c 20 | POSTMESSAGE',.guestId,.message,. |
43be0 | 74 6f 53 74 72 69 6e 67 28 74 61 72 67 65 74 4f 72 69 67 69 6e 29 2c 20 77 69 6e 64 6f 77 2e 6c | toString(targetOrigin),.window.l |
43c00 | 6f 63 61 74 69 6f 6e 2e 6f 72 69 67 69 6e 29 0a 20 20 7d 0a 0a 20 20 74 68 69 73 2e 65 76 61 6c | ocation.origin)...}....this.eval |
43c20 | 20 3d 20 28 2e 2e 2e 61 72 67 73 29 20 3d 3e 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 | .=.(...args).=>.{.....ipcRendere |
43c40 | 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e 44 4f 57 5f 4d 41 | r.send('ELECTRON_GUEST_WINDOW_MA |
43c60 | 4e 41 47 45 52 5f 57 45 42 5f 43 4f 4e 54 45 4e 54 53 5f 4d 45 54 48 4f 44 27 2c 20 67 75 65 73 | NAGER_WEB_CONTENTS_METHOD',.gues |
43c80 | 74 49 64 2c 20 27 65 78 65 63 75 74 65 4a 61 76 61 53 63 72 69 70 74 27 2c 20 2e 2e 2e 61 72 67 | tId,.'executeJavaScript',....arg |
43ca0 | 73 29 0a 20 20 7d 0a 7d 0a 0a 6d 6f 64 75 6c 65 2e 65 78 70 6f 72 74 73 20 3d 20 28 69 70 63 52 | s)...}.}..module.exports.=.(ipcR |
43cc0 | 65 6e 64 65 72 65 72 2c 20 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 2c 20 6f 70 65 6e 65 72 | enderer,.guestInstanceId,.opener |
43ce0 | 49 64 2c 20 68 69 64 64 65 6e 50 61 67 65 2c 20 75 73 65 73 4e 61 74 69 76 65 57 69 6e 64 6f 77 | Id,.hiddenPage,.usesNativeWindow |
43d00 | 4f 70 65 6e 29 20 3d 3e 20 7b 0a 20 20 69 66 20 28 67 75 65 73 74 49 6e 73 74 61 6e 63 65 49 64 | Open).=>.{...if.(guestInstanceId |
43d20 | 20 3d 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 2f 2f 20 4f 76 65 72 72 69 64 65 20 64 65 66 61 | .==.null).{.....//.Override.defa |
43d40 | 75 6c 74 20 77 69 6e 64 6f 77 2e 63 6c 6f 73 65 2e 0a 20 20 20 20 77 69 6e 64 6f 77 2e 63 6c 6f | ult.window.close......window.clo |
43d60 | 73 65 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 69 70 63 52 65 6e 64 | se.=.function.().{.......ipcRend |
43d80 | 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 27 45 4c 45 43 54 52 4f 4e 5f 42 52 4f 57 53 45 52 5f | erer.sendSync('ELECTRON_BROWSER_ |
43da0 | 57 49 4e 44 4f 57 5f 43 4c 4f 53 45 27 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 69 66 20 28 | WINDOW_CLOSE').....}...}....if.( |
43dc0 | 21 75 73 65 73 4e 61 74 69 76 65 57 69 6e 64 6f 77 4f 70 65 6e 29 20 7b 0a 20 20 20 20 2f 2f 20 | !usesNativeWindowOpen).{.....//. |
43de0 | 4d 61 6b 65 20 74 68 65 20 62 72 6f 77 73 65 72 20 77 69 6e 64 6f 77 20 6f 72 20 67 75 65 73 74 | Make.the.browser.window.or.guest |
43e00 | 20 76 69 65 77 20 65 6d 69 74 20 22 6e 65 77 2d 77 69 6e 64 6f 77 22 20 65 76 65 6e 74 2e 0a 20 | .view.emit."new-window".event... |
43e20 | 20 20 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 75 72 6c 2c 20 | ...window.open.=.function.(url,. |
43e40 | 66 72 61 6d 65 4e 61 6d 65 2c 20 66 65 61 74 75 72 65 73 29 20 7b 0a 20 20 20 20 20 20 69 66 20 | frameName,.features).{.......if. |
43e60 | 28 75 72 6c 20 21 3d 20 6e 75 6c 6c 20 26 26 20 75 72 6c 20 21 3d 3d 20 27 27 29 20 7b 0a 20 20 | (url.!=.null.&&.url.!==.'').{... |
43e80 | 20 20 20 20 20 20 75 72 6c 20 3d 20 72 65 73 6f 6c 76 65 55 52 4c 28 75 72 6c 29 0a 20 20 20 20 | ......url.=.resolveURL(url)..... |
43ea0 | 20 20 7d 0a 20 20 20 20 20 20 63 6f 6e 73 74 20 67 75 65 73 74 49 64 20 3d 20 69 70 63 52 65 6e | ..}.......const.guestId.=.ipcRen |
43ec0 | 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 | derer.sendSync('ELECTRON_GUEST_W |
43ee0 | 49 4e 44 4f 57 5f 4d 41 4e 41 47 45 52 5f 57 49 4e 44 4f 57 5f 4f 50 45 4e 27 2c 20 75 72 6c 2c | INDOW_MANAGER_WINDOW_OPEN',.url, |
43f00 | 20 74 6f 53 74 72 69 6e 67 28 66 72 61 6d 65 4e 61 6d 65 29 2c 20 74 6f 53 74 72 69 6e 67 28 66 | .toString(frameName),.toString(f |
43f20 | 65 61 74 75 72 65 73 29 29 0a 20 20 20 20 20 20 69 66 20 28 67 75 65 73 74 49 64 20 21 3d 20 6e | eatures)).......if.(guestId.!=.n |
43f40 | 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 67 65 74 4f 72 43 72 65 61 74 | ull).{.........return.getOrCreat |
43f60 | 65 50 72 6f 78 79 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 67 75 65 73 74 49 64 29 0a 20 20 20 | eProxy(ipcRenderer,.guestId).... |
43f80 | 20 20 20 7d 20 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 6e 75 6c 6c 0a | ...}.else.{.........return.null. |
43fa0 | 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 0a 0a 20 20 20 20 69 66 20 28 6f 70 65 6e 65 72 49 64 20 | ......}.....}......if.(openerId. |
43fc0 | 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 20 20 77 69 6e 64 6f 77 2e 6f 70 65 6e 65 72 20 3d | !=.null).{.......window.opener.= |
43fe0 | 20 67 65 74 4f 72 43 72 65 61 74 65 50 72 6f 78 79 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 6f | .getOrCreateProxy(ipcRenderer,.o |
44000 | 70 65 6e 65 72 49 64 29 0a 20 20 20 20 7d 0a 20 20 7d 0a 0a 20 20 2f 2f 20 42 75 74 20 77 65 20 | penerId).....}...}....//.But.we. |
44020 | 64 6f 20 6e 6f 74 20 73 75 70 70 6f 72 74 20 70 72 6f 6d 70 74 28 29 2e 0a 20 20 77 69 6e 64 6f | do.not.support.prompt()....windo |
44040 | 77 2e 70 72 6f 6d 70 74 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 74 68 72 | w.prompt.=.function.().{.....thr |
44060 | 6f 77 20 6e 65 77 20 45 72 72 6f 72 28 27 70 72 6f 6d 70 74 28 29 20 69 73 20 61 6e 64 20 77 69 | ow.new.Error('prompt().is.and.wi |
44080 | 6c 6c 20 6e 6f 74 20 62 65 20 73 75 70 70 6f 72 74 65 64 2e 27 29 0a 20 20 7d 0a 0a 20 20 69 70 | ll.not.be.supported.')...}....ip |
440a0 | 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 5f 57 49 4e | cRenderer.on('ELECTRON_GUEST_WIN |
440c0 | 44 4f 57 5f 50 4f 53 54 4d 45 53 53 41 47 45 27 2c 20 66 75 6e 63 74 69 6f 6e 20 28 65 76 65 6e | DOW_POSTMESSAGE',.function.(even |
440e0 | 74 2c 20 73 6f 75 72 63 65 49 64 2c 20 6d 65 73 73 61 67 65 2c 20 73 6f 75 72 63 65 4f 72 69 67 | t,.sourceId,.message,.sourceOrig |
44100 | 69 6e 29 20 7b 0a 20 20 20 20 2f 2f 20 4d 61 6e 75 61 6c 6c 79 20 64 69 73 70 61 74 63 68 20 65 | in).{.....//.Manually.dispatch.e |
44120 | 76 65 6e 74 20 69 6e 73 74 65 61 64 20 6f 66 20 75 73 69 6e 67 20 70 6f 73 74 4d 65 73 73 61 67 | vent.instead.of.using.postMessag |
44140 | 65 20 62 65 63 61 75 73 65 20 77 65 20 61 6c 73 6f 20 6e 65 65 64 20 74 6f 0a 20 20 20 20 2f 2f | e.because.we.also.need.to.....// |
44160 | 20 73 65 74 20 65 76 65 6e 74 2e 73 6f 75 72 63 65 2e 0a 20 20 20 20 65 76 65 6e 74 20 3d 20 64 | .set.event.source......event.=.d |
44180 | 6f 63 75 6d 65 6e 74 2e 63 72 65 61 74 65 45 76 65 6e 74 28 27 45 76 65 6e 74 27 29 0a 20 20 20 | ocument.createEvent('Event').... |
441a0 | 20 65 76 65 6e 74 2e 69 6e 69 74 45 76 65 6e 74 28 27 6d 65 73 73 61 67 65 27 2c 20 66 61 6c 73 | .event.initEvent('message',.fals |
441c0 | 65 2c 20 66 61 6c 73 65 29 0a 20 20 20 20 65 76 65 6e 74 2e 64 61 74 61 20 3d 20 6d 65 73 73 61 | e,.false).....event.data.=.messa |
441e0 | 67 65 0a 20 20 20 20 65 76 65 6e 74 2e 6f 72 69 67 69 6e 20 3d 20 73 6f 75 72 63 65 4f 72 69 67 | ge.....event.origin.=.sourceOrig |
44200 | 69 6e 0a 20 20 20 20 65 76 65 6e 74 2e 73 6f 75 72 63 65 20 3d 20 67 65 74 4f 72 43 72 65 61 74 | in.....event.source.=.getOrCreat |
44220 | 65 50 72 6f 78 79 28 69 70 63 52 65 6e 64 65 72 65 72 2c 20 73 6f 75 72 63 65 49 64 29 0a 20 20 | eProxy(ipcRenderer,.sourceId)... |
44240 | 20 20 77 69 6e 64 6f 77 2e 64 69 73 70 61 74 63 68 45 76 65 6e 74 28 65 76 65 6e 74 29 0a 20 20 | ..window.dispatchEvent(event)... |
44260 | 7d 29 0a 0a 20 20 77 69 6e 64 6f 77 2e 68 69 73 74 6f 72 79 2e 62 61 63 6b 20 3d 20 66 75 6e 63 | })....window.history.back.=.func |
44280 | 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 | tion.().{.....ipcRenderer.send(' |
442a0 | 45 4c 45 43 54 52 4f 4e 5f 4e 41 56 49 47 41 54 49 4f 4e 5f 43 4f 4e 54 52 4f 4c 4c 45 52 5f 47 | ELECTRON_NAVIGATION_CONTROLLER_G |
442c0 | 4f 5f 42 41 43 4b 27 29 0a 20 20 7d 0a 0a 20 20 77 69 6e 64 6f 77 2e 68 69 73 74 6f 72 79 2e 66 | O_BACK')...}....window.history.f |
442e0 | 6f 72 77 61 72 64 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 69 70 63 52 65 | orward.=.function.().{.....ipcRe |
44300 | 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c 45 43 54 52 4f 4e 5f 4e 41 56 49 47 41 54 49 4f 4e | nderer.send('ELECTRON_NAVIGATION |
44320 | 5f 43 4f 4e 54 52 4f 4c 4c 45 52 5f 47 4f 5f 46 4f 52 57 41 52 44 27 29 0a 20 20 7d 0a 0a 20 20 | _CONTROLLER_GO_FORWARD')...}.... |
44340 | 77 69 6e 64 6f 77 2e 68 69 73 74 6f 72 79 2e 67 6f 20 3d 20 66 75 6e 63 74 69 6f 6e 20 28 6f 66 | window.history.go.=.function.(of |
44360 | 66 73 65 74 29 20 7b 0a 20 20 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 28 27 45 4c | fset).{.....ipcRenderer.send('EL |
44380 | 45 43 54 52 4f 4e 5f 4e 41 56 49 47 41 54 49 4f 4e 5f 43 4f 4e 54 52 4f 4c 4c 45 52 5f 47 4f 5f | ECTRON_NAVIGATION_CONTROLLER_GO_ |
443a0 | 54 4f 5f 4f 46 46 53 45 54 27 2c 20 2b 6f 66 66 73 65 74 29 0a 20 20 7d 0a 0a 20 20 64 65 66 69 | TO_OFFSET',.+offset)...}....defi |
443c0 | 6e 65 50 72 6f 70 65 72 74 79 28 77 69 6e 64 6f 77 2e 68 69 73 74 6f 72 79 2c 20 27 6c 65 6e 67 | neProperty(window.history,.'leng |
443e0 | 74 68 27 2c 20 7b 0a 20 20 20 20 67 65 74 3a 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 | th',.{.....get:.function.().{... |
44400 | 20 20 20 20 72 65 74 75 72 6e 20 69 70 63 52 65 6e 64 65 72 65 72 2e 73 65 6e 64 53 79 6e 63 28 | ....return.ipcRenderer.sendSync( |
44420 | 27 45 4c 45 43 54 52 4f 4e 5f 4e 41 56 49 47 41 54 49 4f 4e 5f 43 4f 4e 54 52 4f 4c 4c 45 52 5f | 'ELECTRON_NAVIGATION_CONTROLLER_ |
44440 | 4c 45 4e 47 54 48 27 29 0a 20 20 20 20 7d 0a 20 20 7d 29 0a 0a 20 20 69 66 20 28 67 75 65 73 74 | LENGTH').....}...})....if.(guest |
44460 | 49 6e 73 74 61 6e 63 65 49 64 20 21 3d 20 6e 75 6c 6c 29 20 7b 0a 20 20 20 20 2f 2f 20 57 65 62 | InstanceId.!=.null).{.....//.Web |
44480 | 76 69 65 77 20 60 64 6f 63 75 6d 65 6e 74 2e 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 60 20 | view.`document.visibilityState`. |
444a0 | 74 72 61 63 6b 73 20 77 69 6e 64 6f 77 20 76 69 73 69 62 69 6c 69 74 79 20 28 61 6e 64 20 69 67 | tracks.window.visibility.(and.ig |
444c0 | 6e 6f 72 65 73 0a 20 20 20 20 2f 2f 20 74 68 65 20 61 63 74 75 61 6c 20 3c 77 65 62 76 69 65 77 | nores.....//.the.actual.<webview |
444e0 | 3e 20 65 6c 65 6d 65 6e 74 20 76 69 73 69 62 69 6c 69 74 79 29 20 66 6f 72 20 62 61 63 6b 77 61 | >.element.visibility).for.backwa |
44500 | 72 64 73 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 2e 0a 20 20 20 20 2f 2f 20 53 65 65 20 64 69 | rds.compatibility......//.See.di |
44520 | 73 63 75 73 73 69 6f 6e 20 69 6e 20 23 39 31 37 38 2e 0a 20 20 20 20 2f 2f 0a 20 20 20 20 2f 2f | scussion.in.#9178......//.....// |
44540 | 20 4e 6f 74 65 20 74 68 61 74 20 74 68 69 73 20 72 65 73 75 6c 74 73 20 69 6e 20 64 75 70 6c 69 | .Note.that.this.results.in.dupli |
44560 | 63 61 74 65 20 76 69 73 69 62 69 6c 69 74 79 63 68 61 6e 67 65 20 65 76 65 6e 74 73 20 28 73 69 | cate.visibilitychange.events.(si |
44580 | 6e 63 65 0a 20 20 20 20 2f 2f 20 43 68 72 6f 6d 69 75 6d 20 61 6c 73 6f 20 66 69 72 65 73 20 74 | nce.....//.Chromium.also.fires.t |
445a0 | 68 65 6d 29 20 61 6e 64 20 70 6f 74 65 6e 74 69 61 6c 6c 79 20 69 6e 63 6f 72 72 65 63 74 20 76 | hem).and.potentially.incorrect.v |
445c0 | 69 73 69 62 69 6c 69 74 79 20 63 68 61 6e 67 65 2e 0a 20 20 20 20 2f 2f 20 57 65 20 73 68 6f 75 | isibility.change......//.We.shou |
445e0 | 6c 64 20 72 65 63 6f 6e 73 69 64 65 72 20 74 68 69 73 20 64 65 63 69 73 69 6f 6e 20 66 6f 72 20 | ld.reconsider.this.decision.for. |
44600 | 45 6c 65 63 74 72 6f 6e 20 32 2e 30 2e 0a 20 20 20 20 6c 65 74 20 63 61 63 68 65 64 56 69 73 69 | Electron.2.0......let.cachedVisi |
44620 | 62 69 6c 69 74 79 53 74 61 74 65 20 3d 20 68 69 64 64 65 6e 50 61 67 65 20 3f 20 27 68 69 64 64 | bilityState.=.hiddenPage.?.'hidd |
44640 | 65 6e 27 20 3a 20 27 76 69 73 69 62 6c 65 27 0a 0a 20 20 20 20 2f 2f 20 53 75 62 73 63 72 69 62 | en'.:.'visible'......//.Subscrib |
44660 | 65 20 74 6f 20 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 20 63 68 61 6e 67 65 73 2e 0a 20 20 | e.to.visibilityState.changes.... |
44680 | 20 20 69 70 63 52 65 6e 64 65 72 65 72 2e 6f 6e 28 27 45 4c 45 43 54 52 4f 4e 5f 47 55 45 53 54 | ..ipcRenderer.on('ELECTRON_GUEST |
446a0 | 5f 49 4e 53 54 41 4e 43 45 5f 56 49 53 49 42 49 4c 49 54 59 5f 43 48 41 4e 47 45 27 2c 20 66 75 | _INSTANCE_VISIBILITY_CHANGE',.fu |
446c0 | 6e 63 74 69 6f 6e 20 28 65 76 65 6e 74 2c 20 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 29 20 | nction.(event,.visibilityState). |
446e0 | 7b 0a 20 20 20 20 20 20 69 66 20 28 63 61 63 68 65 64 56 69 73 69 62 69 6c 69 74 79 53 74 61 74 | {.......if.(cachedVisibilityStat |
44700 | 65 20 21 3d 3d 20 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 29 20 7b 0a 20 20 20 20 20 20 20 | e.!==.visibilityState).{........ |
44720 | 20 63 61 63 68 65 64 56 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 20 3d 20 76 69 73 69 62 69 6c | .cachedVisibilityState.=.visibil |
44740 | 69 74 79 53 74 61 74 65 0a 20 20 20 20 20 20 20 20 64 6f 63 75 6d 65 6e 74 2e 64 69 73 70 61 74 | ityState.........document.dispat |
44760 | 63 68 45 76 65 6e 74 28 6e 65 77 20 45 76 65 6e 74 28 27 76 69 73 69 62 69 6c 69 74 79 63 68 61 | chEvent(new.Event('visibilitycha |
44780 | 6e 67 65 27 29 29 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 2f 2f 20 4d 61 | nge')).......}.....})......//.Ma |
447a0 | 6b 65 20 64 6f 63 75 6d 65 6e 74 2e 68 69 64 64 65 6e 20 61 6e 64 20 64 6f 63 75 6d 65 6e 74 2e | ke.document.hidden.and.document. |
447c0 | 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 20 72 65 74 75 72 6e 20 74 68 65 20 63 6f 72 72 65 | visibilityState.return.the.corre |
447e0 | 63 74 20 76 61 6c 75 65 2e 0a 20 20 20 20 64 65 66 69 6e 65 50 72 6f 70 65 72 74 79 28 64 6f 63 | ct.value......defineProperty(doc |
44800 | 75 6d 65 6e 74 2c 20 27 68 69 64 64 65 6e 27 2c 20 7b 0a 20 20 20 20 20 20 67 65 74 3a 20 66 75 | ument,.'hidden',.{.......get:.fu |
44820 | 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 63 61 63 68 65 | nction.().{.........return.cache |
44840 | 64 56 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 20 21 3d 3d 20 27 76 69 73 69 62 6c 65 27 0a 20 | dVisibilityState.!==.'visible'.. |
44860 | 20 20 20 20 20 7d 0a 20 20 20 20 7d 29 0a 0a 20 20 20 20 64 65 66 69 6e 65 50 72 6f 70 65 72 74 | .....}.....})......definePropert |
44880 | 79 28 64 6f 63 75 6d 65 6e 74 2c 20 27 76 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 27 2c 20 7b | y(document,.'visibilityState',.{ |
448a0 | 0a 20 20 20 20 20 20 67 65 74 3a 20 66 75 6e 63 74 69 6f 6e 20 28 29 20 7b 0a 20 20 20 20 20 20 | .......get:.function.().{....... |
448c0 | 20 20 72 65 74 75 72 6e 20 63 61 63 68 65 64 56 69 73 69 62 69 6c 69 74 79 53 74 61 74 65 0a 20 | ..return.cachedVisibilityState.. |
448e0 | 20 20 20 20 20 7d 0a 20 20 20 20 7d 29 0a 20 20 7d 0a 7d 0a 27 75 73 65 20 73 74 72 69 63 74 27 | .....}.....})...}.}.'use.strict' |
44900 | 0a 0a 63 6f 6e 73 74 20 70 61 74 68 20 3d 20 72 65 71 75 69 72 65 28 27 70 61 74 68 27 29 0a 63 | ..const.path.=.require('path').c |
44920 | 6f 6e 73 74 20 4d 6f 64 75 6c 65 20 3d 20 72 65 71 75 69 72 65 28 27 6d 6f 64 75 6c 65 27 29 0a | onst.Module.=.require('module'). |
44940 | 0a 2f 2f 20 57 65 20 6d 6f 64 69 66 69 65 64 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 70 72 6f | .//.We.modified.the.original.pro |
44960 | 63 65 73 73 2e 61 72 67 76 20 74 6f 20 6c 65 74 20 6e 6f 64 65 2e 6a 73 20 6c 6f 61 64 20 74 68 | cess.argv.to.let.node.js.load.th |
44980 | 65 0a 2f 2f 20 69 6e 69 74 2e 6a 73 2c 20 77 65 20 6e 65 65 64 20 74 6f 20 72 65 73 74 6f 72 65 | e.//.init.js,.we.need.to.restore |
449a0 | 20 69 74 20 68 65 72 65 2e 0a 70 72 6f 63 65 73 73 2e 61 72 67 76 2e 73 70 6c 69 63 65 28 31 2c | .it.here..process.argv.splice(1, |
449c0 | 20 31 29 0a 0a 2f 2f 20 43 6c 65 61 72 20 73 65 61 72 63 68 20 70 61 74 68 73 2e 0a 72 65 71 75 | .1)..//.Clear.search.paths..requ |
449e0 | 69 72 65 28 27 2e 2e 2f 63 6f 6d 6d 6f 6e 2f 72 65 73 65 74 2d 73 65 61 72 63 68 2d 70 61 74 68 | ire('../common/reset-search-path |
44a00 | 73 27 29 0a 0a 2f 2f 20 49 6d 70 6f 72 74 20 63 6f 6d 6d 6f 6e 20 73 65 74 74 69 6e 67 73 2e 0a | s')..//.Import.common.settings.. |
44a20 | 72 65 71 75 69 72 65 28 27 40 65 6c 65 63 74 72 6f 6e 2f 69 6e 74 65 72 6e 61 6c 2f 63 6f 6d 6d | require('@electron/internal/comm |
44a40 | 6f 6e 2f 69 6e 69 74 27 29 0a 0a 2f 2f 20 45 78 70 6f 73 65 20 70 75 62 6c 69 63 20 41 50 49 73 | on/init')..//.Expose.public.APIs |
44a60 | 2e 0a 4d 6f 64 75 6c 65 2e 67 6c 6f 62 61 6c 50 61 74 68 73 2e 70 75 73 68 28 70 61 74 68 2e 6a | ..Module.globalPaths.push(path.j |
44a80 | 6f 69 6e 28 5f 5f 64 69 72 6e 61 6d 65 2c 20 27 61 70 69 27 2c 20 27 65 78 70 6f 72 74 73 27 29 | oin(__dirname,.'api',.'exports') |
44aa0 | 29 0a 0a 2f 2f 20 45 78 70 6f 72 74 20 6e 6f 64 65 20 62 69 6e 64 69 6e 67 73 20 74 6f 20 67 6c | )..//.Export.node.bindings.to.gl |
44ac0 | 6f 62 61 6c 2e 0a 67 6c 6f 62 61 6c 2e 72 65 71 75 69 72 65 20 3d 20 72 65 71 75 69 72 65 0a 67 | obal..global.require.=.require.g |
44ae0 | 6c 6f 62 61 6c 2e 6d 6f 64 75 6c 65 20 3d 20 6d 6f 64 75 6c 65 0a 0a 2f 2f 20 53 65 74 20 74 68 | lobal.module.=.module..//.Set.th |
44b00 | 65 20 5f 5f 66 69 6c 65 6e 61 6d 65 20 74 6f 20 74 68 65 20 70 61 74 68 20 6f 66 20 68 74 6d 6c | e.__filename.to.the.path.of.html |
44b20 | 20 66 69 6c 65 20 69 66 20 69 74 20 69 73 20 66 69 6c 65 3a 20 70 72 6f 74 6f 63 6f 6c 2e 0a 69 | .file.if.it.is.file:.protocol..i |
44b40 | 66 20 28 73 65 6c 66 2e 6c 6f 63 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 20 3d 3d 3d 20 27 66 | f.(self.location.protocol.===.'f |
44b60 | 69 6c 65 3a 27 29 20 7b 0a 20 20 63 6f 6e 73 74 20 70 61 74 68 6e 61 6d 65 20 3d 20 70 72 6f 63 | ile:').{...const.pathname.=.proc |
44b80 | 65 73 73 2e 70 6c 61 74 66 6f 72 6d 20 3d 3d 3d 20 27 77 69 6e 33 32 27 20 26 26 20 73 65 6c 66 | ess.platform.===.'win32'.&&.self |
44ba0 | 2e 6c 6f 63 61 74 69 6f 6e 2e 70 61 74 68 6e 61 6d 65 5b 30 5d 20 3d 3d 3d 20 27 2f 27 20 3f 20 | .location.pathname[0].===.'/'.?. |
44bc0 | 73 65 6c 66 2e 6c 6f 63 61 74 69 6f 6e 2e 70 61 74 68 6e 61 6d 65 2e 73 75 62 73 74 72 28 31 29 | self.location.pathname.substr(1) |
44be0 | 20 3a 20 73 65 6c 66 2e 6c 6f 63 61 74 69 6f 6e 2e 70 61 74 68 6e 61 6d 65 0a 20 20 67 6c 6f 62 | .:.self.location.pathname...glob |
44c00 | 61 6c 2e 5f 5f 66 69 6c 65 6e 61 6d 65 20 3d 20 70 61 74 68 2e 6e 6f 72 6d 61 6c 69 7a 65 28 64 | al.__filename.=.path.normalize(d |
44c20 | 65 63 6f 64 65 55 52 49 43 6f 6d 70 6f 6e 65 6e 74 28 70 61 74 68 6e 61 6d 65 29 29 0a 20 20 67 | ecodeURIComponent(pathname))...g |
44c40 | 6c 6f 62 61 6c 2e 5f 5f 64 69 72 6e 61 6d 65 20 3d 20 70 61 74 68 2e 64 69 72 6e 61 6d 65 28 67 | lobal.__dirname.=.path.dirname(g |
44c60 | 6c 6f 62 61 6c 2e 5f 5f 66 69 6c 65 6e 61 6d 65 29 0a 0a 20 20 2f 2f 20 53 65 74 20 6d 6f 64 75 | lobal.__filename)....//.Set.modu |
44c80 | 6c 65 27 73 20 66 69 6c 65 6e 61 6d 65 20 73 6f 20 72 65 6c 61 74 69 76 65 20 72 65 71 75 69 72 | le's.filename.so.relative.requir |
44ca0 | 65 20 63 61 6e 20 77 6f 72 6b 20 61 73 20 65 78 70 65 63 74 65 64 2e 0a 20 20 6d 6f 64 75 6c 65 | e.can.work.as.expected....module |
44cc0 | 2e 66 69 6c 65 6e 61 6d 65 20 3d 20 67 6c 6f 62 61 6c 2e 5f 5f 66 69 6c 65 6e 61 6d 65 0a 0a 20 | .filename.=.global.__filename... |
44ce0 | 20 2f 2f 20 41 6c 73 6f 20 73 65 61 72 63 68 20 66 6f 72 20 6d 6f 64 75 6c 65 20 75 6e 64 65 72 | .//.Also.search.for.module.under |
44d00 | 20 74 68 65 20 68 74 6d 6c 20 66 69 6c 65 2e 0a 20 20 6d 6f 64 75 6c 65 2e 70 61 74 68 73 20 3d | .the.html.file....module.paths.= |
44d20 | 20 6d 6f 64 75 6c 65 2e 70 61 74 68 73 2e 63 6f 6e 63 61 74 28 4d 6f 64 75 6c 65 2e 5f 6e 6f 64 | .module.paths.concat(Module._nod |
44d40 | 65 4d 6f 64 75 6c 65 50 61 74 68 73 28 67 6c 6f 62 61 6c 2e 5f 5f 64 69 72 6e 61 6d 65 29 29 0a | eModulePaths(global.__dirname)). |
44d60 | 7d 20 65 6c 73 65 20 7b 0a 20 20 67 6c 6f 62 61 6c 2e 5f 5f 66 69 6c 65 6e 61 6d 65 20 3d 20 5f | }.else.{...global.__filename.=._ |
44d80 | 5f 66 69 6c 65 6e 61 6d 65 0a 20 20 67 6c 6f 62 61 6c 2e 5f 5f 64 69 72 6e 61 6d 65 20 3d 20 5f | _filename...global.__dirname.=._ |
44da0 | 5f 64 69 72 6e 61 6d 65 0a 7d 0a | _dirname.}. |