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

Unified Diff: lib/subscriptionClasses.js

Issue 29746555: Issue 6564 - Replace desc and extend with __proto__ (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created April 8, 2018, 8:57 a.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
===================================================================
--- a/lib/subscriptionClasses.js
+++ b/lib/subscriptionClasses.js
@@ -19,17 +19,16 @@
/**
* @fileOverview Definition of Subscription class and its subclasses.
*/
const {ActiveFilter, BlockingFilter,
WhitelistFilter, ElemHideBase} = require("./filterClasses");
const {FilterNotifier} = require("./filterNotifier");
-const {desc, extend} = require("./coreUtils");
/**
* Abstract base class for filter subscriptions
*
* @param {string} url download location of the subscription
* @param {string} [title] title of the filter subscription
* @constructor
*/
@@ -235,17 +234,19 @@
* @augments Subscription
*/
function SpecialSubscription(url, title)
{
Subscription.call(this, url, title);
}
exports.SpecialSubscription = SpecialSubscription;
-SpecialSubscription.prototype = extend(Subscription, {
+SpecialSubscription.prototype = {
+ __proto__: Subscription.prototype,
+
/**
* Filter types that should be added to this subscription by default
* (entries should correspond to keys in SpecialSubscription.defaultsMap).
* @type {string[]}
*/
defaults: null,
/**
@@ -282,23 +283,24 @@
this.defaults.filter(
type => type in SpecialSubscription.defaultsMap
).join(" ")
);
}
if (this._lastDownload)
buffer.push("lastDownload=" + this._lastDownload);
}
-});
+};
-SpecialSubscription.defaultsMap = Object.create(null, desc({
+SpecialSubscription.defaultsMap = {
+ __proto__: null,
whitelist: WhitelistFilter,
blocking: BlockingFilter,
elemhide: ElemHideBase
-}));
+};
/**
* Creates a new user-defined filter group.
* @param {string} [title] title of the new filter group
* @return {SpecialSubscription}
*/
SpecialSubscription.create = function(title)
{
@@ -339,17 +341,19 @@
* @augments Subscription
*/
function RegularSubscription(url, title)
{
Subscription.call(this, url, title || url);
}
exports.RegularSubscription = RegularSubscription;
-RegularSubscription.prototype = extend(Subscription, {
+RegularSubscription.prototype = {
+ __proto__: Subscription.prototype,
+
_homepage: null,
_lastDownload: 0,
/**
* Filter subscription homepage if known
* @type {string}
*/
get homepage()
@@ -396,58 +400,62 @@
serialize(buffer)
{
Subscription.prototype.serialize.call(this, buffer);
if (this._homepage)
buffer.push("homepage=" + this._homepage);
if (this._lastDownload)
buffer.push("lastDownload=" + this._lastDownload);
}
-});
+};
/**
* Class for filter subscriptions updated externally (by other extension)
* @param {string} url see Subscription()
* @param {string} [title] see Subscription()
* @constructor
* @augments RegularSubscription
*/
function ExternalSubscription(url, title)
{
RegularSubscription.call(this, url, title);
}
exports.ExternalSubscription = ExternalSubscription;
-ExternalSubscription.prototype = extend(RegularSubscription, {
+ExternalSubscription.prototype = {
+ __proto__: RegularSubscription.prototype,
+
/**
* See Subscription.serialize()
* @inheritdoc
*/
serialize(buffer)
{
throw new Error(
"Unexpected call, external subscriptions should not be serialized"
);
}
-});
+};
/**
* Class for filter subscriptions updated externally (by other extension)
* @param {string} url see Subscription()
* @param {string} [title] see Subscription()
* @constructor
* @augments RegularSubscription
*/
function DownloadableSubscription(url, title)
{
RegularSubscription.call(this, url, title);
}
exports.DownloadableSubscription = DownloadableSubscription;
-DownloadableSubscription.prototype = extend(RegularSubscription, {
+DownloadableSubscription.prototype = {
+ __proto__: RegularSubscription.prototype,
+
_downloadStatus: null,
_lastCheck: 0,
_errors: 0,
/**
* Status of the last download (ID of a string)
* @type {string}
*/
@@ -566,9 +574,9 @@
buffer.push("errors=" + this.errors);
if (this.version)
buffer.push("version=" + this.version);
if (this.requiredVersion)
buffer.push("requiredVersion=" + this.requiredVersion);
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