Closed
Bug 445807
Opened 16 years ago
Closed 16 years ago
Port |Bug 400248 – Remove strres.js use in nsContextMenu.js| to SeaMonkey
Categories
(SeaMonkey :: MailNews: Message Display, defect)
SeaMonkey
MailNews: Message Display
Tracking
(Not tracked)
RESOLVED
FIXED
seamonkey2.0a1
People
(Reporter: sgautherie, Assigned: sgautherie)
References
Details
Attachments
(1 file, 5 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review |
Assignee | ||
Comment 1•16 years ago
|
||
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9.0.2pre) Gecko/2008071502 SeaMonkey/2.0a1pre] (nightly) (W2Ksp4)
*|isTextSelection()|: Synchronize/Improve over Thunderbird.
*|setWallpaper()|: While there, I "rewrote" it a little.
Comment on attachment 330093 [details] [diff] [review]
(Av1) "Remove strres.js" part
>Index: nsContextMenu.js
>===================================================================
>+ const buttonPressed = promptService.confirmEx(window, promptTitle, promptMsg,
>+ (promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0) +
>+ (promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1),
This line doesn't appear to be lined up with the others.
>+ promptConfirmButton, null, null, null, {value: 0});
>+ /**
>+ * Determines whether the focused window has selected text, and if so
>+ * formats the first 15 characters for the label of the context-searchselect
>+ * element according to the searchText string.
>+ * @return true if there is selected text, false if not
>+ */
>+ isTextSelection : function CM_isTextSelection() {
>+ var searchSelectText = this.searchSelected(16);
>+ const result = searchSelectText != "";
>+
>+ if (result) {
>+ searchSelectText = searchSelectText.toString();
>+ if (searchSelectText.length > 15)
>+ searchSelectText = searchSelectText.substr(0, 15) + "...";
>+
>+ // Format "Search for <selection>" string to show in menu.
>+ // Use |getStringBundle()| from <contentAreaUtils.js>.
>+ searchSelectText = getStringBundle().formatStringFromName(
>+ "searchText", [searchSelectText], 1);
>+ this.setItemAttr("context-searchselect", "label", searchSelectText);
>+ }
>+
>+ return result;
> },
I would say too much change just for the sake of white space tidy up. Just make the string bundle changes.
Assignee | ||
Comment 3•16 years ago
|
||
(In reply to comment #2)
> This line doesn't appear to be lined up with the others.
Yes, because it's the same parameter (+), whereas the others are different parameters (,).
Do you confirm that you want this aligned too ?
(In reply to comment #3)
> (In reply to comment #2)
> > This line doesn't appear to be lined up with the others.
>
> Yes, because it's the same parameter (+), whereas the others are different
> parameters (,).
> Do you confirm that you want this aligned too ?
>
Sorry, didn't spot the (+), leave as you did it then.
Assignee | ||
Comment 5•16 years ago
|
||
(In reply to comment #2)
> I would say too much change just for the sake of white space tidy up. Just make
Actually, it is:
1- the string bundle changes.
2- |result| optimization, and |selection| merge into |searchSelectText|.
3- white space tidy up, and synchronization with Thunderbird.
> the string bundle changes.
I still think it's better to do the whole function "once for all".
Do you confirm that you want 1- only ?
(In reply to comment #5)
> (In reply to comment #2)
> > I would say too much change just for the sake of white space tidy up. Just make
>
> Actually, it is:
> 1- the string bundle changes.
> 2- |result| optimization, and |selection| merge into |searchSelectText|.
> 3- white space tidy up, and synchronization with Thunderbird.
>
> > the string bundle changes.
>
> I still think it's better to do the whole function "once for all".
Yes, do it all, there are more non-white space changes than I initially saw.
Assignee | ||
Comment 7•16 years ago
|
||
Av1, with a split line.
Attachment #330093 -
Attachment is obsolete: true
Attachment #330397 -
Flags: review?(iann_bugzilla)
Attachment #330093 -
Flags: review?(db48x)
Comment on attachment 330397 [details] [diff] [review]
(Av1a) "Remove strres.js" part
>Index: nsContextMenu.js
>===================================================================
>- //Get selected object and convert it to a string to get
>- //selected text. Only use the first 15 chars.
>- isTextSelection : function() {
>+ isTextSelection : function CM_isTextSelection() {
Why CM_isTextSelection added other than this what appears in TB?
r=me with question answered.
Attachment #330397 -
Flags: review?(iann_bugzilla) → review+
Assignee | ||
Comment 9•16 years ago
|
||
(In reply to comment #8)
> >+ isTextSelection : function CM_isTextSelection() {
> Why CM_isTextSelection added other than this what appears in TB?
This is the only reason:
*It helps to synchronize files :-)
*I know: Firefox does not have it (yet)...
and synchronizing with Firefox is not the purpose of this bug :-|
*Iirc, this (kind of) name is used is error console (reports), instead of "anonymous" :-))
Keywords: checkin-needed
Whiteboard: [c-n: Leave opened]
Assignee | ||
Comment 11•16 years ago
|
||
Comment on attachment 330397 [details] [diff] [review]
(Av1a) "Remove strres.js" part
IIRC, Ian prefers I ask for sr too on this one.
Attachment #330397 -
Flags: superreview?(jag)
Comment 12•16 years ago
|
||
Comment on attachment 330397 [details] [diff] [review]
(Av1a) "Remove strres.js" part
>- var winhooks = Components.classes[ "@mozilla.org/winhooks;1" ].
>- getService(Components.interfaces.nsIWindowsHooks);
>-
>- winhooks.setImageAsWallpaper(this.target, false);
>+ Components.classes["@mozilla.org/winhooks;1"]
>+ .getService(Components.interfaces.nsIWindowsHooks)
>+ .setImageAsWallpaper(this.target, false);
This is due to get switched over to the shell service so it's worth patching.
I'm also not terribly keen on your var/const changes.
>+ isTextSelection : function CM_isTextSelection() {
Why the CM_ prefix?
>+ const result = searchSelectText != "";
As we're changing this already, we might as well return false early instead.
>+ searchSelectText = searchSelectText.toString();
This is in fact already a string. (It used to be a selection object.)
Assignee | ||
Comment 13•16 years ago
|
||
Av1a, with comment 12 suggestion(s).
(In reply to comment #12)
> This is due to get switched over to the shell service so it's worth patching.
I assume you meant _not_ worth.
> >+ isTextSelection : function CM_isTextSelection() {
> Why the CM_ prefix?
Initials of |nsContextMenu.prototype|.
That's how I saw it done elsewhere...
Attachment #330397 -
Attachment is obsolete: true
Attachment #333644 -
Flags: superreview?(neil)
Attachment #330397 -
Flags: superreview?(jag)
Comment 14•16 years ago
|
||
(In reply to comment #13)
> (In reply to comment #12)
> > This is due to get switched over to the shell service so it's worth patching.
> I assume you meant _not_ worth.
Oops, yes!
> > >+ isTextSelection : function CM_isTextSelection() {
> > Why the CM_ prefix?
> Initials of |nsContextMenu.prototype|.
> That's how I saw it done elsewhere...
Well, I don't like it my self. Other review comments to follow...
Comment 15•16 years ago
|
||
Hmm, I just noticed that although this stops using strres.js it simply calls the stringbundle service directly although the <stringbundle> element has a neater API (e.g. don't need to pass the array length when formatting a string).
I guess that's existing code so it would be covered by a separate bug.
Comment 16•16 years ago
|
||
Comment on attachment 333644 [details] [diff] [review]
(Av1b) "Remove strres.js" part
>- (promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0) +
>- (promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1),
>- promptConfirmButton, null, null, null, {value:0});
>+ (promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0) +
>+ (promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1),
>+ promptConfirmButton, null, null, null, {value: 0});
>
> if (buttonPressed != 0)
> return;
>
> var winhooks = Components.classes[ "@mozilla.org/winhooks;1" ].
> getService(Components.interfaces.nsIWindowsHooks);
>-
Hmm, your "undo" isn't quite right ;-)
>+ if (searchSelectText == "")
This could be tweaked to if (!searchSelectText)
>+ searchSelectText = getStringBundle().formatStringFromName(
>+ "searchText",
>+ [searchSelectText], 1);
Still trying to think of a way to wrap this nicely in only two lines...
Assignee | ||
Comment 17•16 years ago
|
||
(In reply to comment #15)
> I guess that's existing code so it would be covered by a separate bug.
Moved to bug 445831 comment 2 ;-)
Assignee | ||
Comment 18•16 years ago
|
||
Av1b, with comment 14 and comment 16 suggestion(s),
plus an unbitrot/unregression I had missed.
(In reply to comment #16)
> Hmm, your "undo" isn't quite right ;-)
Well, I had left this white space cleanup on purpose ;-<
> Still trying to think of a way to wrap this nicely in only two lines...
Actually, the answer is in the need to revert to the old code :->
Attachment #333644 -
Attachment is obsolete: true
Attachment #333654 -
Flags: superreview?(neil)
Attachment #333644 -
Flags: superreview?(neil)
Comment 19•16 years ago
|
||
Comment on attachment 333654 [details] [diff] [review]
(Av1c) "Remove strres.js" part
> var buttonPressed = promptService.confirmEx(window, promptTitle, promptMsg,
>- (promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0) +
>- (promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1),
>- promptConfirmButton, null, null, null, {value:0});
>+ (promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0) +
>+ (promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1),
>+ promptConfirmButton, null, null, null, {value: 0});
Actually it is correct for all the lines to line up, and it's not worth making whitespace changes for their own sake (I guess this should have been done when gPromptService was removed but it's too late now.) sr=me with this reverted.
Attachment #333654 -
Flags: superreview?(neil) → superreview+
Assignee | ||
Comment 20•16 years ago
|
||
Av1c, with comment 19 suggestion(s).
Attachment #333654 -
Attachment is obsolete: true
Assignee | ||
Updated•16 years ago
|
Flags: in-testsuite-
Keywords: checkin-needed
QA Contact: search
Whiteboard: [c-n: Leave opened] → [c-n: Av1d // Leave opened]
Comment 21•16 years ago
|
||
Comment on attachment 334298 [details] [diff] [review]
(Av1d) "Remove strres.js" part
[Checkin: Comment 21]
Pushed to comm-central, changeset edb1732a88c3
Assignee | ||
Updated•16 years ago
|
Attachment #334298 -
Attachment description: (Av1d) "Remove strres.js" part → (Av1d) "Remove strres.js" part
[Checkin: Comment 21]
Assignee | ||
Updated•16 years ago
|
Keywords: checkin-needed
Whiteboard: [c-n: Av1d // Leave opened]
Assignee | ||
Comment 22•16 years ago
|
||
Feedback port Av1d to Thunderbird,
to stay as much in sync' as possible.
Attachment #335275 -
Flags: review?(mkmelin+mozilla)
Assignee | ||
Updated•16 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Comment 23•16 years ago
|
||
Comment on attachment 335275 [details] [diff] [review]
(Bv1-TB) <nsContextMenu.js>
[Superseded by bug 463003]
The lower part isn't indented properly...
But then again, Thunderbird doesn't have any context-searchselect, and the setting search text part of the code should just be removed from that function. (Preferably in a new bug.)
In general it seems very odd to me that that part isn't in it's own function, in seamonkey.
Attachment #335275 -
Flags: review?(mkmelin+mozilla) → review-
Assignee | ||
Updated•16 years ago
|
Attachment #335275 -
Attachment description: (Bv1-TB) <nsContextMenu.js> → (Bv1-TB) <nsContextMenu.js>
[Superseded by bug 463003]
Attachment #335275 -
Attachment is obsolete: true
You need to log in
before you can comment on or make changes to this bug.
Description
•