diff --git a/lib/media/eme_manager.js b/lib/media/eme_manager.js index 01ebb10c06..b77d913902 100644 --- a/lib/media/eme_manager.js +++ b/lib/media/eme_manager.js @@ -545,7 +545,7 @@ shaka.media.EmeManager.prototype.onSessionMessage_ = function(event) { shaka.log.info('onSessionMessage_', event); shaka.asserts.assert(this.drmScheme_); this.requestLicense_( - event.target || event.customTarget, + event.target, /** @type {!shaka.player.DrmSchemeInfo} */ (this.drmScheme_), event.message); }; diff --git a/lib/util/fake_event_target.js b/lib/util/fake_event_target.js index 5b6b5e1d12..ff2cd9aa31 100644 --- a/lib/util/fake_event_target.js +++ b/lib/util/fake_event_target.js @@ -107,19 +107,28 @@ shaka.util.FakeEventTarget.prototype.removeEventListener = */ shaka.util.FakeEventTarget.prototype.dispatchEvent = function(event) { // Overwrite the Event's properties. Assignment doesn't work in most - // browsers. Object.defineProperties seems to work, although some browsers + // browsers. Object.defineProperty seems to work, although some browsers // need the original properties deleted first. delete event.srcElement; delete event.target; delete event.currentTarget; - Object.defineProperties(event, { - 'srcElement': { 'value': null, 'writable': true }, - // target may be set many times if an event is re-dispatched. - 'target': { 'value': this, 'writable': true }, - // Dupe of target prop, as browsers like IE do not allow this to be redefined, even if CustomEvent is deleted from window. - 'customTarget': { 'value': this, 'writable': true }, - // currentTarget will be set many times by recursiveDispatch_(). - 'currentTarget': { 'value': null, 'writable': true } + + var srcElement_ = null; + Object.defineProperty(event, "srcElement", { + get: function () { return srcElement_; }, + set: function (value) { srcElement_ = value; } + }); + + var target_ = this; + Object.defineProperty(event, "target", { + get: function () { return target_; }, + set: function (value) { target_ = value; } + }); + + var currentTarget_ = null; + Object.defineProperty(event, "currentTarget", { + get: function () { return currentTarget_; }, + set: function (value) { currentTarget_ = value; } }); return this.recursiveDispatch_(event);