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

Side by Side Diff: extensions/renderer/resources/guest_view/guest_view_events.js

Issue 2745173002: Set prototype for GuestView*.prototype to null. (Closed)
Patch Set: More nulls. Created 3 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // Event management for GuestViewContainers. 5 // Event management for GuestViewContainers.
6 6
7 var EventBindings = require('event_bindings'); 7 var EventBindings = require('event_bindings');
8 var GuestViewInternalNatives = requireNative('guest_view_internal'); 8 var GuestViewInternalNatives = requireNative('guest_view_internal');
9 var MessagingNatives = requireNative('messaging_natives'); 9 var MessagingNatives = requireNative('messaging_natives');
10 10
11 var CreateEvent = function(name) { 11 var CreateEvent = function(name) {
12 var eventOpts = {supportsListeners: true, supportsFilters: true}; 12 var eventOpts = {supportsListeners: true, supportsFilters: true};
13 return new EventBindings.Event(name, undefined, eventOpts); 13 return new EventBindings.Event(name, undefined, eventOpts);
14 }; 14 };
15 15
16 function GuestViewEvents(view) { 16 function GuestViewEvents(view) {
17 view.events = this; 17 view.events = this;
18 18
19 this.view = view; 19 this.view = view;
20 this.on = {}; 20 this.on = {};
21 21
22 // |setupEventProperty| is normally called automatically, but these events are 22 // |setupEventProperty| is normally called automatically, but these events are
23 // are registered here because they are dispatched from GuestViewContainer 23 // are registered here because they are dispatched from GuestViewContainer
24 // instead of in response to extension events. 24 // instead of in response to extension events.
25 this.setupEventProperty('contentresize'); 25 this.setupEventProperty('contentresize');
26 this.setupEventProperty('resize'); 26 this.setupEventProperty('resize');
27 this.setupEvents(); 27 this.setupEvents();
28 } 28 }
29 29
30 // Prevent GuestViewEvents inadvertently inheritng code from the global Object,
31 // allowing a pathway for unintended execution of user code.
32 // TODO(wjmaclean): Use utils.expose() here instead, track down other issues
33 // of Object inheritance. https://crbug.com/701034
34 GuestViewEvents.prototype.__proto__ = null;
35
30 // |GuestViewEvents.EVENTS| is a dictionary of extension events to be listened 36 // |GuestViewEvents.EVENTS| is a dictionary of extension events to be listened
31 // for, which specifies how each event should be handled. The events are 37 // for, which specifies how each event should be handled. The events are
32 // organized by name, and by default will be dispatched as DOM events with 38 // organized by name, and by default will be dispatched as DOM events with
33 // the same name. 39 // the same name.
34 // |cancelable| (default: false) specifies whether the DOM event's default 40 // |cancelable| (default: false) specifies whether the DOM event's default
35 // behavior can be canceled. If the default action associated with the event 41 // behavior can be canceled. If the default action associated with the event
36 // is prevented, then its dispatch function will return false in its event 42 // is prevented, then its dispatch function will return false in its event
37 // handler. The event must have a specified |handler| for this to be 43 // handler. The event must have a specified |handler| for this to be
38 // meaningful. 44 // meaningful.
39 // |evt| specifies a descriptor object for the extension event. An event 45 // |evt| specifies a descriptor object for the extension event. An event
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 return $Function.apply(func, view.events, $Array.slice(arguments)); 175 return $Function.apply(func, view.events, $Array.slice(arguments));
170 }; 176 };
171 }; 177 };
172 178
173 // Implemented by the derived event manager, if one exists. 179 // Implemented by the derived event manager, if one exists.
174 GuestViewEvents.prototype.getEvents = function() { return {}; }; 180 GuestViewEvents.prototype.getEvents = function() { return {}; };
175 181
176 // Exports. 182 // Exports.
177 exports.$set('GuestViewEvents', GuestViewEvents); 183 exports.$set('GuestViewEvents', GuestViewEvents);
178 exports.$set('CreateEvent', CreateEvent); 184 exports.$set('CreateEvent', CreateEvent);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698