| 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 19 matching lines...) Expand all Loading... |
| 30 this.requestId = event.requestId; | 30 this.requestId = event.requestId; |
| 31 this.actionTaken = false; | 31 this.actionTaken = false; |
| 32 | 32 |
| 33 // Add on the request information specific to the request type. | 33 // Add on the request information specific to the request type. |
| 34 for (var infoName in this.event.requestInfo) { | 34 for (var infoName in this.event.requestInfo) { |
| 35 this.event[infoName] = this.event.requestInfo[infoName]; | 35 this.event[infoName] = this.event.requestInfo[infoName]; |
| 36 this.webViewEvent[infoName] = this.event.requestInfo[infoName]; | 36 this.webViewEvent[infoName] = this.event.requestInfo[infoName]; |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 | 39 |
| 40 // Prevent GuestViewEvents inadvertently inheritng code from the global Object, |
| 41 // allowing a pathway for unintended execution of user code. |
| 42 // TODO(wjmaclean): Use utils.expose() here instead, track down other issues |
| 43 // of Object inheritance. https://crbug.com/701034 |
| 44 WebViewActionRequest.prototype.__proto__ = null; |
| 45 |
| 40 // Performs the default action for the request. | 46 // Performs the default action for the request. |
| 41 WebViewActionRequest.prototype.defaultAction = function() { | 47 WebViewActionRequest.prototype.defaultAction = function() { |
| 42 // Do nothing if the action has already been taken or the requester is | 48 // Do nothing if the action has already been taken or the requester is |
| 43 // already gone (in which case its guestInstanceId will be stale). | 49 // already gone (in which case its guestInstanceId will be stale). |
| 44 if (this.actionTaken || | 50 if (this.actionTaken || |
| 45 this.guestInstanceId != this.webViewImpl.guest.getId()) { | 51 this.guestInstanceId != this.webViewImpl.guest.getId()) { |
| 46 return; | 52 return; |
| 47 } | 53 } |
| 48 | 54 |
| 49 this.actionTaken = true; | 55 this.actionTaken = true; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 var WebViewActionRequests = { | 293 var WebViewActionRequests = { |
| 288 WebViewActionRequest: WebViewActionRequest, | 294 WebViewActionRequest: WebViewActionRequest, |
| 289 Dialog: Dialog, | 295 Dialog: Dialog, |
| 290 NewWindow: NewWindow, | 296 NewWindow: NewWindow, |
| 291 PermissionRequest: PermissionRequest, | 297 PermissionRequest: PermissionRequest, |
| 292 FullscreenPermissionRequest: FullscreenPermissionRequest | 298 FullscreenPermissionRequest: FullscreenPermissionRequest |
| 293 }; | 299 }; |
| 294 | 300 |
| 295 // Exports. | 301 // Exports. |
| 296 exports.$set('WebViewActionRequests', WebViewActionRequests); | 302 exports.$set('WebViewActionRequests', WebViewActionRequests); |
| OLD | NEW |