Closed
Bug 398399
Opened 18 years ago
Closed 18 years ago
make DOMLinkHandler implement nsIDOMEventListener
Categories
(Firefox :: General, defect)
Firefox
General
Tracking
()
RESOLVED
FIXED
Firefox 3 beta1
People
(Reporter: dao, Assigned: dao)
References
Details
Attachments
(1 file, 2 obsolete files)
|
5.48 KB,
patch
|
mconnor
:
review+
mconnor
:
approval1.9+
|
Details | Diff | Splinter Review |
Spin-off from bug 396203. See bug 396203 comment 9 for details.
| Assignee | ||
Comment 1•18 years ago
|
||
this also contains drive-by cleanup for onLinkAdded
| Assignee | ||
Comment 2•18 years ago
|
||
Attachment #283350 -
Attachment is obsolete: true
Attachment #283351 -
Flags: review?(mconnor)
Attachment #283350 -
Flags: review?(mconnor)
Comment 3•18 years ago
|
||
Comment on attachment 283351 [details] [diff] [review]
patch v1.00001
>- // Verify that the load of this icon is legal.
>- // error pages can load their favicon, to be on the safe side,
>- // only allow chrome:// favicons
>- const aboutNeterr = "about:neterror?";
>- if (targetDoc.documentURI.substr(0, aboutNeterr.length) != aboutNeterr ||
>- !uri.schemeIs("chrome")) {
>+ // Verify that the load of this icon is legal.
>+ // error pages can load their favicon, to be on the safe side,
>+ // only allow chrome:// favicons
>+ if (!/^about:neterror\?/.test(targetDoc.documentURI) ||
>+ !uri.schemeIs("chrome")) {
what's the point of this change? I'm pretty sure its marginally slower. substr or indexOf are about the same speed, regex for straight strings is overkill.
| Assignee | ||
Comment 4•18 years ago
|
||
I think ideally the regex would be compiled once and could be even faster then. But I don't really care either way, I just thought it was cleaner (more compact).
Comment 5•18 years ago
|
||
An indexOf check is as compact as a regexp test and shouldn't be slower than the current code.
| Assignee | ||
Comment 6•18 years ago
|
||
Yeah, my first thought was to use indexOf, but then I realized that scanning the entire string is waste -- we don't want to know the index but if the strings starts with "about:neterror?". So substr makes a little bit more sense, as well as the regex.
| Assignee | ||
Comment 7•18 years ago
|
||
Attachment #283351 -
Attachment is obsolete: true
Attachment #283368 -
Flags: review?(mconnor)
Attachment #283351 -
Flags: review?(mconnor)
Updated•18 years ago
|
Attachment #283368 -
Flags: review?(mconnor)
Attachment #283368 -
Flags: review+
Attachment #283368 -
Flags: approval1.9+
| Assignee | ||
Updated•18 years ago
|
Keywords: checkin-needed
Comment 8•18 years ago
|
||
Checking in browser/base/content/browser.js;
/cvsroot/mozilla/browser/base/content/browser.js,v <-- browser.js
new revision: 1.862; previous revision: 1.861
done
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 3 M9
Comment 9•18 years ago
|
||
(In reply to comment #6)
> Yeah, my first thought was to use indexOf, but then I realized that scanning
> the entire string is waste -- we don't want to know the index but if the
> strings starts with "about:neterror?". So substr makes a little bit more sense,
> as well as the regex.
I doubt we are talking significant (if any) savings here but I tend to program this as
targetDoc.documentURI.lastIndexOf(aboutNeterr, 0) != 0
You need to log in
before you can comment on or make changes to this bug.
Description
•