I was reading some source code of a firefox extension and i saw some expression like
0*this;
dose this expression means anything ?
ps: I’m chinese, if there is some thing wrong with my English, please tell me, Thanks!
Here is a function of the extension;
function inGetter(){
0*this;
var gin= Components.lookupMethod(this,"innerHTML")();
gin=String.newTainted(gin,"divElement.INNERHTML");
if(__domIntruderObj.settings.enabled )
__domIntruderObj.log("Getter",this.tagName+".value",gin, __domIntruderObj.util.getCallStack(arguments));
return gin;
}
The code is part of an XSS detection Firefox extension.
As mentioned in another answer, multiplication causes a call to the engine’s internal
DefaultValuemethod. What happens there is: it triesvalueOfandtoStringbefore throwing an error. For example,So this side-effect can be used to gain some information on the object. Particularly, there is some custom
toStringimplementation in the code, which I think this is used to generate some call stack log. I haven’t really gone into the details though.