Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/subscriptionClasses.js

Issue 29350382: Issue 4353 - Remove deprecated __proto__ syntax (Closed)
Patch Set: Export extend function too, use Object.keys Created Sept. 2, 2016, 3:05 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/filterNotifier.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/subscriptionClasses.js
diff --git a/lib/subscriptionClasses.js b/lib/subscriptionClasses.js
index f559cb3937f42a8caff29135c7799e90c598183f..a154e7fb603ed1bac727349b6b9b9e13c2654996 100644
--- a/lib/subscriptionClasses.js
+++ b/lib/subscriptionClasses.js
@@ -21,6 +21,7 @@
let {ActiveFilter, BlockingFilter, WhitelistFilter, ElemHideBase} = require("filterClasses");
let {FilterNotifier} = require("filterNotifier");
+let {desc, extend} = require("coreUtils");
/**
* Abstract base class for filter subscriptions
@@ -229,10 +230,7 @@ function SpecialSubscription(url, title)
}
exports.SpecialSubscription = SpecialSubscription;
-SpecialSubscription.prototype =
-{
- __proto__: Subscription.prototype,
-
+SpecialSubscription.prototype = extend(Subscription, {
/**
* Filter types that should be added to this subscription by default
* (entries should correspond to keys in SpecialSubscription.defaultsMap).
@@ -272,14 +270,13 @@ SpecialSubscription.prototype =
if (this._lastDownload)
buffer.push("lastDownload=" + this._lastDownload);
}
-};
+});
-SpecialSubscription.defaultsMap = {
- __proto__: null,
+SpecialSubscription.defaultsMap = Object.create(null, desc({
"whitelist": WhitelistFilter,
"blocking": BlockingFilter,
"elemhide": ElemHideBase
-};
+}));
/**
* Creates a new user-defined filter group.
@@ -327,10 +324,7 @@ function RegularSubscription(url, title)
}
exports.RegularSubscription = RegularSubscription;
-RegularSubscription.prototype =
-{
- __proto__: Subscription.prototype,
-
+RegularSubscription.prototype = extend(Subscription, {
_homepage: null,
_lastDownload: 0,
@@ -383,7 +377,7 @@ RegularSubscription.prototype =
if (this._lastDownload)
buffer.push("lastDownload=" + this._lastDownload);
}
-};
+});
/**
* Class for filter subscriptions updated externally (by other extension)
@@ -398,10 +392,7 @@ function ExternalSubscription(url, title)
}
exports.ExternalSubscription = ExternalSubscription;
-ExternalSubscription.prototype =
-{
- __proto__: RegularSubscription.prototype,
-
+ExternalSubscription.prototype = extend(RegularSubscription, {
/**
* See Subscription.serialize()
*/
@@ -409,7 +400,7 @@ ExternalSubscription.prototype =
{
throw new Error("Unexpected call, external subscriptions should not be serialized");
}
-};
+});
/**
* Class for filter subscriptions updated externally (by other extension)
@@ -424,10 +415,7 @@ function DownloadableSubscription(url, title)
}
exports.DownloadableSubscription = DownloadableSubscription;
-DownloadableSubscription.prototype =
-{
- __proto__: RegularSubscription.prototype,
-
+DownloadableSubscription.prototype = extend(RegularSubscription, {
_downloadStatus: null,
_lastCheck: 0,
_errors: 0,
@@ -549,4 +537,4 @@ DownloadableSubscription.prototype =
if (this.downloadCount)
buffer.push("downloadCount=" + this.downloadCount);
}
-};
+});
« no previous file with comments | « lib/filterNotifier.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld