Closed Bug 470584 Opened 11 years ago Closed 11 years ago
.call() doesn't set "this" correctly
An Adblock Plus testcase fails in 20081220 build both in Shiretoko and Minefield, I get "this.regexp is undefined" exception. This is thrown in filterClasses.js line 381 (http://hg.mozdev.org/adblockplus/file/9647dfba2b24/src/chrome/content/filterClasses.js#l381) - this.regexp simply cannot be undefined because it is defined in prototype (and redefined for all instances of the class). Switching off JIT makes the testcase run correctly. Minimal changes to the code (e.g. calling this.regexp.toString() or accessing this.text before that line) also make the testcase run correctly. Given that behavior, I am not quite sure how to minimize the testcase.
Figured out that "this" isn't pointing to the object here - it is pointing to the serialize() method itself. Caller is this code: RegExpFilter.prototype.serialize.call(this, buffer); Verified that "this" is correct in the caller. Using Function.apply() instead of Function.call() doesn't change anything.
Summary: TM: "this.regexp is undefined" for a variable defined in prototype → TM: Function.call() doesn't set "this" correctly
Wladimir, can you still reproduce this with the latest tracemonkey build?
This might have been fixed by bug 465214 on tracemonkey (waiting to merge back to mozilla-central).
Yes, tracemonkey nightly 2008122219 works fine, no more failing testcases.
WORKSFORME in 20090107 Minefield and Shiretoko builds, probably fixed by bug 465214.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.