OSDN Git Service

v1.3.4
authorAoichaan0513 <aoichaan0513@gmail.com>
Sat, 18 May 2019 07:47:44 +0000 (16:47 +0900)
committerAoichaan0513 <aoichaan0513@gmail.com>
Sat, 18 May 2019 07:47:44 +0000 (16:47 +0900)
・Floating Windowのベータ対応
・プライベートモードのログイン情報等がアプリを開き直したときに残るのを修正
・その他バグ・不具合の修正

electron/WindowManager.js
package.json
pages/settings.html

index b1cb64a..d8c2116 100644 (file)
@@ -108,26 +108,10 @@ registerProtocols = () => {
     }, (error) => {
         if (error) console.error('Failed to register protocol: ' + error);
     });
-
-    session.fromPartition('persist:private').protocol.registerFileProtocol('my', (request, callback) => {
-        const parsed = url.parse(request.url);
-
-        if (parsed.hostname.endsWith('.css') || parsed.hostname.endsWith('.js')) {
-            return callback({
-                path: path.join(app.getAppPath(), 'pages', parsed.hostname),
-            });
-        } else {
-            return callback({
-                path: path.join(app.getAppPath(), 'pages', `${parsed.hostname}.html`),
-            });
-        }
-    }, (error) => {
-        if (error) console.error('Failed to register protocol: ' + error);
-    });
 }
 
 registerProtocolWithPrivateMode = (windowId) => {
-    session.fromPartition(`persist:${windowId}`).protocol.registerFileProtocol('my', (request, callback) => {
+    session.fromPartition(windowId).protocol.registerFileProtocol('my', (request, callback) => {
         const parsed = url.parse(request.url);
 
         if (parsed.hostname.endsWith('.css') || parsed.hostname.endsWith('.js')) {
@@ -456,7 +440,7 @@ module.exports = class WindowManager {
                 experimentalFeatures: true,
                 safeDialogs: true,
                 safeDialogsMessage: '今後このページではダイアログを表示しない',
-                ...(String(windowId).startsWith('private') && { partition: `persist:${windowId}` }),
+                ...(String(windowId).startsWith('private') && { partition: windowId }),
                 preload: require.resolve('./Preload')
             }
         });
@@ -466,13 +450,19 @@ module.exports = class WindowManager {
         }
 
         view.webContents.on('did-start-loading', () => {
+            if (view.isDestroyed()) return;
+
             window.webContents.send(`browserview-start-loading-${windowId}`, { id: id });
         });
         view.webContents.on('did-stop-loading', () => {
+            if (view.isDestroyed()) return;
+
             window.webContents.send(`browserview-stop-loading-${windowId}`, { id: id });
         });
 
         view.webContents.on('did-finish-load', (e) => {
+            if (view.isDestroyed()) return;
+
             window.setTitle(view.webContents.getTitle());
             window.webContents.send(`browserview-load-${windowId}`, { id: id, title: view.webContents.getTitle(), url: view.webContents.getURL() });
 
@@ -480,6 +470,8 @@ module.exports = class WindowManager {
         });
 
         view.webContents.on('did-start-navigation', (e) => {
+            if (view.isDestroyed()) return;
+            
             const url = view.webContents.getURL();
 
             if (config.get('adBlocker'))
@@ -489,6 +481,8 @@ module.exports = class WindowManager {
         });
 
         view.webContents.on('page-title-updated', (e) => {
+            if (view.isDestroyed()) return;
+            
             window.setTitle(view.webContents.getTitle());
             window.webContents.send(`browserview-load-${windowId}`, { id: id, title: view.webContents.getTitle(), url: view.webContents.getURL() });
 
@@ -499,6 +493,8 @@ module.exports = class WindowManager {
         });
 
         view.webContents.on('page-favicon-updated', (e, favicons) => {
+            if (view.isDestroyed()) return;
+            
             window.setTitle(view.webContents.getTitle());
             if (favicons.length > 0) {
                 window.webContents.send(`browserview-load-${windowId}`, { id: id, title: view.webContents.getTitle(), url: view.webContents.getURL(), favicon: favicons[0] });
@@ -510,16 +506,22 @@ module.exports = class WindowManager {
         });
 
         view.webContents.on('did-change-theme-color', (e, color) => {
+            if (view.isDestroyed()) return;
+            
             window.setTitle(view.webContents.getTitle());
             window.webContents.send(`browserview-load-${windowId}`, { id: id, title: view.webContents.getTitle(), url: view.webContents.getURL(), color: color });
         });
 
         view.webContents.on('new-window', (e, url) => {
+            if (view.isDestroyed()) return;
+            
             e.preventDefault();
             this.addView(windowId, url, true);
         });
 
         view.webContents.on('context-menu', (e, params) => {
+            if (view.isDestroyed()) return;
+            
             const menu = Menu.buildFromTemplate(
                 [
                     ...(params.linkURL !== '' ?
@@ -701,6 +703,8 @@ module.exports = class WindowManager {
         });
 
         view.webContents.on('before-input-event', (e, input) => {
+            if (view.isDestroyed()) return;
+            
             if ((input.control || input.meta) && input.shift && input.key == 'I') {
                 e.preventDefault();
                 if (view.webContents.isDevToolsOpened()) {
index 079e2e2..d78a4c0 100644 (file)
@@ -1,6 +1,6 @@
 {
        "name": "MyBrowser-Stable",
-       "version": "1.3.1",
+       "version": "1.3.4",
        "private": true,
        "main": "electron/Starter.js",
        "homepage": "./",
index d9a0713..99a450f 100644 (file)
                     <div class="row">
                         <div class="col-md-12">
                             <p><b>MyBrowser</b> は(多分)最新版です</p>
-                            <p class="text-muted">バージョン: 1.2.0 (Dev) (73.0.36831.121)</p>
+                            <p class="text-muted">バージョン: 1.3.4 (Dev) (73.0.36831.121)</p>
                             <hr>
                             <h6>MyBrowser</h6>
                             <p>Copyright 2019 Aoichaan0513. All rights reserved.</p>