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 the shared functionality for different guestview | 5 // This module implements the shared functionality for different guestview |
6 // containers, such as web_view, app_view, etc. | 6 // containers, such as web_view, app_view, etc. |
7 | 7 |
8 var DocumentNatives = requireNative('document_natives'); | 8 var DocumentNatives = requireNative('document_natives'); |
9 var GuestView = require('guestView').GuestView; | 9 var GuestView = require('guestView').GuestView; |
10 var GuestViewInternalNatives = requireNative('guest_view_internal'); | 10 var GuestViewInternalNatives = requireNative('guest_view_internal'); |
(...skipping 15 matching lines...) Expand all Loading... |
26 privates(this).internalElement = this.createInternalElement$(); | 26 privates(this).internalElement = this.createInternalElement$(); |
27 this.setupFocusPropagation(); | 27 this.setupFocusPropagation(); |
28 var shadowRoot = this.element.createShadowRoot(); | 28 var shadowRoot = this.element.createShadowRoot(); |
29 shadowRoot.appendChild(privates(this).internalElement); | 29 shadowRoot.appendChild(privates(this).internalElement); |
30 | 30 |
31 GuestViewInternalNatives.RegisterView(this.viewInstanceId, this, viewType); | 31 GuestViewInternalNatives.RegisterView(this.viewInstanceId, this, viewType); |
32 } | 32 } |
33 | 33 |
34 // Prevent GuestViewContainer inadvertently inheriting code from the global | 34 // Prevent GuestViewContainer inadvertently inheriting code from the global |
35 // Object, allowing a pathway for executing unintended user code execution. | 35 // Object, allowing a pathway for executing unintended user code execution. |
| 36 // TODO(wjmaclean): Use utils.expose() here instead? Track down other issues |
| 37 // of Object inheritance. https://crbug.com/701034 |
36 GuestViewContainer.prototype.__proto__ = null; | 38 GuestViewContainer.prototype.__proto__ = null; |
37 | 39 |
38 // Forward public API methods from |proto| to their internal implementations. | 40 // Forward public API methods from |proto| to their internal implementations. |
39 GuestViewContainer.forwardApiMethods = function(proto, apiMethods) { | 41 GuestViewContainer.forwardApiMethods = function(proto, apiMethods) { |
40 var createProtoHandler = function(m) { | 42 var createProtoHandler = function(m) { |
41 return function(var_args) { | 43 return function(var_args) { |
42 var internal = privates(this).internal; | 44 var internal = privates(this).internal; |
43 return $Function.apply(internal[m], internal, arguments); | 45 return $Function.apply(internal[m], internal, arguments); |
44 }; | 46 }; |
45 }; | 47 }; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // Delete the callbacks so developers cannot call them and produce unexpected | 300 // Delete the callbacks so developers cannot call them and produce unexpected |
299 // behavior. | 301 // behavior. |
300 delete proto.createdCallback; | 302 delete proto.createdCallback; |
301 delete proto.attachedCallback; | 303 delete proto.attachedCallback; |
302 delete proto.detachedCallback; | 304 delete proto.detachedCallback; |
303 delete proto.attributeChangedCallback; | 305 delete proto.attributeChangedCallback; |
304 } | 306 } |
305 | 307 |
306 // Exports. | 308 // Exports. |
307 exports.$set('GuestViewContainer', GuestViewContainer); | 309 exports.$set('GuestViewContainer', GuestViewContainer); |
OLD | NEW |