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

Unified Diff: safari/content.js

Issue 5670052883857408: Fixed properties defined on prototype in Safari background page proxy (Closed)
Patch Set: Created Nov. 17, 2013, 5:16 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: safari/content.js
===================================================================
--- a/safari/content.js
+++ b/safari/content.js
@@ -143,6 +143,10 @@
return this.deserializeSequence(spec.items, array, memo);
}
},
+ getObjectId: function(obj)
+ {
+ return this.objects.indexOf(obj);
Wladimir Palant 2013/11/21 08:15:58 Why iterate through the entire array when we can c
Sebastian Noack 2014/02/26 11:27:19 Done.
+ },
getProperty: function(objectId, property)
{
return this.deserializeResult(
@@ -154,25 +158,26 @@
})
);
},
- createProperty: function(objectId, property, enumerable)
+ createProperty: function(property, enumerable)
{
+ var proxy = this;
return {
get: function()
{
- return this.getProperty(objectId, property);
- }.bind(this),
+ return proxy.getProperty(proxy.getObjectId(this), property);
+ },
set: function(value)
{
- this.checkResult(
- this.send(
+ proxy.checkResult(
+ proxy.send(
{
type: "setProperty",
- objectId: objectId,
+ objectId: proxy.getObjectId(this),
property: property,
- value: this.serialize(value)
+ value: proxy.serialize(value)
})
);
- }.bind(this),
+ },
enumerable: enumerable,
configurable: true
};
@@ -187,7 +192,7 @@
{
type: "callFunction",
functionId: objectId,
- contextId: proxy.objects.indexOf(this),
+ contextId: proxy.getObjectId(this),
args: Array.prototype.map.call(
arguments,
proxy.serialize.bind(proxy)
@@ -241,8 +246,7 @@
for (var property in objectInfo.properties)
if (ignored.indexOf(property) == -1)
Object.defineProperty(obj, property, this.createProperty(
- objectId, property,
- objectInfo.properties[property].enumerable
+ property, objectInfo.properties[property].enumerable
));
Wladimir Palant 2013/11/21 08:15:58 Style nit: please always put brackets around multi
Sebastian Noack 2014/02/26 11:27:19 Done.
if (objectInfo.isFunction)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld