Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1405)

Side by Side Diff: extensions/renderer/resources/guest_view/web_view/web_view_action_requests.js

Issue 1136953017: Add fallback mechanism to release Extension ports if the JS context has been destroyed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/renderer/messaging_bindings.cc ('k') | extensions/renderer/resources/messaging.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This module implements helper objects for the dialog, newwindow, and 5 // This module implements helper objects for the dialog, newwindow, and
6 // permissionrequest <webview> events. 6 // permissionrequest <webview> events.
7 7
8 var MessagingNatives = requireNative('messaging_natives'); 8 var MessagingNatives = requireNative('messaging_natives');
9 var WebViewConstants = require('webViewConstants').WebViewConstants; 9 var WebViewConstants = require('webViewConstants').WebViewConstants;
10 var WebViewInternal = require('webViewInternal').WebViewInternal; 10 var WebViewInternal = require('webViewInternal').WebViewInternal;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 var defaultPrevented = !this.webViewImpl.dispatchEvent(this.webViewEvent); 59 var defaultPrevented = !this.webViewImpl.dispatchEvent(this.webViewEvent);
60 // Set |webViewEvent| to null to break the circular reference to |request| so 60 // Set |webViewEvent| to null to break the circular reference to |request| so
61 // that the garbage collector can eventually collect it. 61 // that the garbage collector can eventually collect it.
62 this.webViewEvent = null; 62 this.webViewEvent = null;
63 if (this.actionTaken) { 63 if (this.actionTaken) {
64 return; 64 return;
65 } 65 }
66 66
67 if (defaultPrevented) { 67 if (defaultPrevented) {
68 // Track the lifetime of |request| with the garbage collector. 68 // Track the lifetime of |request| with the garbage collector.
69 MessagingNatives.BindToGC(request, this.defaultAction.bind(this)); 69 var portId = -1; // (hack) there is no Extension Port to release
70 MessagingNatives.BindToGC(request, this.defaultAction.bind(this), portId);
70 } else { 71 } else {
71 this.defaultAction(); 72 this.defaultAction();
72 } 73 }
73 }; 74 };
74 75
75 // Displays a warning message when an action request is blocked by default. 76 // Displays a warning message when an action request is blocked by default.
76 WebViewActionRequest.prototype.showWarningMessage = function() { 77 WebViewActionRequest.prototype.showWarningMessage = function() {
77 window.console.warn(this.WARNING_MSG_REQUEST_BLOCKED); 78 window.console.warn(this.WARNING_MSG_REQUEST_BLOCKED);
78 }; 79 };
79 80
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 var WebViewActionRequests = { 281 var WebViewActionRequests = {
281 WebViewActionRequest: WebViewActionRequest, 282 WebViewActionRequest: WebViewActionRequest,
282 Dialog: Dialog, 283 Dialog: Dialog,
283 NewWindow: NewWindow, 284 NewWindow: NewWindow,
284 PermissionRequest: PermissionRequest, 285 PermissionRequest: PermissionRequest,
285 FullscreenPermissionRequest: FullscreenPermissionRequest 286 FullscreenPermissionRequest: FullscreenPermissionRequest
286 }; 287 };
287 288
288 // Exports. 289 // Exports.
289 exports.WebViewActionRequests = WebViewActionRequests; 290 exports.WebViewActionRequests = WebViewActionRequests;
OLDNEW
« no previous file with comments | « extensions/renderer/messaging_bindings.cc ('k') | extensions/renderer/resources/messaging.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698