| Index: extensions/renderer/resources/guest_view/guest_view_events.js
|
| diff --git a/extensions/renderer/resources/guest_view/guest_view_events.js b/extensions/renderer/resources/guest_view/guest_view_events.js
|
| index caed8c88af8ad6fa8610980653b99e22c6d60545..f6a7e8308ed4a31af52b31061a73815a20702c23 100644
|
| --- a/extensions/renderer/resources/guest_view/guest_view_events.js
|
| +++ b/extensions/renderer/resources/guest_view/guest_view_events.js
|
| @@ -41,6 +41,11 @@ function GuestViewEvents(view) {
|
| // should be dispatched within this handler function (if desired). With no
|
| // handler function, the DOM event will be dispatched by default each time
|
| // the extension event is caught.
|
| +// |internal| (default: false) specifies that the event will not be dispatched
|
| +// as a DOM event, and will also not appear as an on* property on the view’s
|
| +// element. A |handler| should be specified for all internal events, and
|
| +// |fields| and |cancelable| should be left unspecified (as they are only
|
| +// meaningful for DOM events).
|
| GuestViewEvents.EVENTS = {};
|
|
|
| // Sets up the handling of events.
|
| @@ -57,7 +62,9 @@ GuestViewEvents.prototype.setupEvents = function() {
|
|
|
| // Sets up the handling of the |eventName| event.
|
| GuestViewEvents.prototype.setupEvent = function(eventName, eventInfo) {
|
| - this.setupEventProperty(eventName);
|
| + if (!eventInfo.internal) {
|
| + this.setupEventProperty(eventName);
|
| + }
|
|
|
| var listenerOpts = { instanceId: this.view.viewInstanceId };
|
| if (eventInfo.handler) {
|
| @@ -67,6 +74,11 @@ GuestViewEvents.prototype.setupEvent = function(eventName, eventInfo) {
|
| return;
|
| }
|
|
|
| + // Internal events are not dispatched as DOM events.
|
| + if (eventInfo.internal) {
|
| + return;
|
| + }
|
| +
|
| eventInfo.evt.addListener(function(e) {
|
| var domEvent = this.makeDomEvent(e, eventName);
|
| this.view.dispatchEvent(domEvent);
|
| @@ -79,6 +91,11 @@ GuestViewEvents.prototype.makeDomEvent = function(event, eventName) {
|
| var eventInfo =
|
| GuestViewEvents.EVENTS[eventName] || this.getEvents()[eventName];
|
|
|
| + // Internal events are not dispatched as DOM events.
|
| + if (eventInfo.internal) {
|
| + return null;
|
| + }
|
| +
|
| var details = { bubbles: true };
|
| if (eventInfo.cancelable) {
|
| details.cancelable = true;
|
|
|