OLD | NEW |
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 Loading... |
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 Loading... |
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; |
OLD | NEW |