Closed Bug 313149 Opened 19 years ago Closed 19 years ago

the code of findBar.js should be protected in a prototype

Categories

(Toolkit :: Find Toolbar, enhancement, P1)

1.8 Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla1.8.1alpha3

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

(Keywords: fixed1.8.1)

Attachments

(4 files, 3 obsolete files)

Currently, Firefox's FastFind/FAYT's codes are included by some files.
But the functions and variables are defined on global.
This is not safety. We should protect these functions and variables with prototype.

# See bug 312913.
Everyone:

I'm working on this. Please don't allow to check-in to findBar.js on Trunk for several days.
Status: NEW → ASSIGNED
Attached patch Patch rv1.0 (obsolete) — Splinter Review
Attachment #201440 - Flags: review?(mconnor)
NOTE:
I didn't change any logic.
I only wrapped all variables and functions with gFindBar prototype.
Priority: -- → P1
Target Milestone: --- → Firefox1.6-
Comment on attachment 201441 [details] [diff] [review]
Patch rv1.0(-u8pw)

prevailing style uses this.foo() instead of gFindBar.foo() where possible.

Anyway, this is good cleanup overall for trunk (and possibly Fx2)
(In reply to comment #5)
> (From update of attachment 201441 [details] [diff] [review] [edit])
> prevailing style uses this.foo() instead of gFindBar.foo() where possible.
> 
> Anyway, this is good cleanup overall for trunk (and possibly Fx2)
> 

Mike:

See my comment in the patch. If we use this.foo(), when the method is called by timers or event listeners, |this| keyword doesn't refer to |gFindBar|. Then this.foo() is broken.
I link this.foo(). But if I rewrite so, the patch doesn't work fine :-(
Attached patch Patch rv2.0 (obsolete) — Splinter Review
I provide another way that is using this.foo() style.
But in this patch, we need global functions for event handlers and for timer handlers. However, these name always have "findBar_" prefix.
Attachment #201510 - Flags: review?(mconnor)
Mike:

Please choose from these patches.

rv1.0 uses gFindBar.foo() style, But it doesn't have global functions.
rv2.0 uses this.foo() style, But it has global functions that is having "findBar_" prefix in its name.
Attachment #201510 - Flags: review?(mconnor) → review-
Attached patch Patch rv2.1Splinter Review
We need more changing for browser.js.
If you grant to rv1.0, I will change it too.
Attachment #201510 - Attachment is obsolete: true
Attachment #201518 - Flags: review?(mconnor)
Attachment #201511 - Attachment is obsolete: true
Comment on attachment 201518 [details] [diff] [review]
Patch rv2.1

I like this approach better, thanks!
Attachment #201518 - Flags: review?(mconnor) → review+
checked-in to Trunk. Thanks.


NOTE:

This patch is very big. So, it may have regression.
But don't reopen this bug. Please file a new bug and adding to CC me.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Whiteboard: Don't reopen this. Please file a new bug for this regression.
Whiteboard: Don't reopen this. Please file a new bug for this regression. → Don't reopen this. Please file a new bug for regressions.
Attachment #201440 - Attachment is obsolete: true
Attachment #201440 - Flags: review?(mconnor)
No longer blocks: 314986
Depends on: 314986
This patch is suitable for the branch, right? All found regressions have been fixed, from what I can tell? Masayuki, since the branch and trunk are going to be synced, it would be great if you could ask for approval and land this on the 1.8 branch as well (with the patches from bug 314986 and bug 328036).
(In reply to comment #14)
> This patch is suitable for the branch, right? All found regressions have been
> fixed, from what I can tell? Masayuki, since the branch and trunk are going to
> be synced, it would be great if you could ask for approval and land this on the
> 1.8 branch as well (with the patches from bug 314986 and bug 328036).
> 

We need to work for checking-in to 1.8 branch. Because 1.8's code is changed by Places...
http://bonsai.mozilla.org/cvslog.cgi?file=mozilla/toolkit/components/typeaheadfind/content/findBar.js&rev=HEAD&mark=1.35
http://bonsai.mozilla.org/cvslog.cgi?file=mozilla/toolkit/components/typeaheadfind/content/findBar.js&rev=MOZILLA_1_8_BRANCH&mark=1.21.2.11
(In reply to comment #15)
> We need to work for checking-in to 1.8 branch. Because 1.8's code is changed
> by Places...

How hard would it be to do this merging? If you don't have enough time to do it, let me know and I will.
If we also fix bug 313653 and bug 321481 they are fixed on trunk after this, it is easy work. I don't have much time. If you can work on this, please do it.
Attached patch Branch rollupSplinter Review
Rollup with fixes from bug 313653, bug 314986, bug 321481, and bug 328036.
Attachment #220272 - Flags: approval-branch-1.8.1?(mconnor)
Comment on attachment 220272 [details] [diff] [review]
Branch rollup

Phil, can you point pkasting to this bug, since he's doing other things here.
Attachment #220272 - Flags: approval-branch-1.8.1?(mconnor) → approval-branch-1.8.1+
Whiteboard: Don't reopen this. Please file a new bug for regressions. → [checkin needed (1.8 branch)]
Whiteboard: [checkin needed (1.8 branch)] → [checkin needed (1.8 branch)] (pending, 1.8 branch is closed)
Attachment 220272 [details] [diff] checked in on the 1.8 branch.
Keywords: fixed1.8.1
Whiteboard: [checkin needed (1.8 branch)] (pending, 1.8 branch is closed)
Target Milestone: Firefox 2 → Firefox 2 alpha3
Version: Trunk → 2.0 Branch
Hmm could this fix have broken Thunderbird's findbar on the 1.8.1 branch?

See Bug 338185
Depends on: 338185
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: