From ed4593916ee1a1dec5d8eca4c375bb785b3f32b2 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Sun, 11 Aug 2013 20:26:52 +0900 Subject: [PATCH] Fix object flag --- lib/event.js | 72 ++++++++++++++++++++++++------------------- lib/xmlhttprequest.js | 60 ++++++++++++++++++++---------------- 2 files changed, 74 insertions(+), 58 deletions(-) diff --git a/lib/event.js b/lib/event.js index b41d826..0214ca0 100644 --- a/lib/event.js +++ b/lib/event.js @@ -74,39 +74,47 @@ _flag: { configurable: false, enumerable: false, - value: Object.create(Object.prototype, { - canceled: { - configurable: false, - enumerable: true, - value: false, - writable: true - }, - dispatch: { - configurable: false, - enumerable: true, - value: false, - writable: true - }, - initialized: { - configurable: false, - enumerable: true, - value: false, - writable: true - }, - stopImmediatePropagation: { - configurable: false, - enumerable: true, - value: false, - writable: true - }, - stopPropagation: { + get: function getter() { + var flag = Object.create(Object.prototype, { + canceled: { + configurable: false, + enumerable: true, + value: false, + writable: true + }, + dispatch: { + configurable: false, + enumerable: true, + value: false, + writable: true + }, + initialized: { + configurable: false, + enumerable: true, + value: false, + writable: true + }, + stopImmediatePropagation: { + configurable: false, + enumerable: true, + value: false, + writable: true + }, + stopPropagation: { + configurable: false, + enumerable: true, + value: false, + writable: true + } + }); + Object.defineProperty(this, '_flag', { configurable: false, - enumerable: true, - value: false, - writable: true - } - }), - writable: false + enumerable: false, + value: flag, + writable: false + }); + return flag; + } }, bubbles: { configurable: true, diff --git a/lib/xmlhttprequest.js b/lib/xmlhttprequest.js index c8ff8e7..f012e77 100644 --- a/lib/xmlhttprequest.js +++ b/lib/xmlhttprequest.js @@ -99,33 +99,41 @@ _flag: { configurable: false, enumerable: false, - value: Object.create(Object.prototype, { - anonymous: { - configurable: false, - enumerable: true, - value: false, - writable: true - }, - synchronous: { - configurable: false, - enumerable: true, - value: false, - writable: true - }, - uploadComplete: { - configurable: false, - enumerable: true, - value: false, - writable: true - }, - uploadEvents: { + get: function getter() { + var flag = Object.create(Object.prototype, { + anonymous: { + configurable: false, + enumerable: true, + value: false, + writable: true + }, + synchronous: { + configurable: false, + enumerable: true, + value: false, + writable: true + }, + uploadComplete: { + configurable: false, + enumerable: true, + value: false, + writable: true + }, + uploadEvents: { + configurable: false, + enumerable: true, + value: false, + writable: true + } + }); + Object.defineProperty(this, '_flag', { configurable: false, - enumerable: true, - value: false, - writable: true - } - }), - writable: false + enumerable: false, + value: flag, + writable: false + }); + return flag; + } }, _properties: { configurable: false,