From 9e49ce194eeb51d3526953c1acb74bffba786b81 Mon Sep 17 00:00:00 2001 From: JongHeon Choi Date: Mon, 22 Jun 2015 16:45:25 +0900 Subject: [PATCH] Use Object explicitly with "instanceof" Change-Id: I52b9c5c17355f2c868961fd4313497aa081d3a18 --- src/calendar/js/calendar.js | 4 +++- src/calendar/js/calendar_attendee.js | 4 +++- src/calendar/js/calendar_item.js | 10 ++++++---- src/calendar/js/calendar_recurrence_rule.js | 4 +++- src/calendar/js/common.js | 6 ++++-- src/contact/js/common.js | 4 +++- src/exif/exif_api.js | 4 +++- src/mediacontroller/mediacontroller_api.js | 6 ++++-- src/notification/notification_api.js | 6 ++++-- src/utils/utils_api.js | 6 ++++-- 10 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/calendar/js/calendar.js b/src/calendar/js/calendar.js index c18b3b59..cd4195f0 100755 --- a/src/calendar/js/calendar.js +++ b/src/calendar/js/calendar.js @@ -13,6 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +var _global = window || global || {}; var CalendarType = { EVENT: 'EVENT', @@ -51,7 +53,7 @@ var InternalCalendar = function(data) { } }); - if (data instanceof Object) { + if (data instanceof _global.Object) { for (var prop in data) { if (this.hasOwnProperty(prop)) { this[prop] = data[prop]; diff --git a/src/calendar/js/calendar_attendee.js b/src/calendar/js/calendar_attendee.js index 66dbef2a..0db4f551 100755 --- a/src/calendar/js/calendar_attendee.js +++ b/src/calendar/js/calendar_attendee.js @@ -13,6 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +var _global = window || global || {}; var AttendeeType = { INDIVIDUAL: 'INDIVIDUAL', @@ -143,7 +145,7 @@ var CalendarAttendeeInit = function(data) { } }); - if (data instanceof Object) { + if (data instanceof _global.Object) { for (var prop in data) { if (this.hasOwnProperty(prop)) { this[prop] = data[prop]; diff --git a/src/calendar/js/calendar_item.js b/src/calendar/js/calendar_item.js index 78860da2..f7b012ac 100755 --- a/src/calendar/js/calendar_item.js +++ b/src/calendar/js/calendar_item.js @@ -14,6 +14,8 @@ * limitations under the License. */ +var _global = window || global || {}; + var CalendarTextFormat = { ICALENDAR_20: 'ICALENDAR_20', VCALENDAR_10: 'VCALENDAR_10' @@ -142,7 +144,7 @@ var CalendarItem = function(data) { }, set: function(v) { if (_edit.canEdit) { - if (v instanceof Object) { + if (v instanceof _global.Object) { _id = new CalendarEventId(v.uid, v.rid); } else { _id = converter_.toString(v, true); @@ -334,7 +336,7 @@ var CalendarItem = function(data) { } }); - if (data instanceof Object) { + if (data instanceof _global.Object) { for (var prop in data) { if (this.hasOwnProperty(prop)) { this[prop] = data[prop]; @@ -569,7 +571,7 @@ var CalendarTaskInit = function(data) { } }); - if (data instanceof Object) { + if (data instanceof _global.Object) { for (var prop in data) { if (this.hasOwnProperty(prop)) { this[prop] = data[prop]; @@ -661,7 +663,7 @@ var CalendarEventInit = function(data) { } }); - if (data instanceof Object) { + if (data instanceof _global.Object) { for (var prop in data) { if (this.hasOwnProperty(prop)) { this[prop] = data[prop]; diff --git a/src/calendar/js/calendar_recurrence_rule.js b/src/calendar/js/calendar_recurrence_rule.js index ffd50139..b13ebffc 100755 --- a/src/calendar/js/calendar_recurrence_rule.js +++ b/src/calendar/js/calendar_recurrence_rule.js @@ -14,6 +14,8 @@ * limitations under the License. */ +var _global = window || global || {}; + var RecurrenceRuleFrequency = { DAILY: 'DAILY', WEEKLY: 'WEEKLY', @@ -143,7 +145,7 @@ var CalendarRecurrenceRuleInit = function(data) { } }); - if (data instanceof Object) { + if (data instanceof _global.Object) { for (var prop in data) { if (this.hasOwnProperty(prop)) { this[prop] = data[prop]; diff --git a/src/calendar/js/common.js b/src/calendar/js/common.js index 767e694a..192f7fb4 100755 --- a/src/calendar/js/common.js +++ b/src/calendar/js/common.js @@ -14,6 +14,8 @@ * limitations under the License. */ +var _global = window || global || {}; + var utils_ = xwalk.utils; var dateConverter_ = utils_.dateConverter; var type_ = utils_.type; @@ -115,7 +117,7 @@ ItemConverter.prototype.fromTizenObject = function(item) { } else if (item[prop] instanceof Array) { tmp[prop] = []; for (var i = 0, length = item[prop].length; i < length; i++) { - if (item[prop][i] instanceof Object) { + if (item[prop][i] instanceof _global.Object) { tmp[prop][i] = {}; for (var p in item[prop][i]) { if (item[prop][i][p] instanceof tizen.TZDate) { @@ -128,7 +130,7 @@ ItemConverter.prototype.fromTizenObject = function(item) { tmp[prop] = item[prop]; } } - } else if (item[prop] instanceof Object) { + } else if (item[prop] instanceof _global.Object) { tmp[prop] = {}; for (var p in item[prop]) { if (item[prop][p] instanceof tizen.TZDate) { diff --git a/src/contact/js/common.js b/src/contact/js/common.js index 3e2d494c..5f25a91f 100755 --- a/src/contact/js/common.js +++ b/src/contact/js/common.js @@ -13,6 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +var _global = window || global || {}; var utils_ = xwalk.utils; var type_ = utils_.type; @@ -44,7 +46,7 @@ var _toJsonObject = function(obj) { } return ret; } - if (obj instanceof Object) { + if (obj instanceof _global.Object) { ret = {}; for (var prop in obj) { if (obj.hasOwnProperty(prop)) { diff --git a/src/exif/exif_api.js b/src/exif/exif_api.js index 85d11342..40face01 100755 --- a/src/exif/exif_api.js +++ b/src/exif/exif_api.js @@ -13,6 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +var _global = window || global || {}; var validator_ = xwalk.utils.validator; var type_ = xwalk.utils.type; @@ -574,7 +576,7 @@ tizen.ExifInformation = function() { }); //--- copy values from exifInitDict using setters above. - if (exifInitDict instanceof Object) { + if (exifInitDict instanceof _global.Object) { for (var prop in exifInitDict) { if (this.hasOwnProperty(prop)) { this[prop] = exifInitDict[prop]; diff --git a/src/mediacontroller/mediacontroller_api.js b/src/mediacontroller/mediacontroller_api.js index a19e47ae..d92093b7 100755 --- a/src/mediacontroller/mediacontroller_api.js +++ b/src/mediacontroller/mediacontroller_api.js @@ -14,6 +14,8 @@ * limitations under the License. */ +var _global = window || global || {}; + var utils_ = xwalk.utils; var type_ = utils_.type; var converter_ = utils_.converter; @@ -255,7 +257,7 @@ var MediaControllerMetadata = function(data) { } }); - if (data instanceof Object) { + if (data instanceof _global.Object) { for (var prop in data) { if (data.hasOwnProperty(prop) && this.hasOwnProperty(prop)) { this[prop] = data[prop]; @@ -318,7 +320,7 @@ var MediaControllerPlaybackInfo = function(data) { } }); - if (data instanceof Object) { + if (data instanceof _global.Object) { for (var prop in data) { if (data.hasOwnProperty(prop) && this.hasOwnProperty(prop)) { this[prop] = data[prop]; diff --git a/src/notification/notification_api.js b/src/notification/notification_api.js index 3aa36b8e..c558df9b 100644 --- a/src/notification/notification_api.js +++ b/src/notification/notification_api.js @@ -14,6 +14,8 @@ * limitations under the License. */ +var _global = window || global || {}; + var utils_ = xwalk.utils; var type_ = utils_.type; var converter_ = utils_.converter; @@ -473,7 +475,7 @@ function NotificationInitDict(data) { } }); - if (data instanceof Object) { + if (data instanceof _global.Object) { for (var prop in data) { if (this.hasOwnProperty(prop)) { this[prop] = data[prop]; @@ -539,7 +541,7 @@ function Notification(data) { } }); - if (data instanceof Object) { + if (data instanceof _global.Object) { for (var prop in data) { if (data.hasOwnProperty(prop) && this.hasOwnProperty(prop)) { this[prop] = data[prop]; diff --git a/src/utils/utils_api.js b/src/utils/utils_api.js index f27126bb..c3586a27 100644 --- a/src/utils/utils_api.js +++ b/src/utils/utils_api.js @@ -3,6 +3,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +var _global = window || global || {}; + /** * @deprecated Used only by validateArguments() */ @@ -24,7 +26,7 @@ DateConverter.prototype.toTZDate = function(v, isAllDay) { isAllDay = false; } - if (!(v instanceof Object)) { + if (!(v instanceof _global.Object)) { return v; } @@ -1324,7 +1326,7 @@ var NativeBridge = (function (extension, debug) { // See http://168.219.209.56/gerrit/#/c/23472/ for more details. // In future exception definition could be moved back to Tizen module. function __isObject(object) { - return object instanceof Object; + return object instanceof _global.Object; } function __isUndefined(object) { -- 2.34.1