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

Unified Diff: lib/requestNotifier.js

Issue 6305806509146112: Issue 427 - Remove non-standard function and getter syntax (Closed)
Patch Set: Wow sorry for those wrong braces, I am so used to a different style that I didn't even realize what… Created May 18, 2014, 10:51 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/io.js ('k') | lib/subscriptionClasses.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/requestNotifier.js
===================================================================
--- a/lib/requestNotifier.js
+++ b/lib/requestNotifier.js
@@ -28,19 +28,19 @@ let nodeData = new WeakMap();
let windowStats = new WeakMap();
let windowSelection = new WeakMap();
let setEntry, hasEntry, getEntry;
if (false)
{
// This branch can be enabled again once all of bug 673468, bug 819131 and
// bug 982561 are fixed and we can use weak maps.
- setEntry = function(map, key, value) map.set(key, value);
- hasEntry = function(map, key) map.has(key);
- getEntry = function(map, key) map.get(key);
+ setEntry = (map, key, value) => map.set(key, value);
+ hasEntry = (map, key) => map.has(key);
+ getEntry = (map, key) => map.get(key);
}
else
{
// Fall back to user data
let dataSeed = Math.random();
let nodeDataProp = "abpNodeData" + dataSeed;
let windowStatsProp = "abpWindowStats" + dataSeed;
let windowSelectionProp = "abpWindowSelection" + dataSeed;
@@ -54,19 +54,19 @@ else
return windowStatsProp;
case windowSelection:
return windowSelectionProp;
default:
return null;
}
};
- setEntry = function(map, key, value) key.setUserData(getProp(map), value, null);
- hasEntry = function(map, key) key.getUserData(getProp(map));
- getEntry = function(map, key) key.getUserData(getProp(map)) || undefined;
+ setEntry = (map, key, value) => key.setUserData(getProp(map), value, null);
+ hasEntry = (map, key) => key.getUserData(getProp(map));
+ getEntry = (map, key) => key.getUserData(getProp(map)) || undefined;
}
/**
* List of notifiers in use - these notifiers need to receive notifications on
* new requests.
* @type RequestNotifier[]
*/
let activeNotifiers = [];
@@ -343,22 +343,28 @@ RequestEntry.prototype =
* Filter that was applied to this request (if any)
* @type Filter
*/
filter: null,
/**
* String representation of the content type, e.g. "subdocument"
* @type String
*/
- get typeDescr() require("contentPolicy").Policy.typeDescr[this.type],
+ get typeDescr()
+ {
+ return require("contentPolicy").Policy.typeDescr[this.type];
+ },
/**
* User-visible localized representation of the content type, e.g. "frame"
* @type String
*/
- get localizedDescr() require("contentPolicy").Policy.localizedDescr[this.type],
+ get localizedDescr()
+ {
+ return require("contentPolicy").Policy.localizedDescr[this.type];
+ },
/**
* Attaches this request object to a DOM node.
*/
attachToNode: function(/**Node*/ node)
{
let existingData = getEntry(nodeData, node);
if (typeof existingData == "undefined")
« no previous file with comments | « lib/io.js ('k') | lib/subscriptionClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld