On Wednesday, July 11, 2012 3:27:13 PM UTC+2, Chris Gamache wrote:
Stopped on that line above when propName == 'remove' here's the call stack:
> console.trace()
(anonymous function)
(anonymous function)
evaluate
InjectedScript._evaluateOn
InjectedScript._evaluateAndWrap
InjectedScript.evaluateOnCallFrame
computePropValue mymodule.nocache.js:326
mymodule.__getPropMap mymodule.nocache.js:389
getBindingParameters dev_mode_on.js:324
compile dev_mode_on.js:388
runBookmarklet dev_mode_on.js:414
(anonymous function) dev_mode_on.js:427
(anonymous function)
Are you using any third-party lib? One that would manipulate the Array.prototype?
There's a small bug in the xsiframe linker generated script, rather a "bad practice" than a bug actually: using an Array as if it were an Object first, and using a for…in on it without checking hasOwnProperty; and when combined with the other bad practice of augmenting prototypes, it breaks!
Not really a bug in the generated script, just that it can break relatively easily if there are bugs/bad practices elsewhere.
I just tried it in Chrome dev tools' console:
var values = [];
values['foo'] = 'foo';
values['bar'] = 'bar';
for (var key in values) { console.log(key); }
The above should print "foo" and "bar".
Now, add the following and then start the "for" loop again:
Array.prototype.remove = function() { console.log("remove"); }
(using Array.prototype here, because 'values' is an array; would be true with Obejct.prototype if 'values' had been initialized with "{}")
It'll now print "foo", "bar", "remove".
Should be relatively easy to hack around it: locate __getPropMap in your nocache.js and change the for-loop to add the following "if":
for (key in values) {
if (values.hasOwnProperty(key)) {
...
}
}