Closed Bug 1158522 Opened 9 years ago Closed 9 years ago

JavaScript strict warning: .../mailCommands.js, line 77: SyntaxError: test for equality (==) mistyped as assignment (=)?

Categories

(SeaMonkey :: General, defect)

SeaMonkey 2.33 Branch
defect
Not set
normal

Tracking

(seamonkey2.41 fixed)

RESOLVED FIXED
seamonkey2.41
Tracking Status
seamonkey2.41 --- fixed

People

(Reporter: mmokrejs, Assigned: c0mrad3, Mentored)

Details

(Keywords: polish, Whiteboard: [good first bug][lang=js])

Attachments

(1 file, 2 obsolete files)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0 SeaMonkey/2.33.1
Build ID: 20150425185639



Actual results:

++DOCSHELL 0x7fe755503a00 == 4 [pid = 2313] [id = 4]
++DOMWINDOW == 7 (0x7fe75953e080) [pid = 2313] [serial = 7] [outer = (nil)]
JavaScript strict warning: chrome://messenger/content/mailCommands.js, line 77: SyntaxError: test for equality (==) mistyped as assignment (=)?
JavaScript strict warning: chrome://messenger/content/mailWindowOverlay.js, line 1155: SyntaxError: octal literals and octal escape sequences are deprecated
JavaScript strict warning: resource:///modules/FeedUtils.jsm, line 282: SyntaxError: applying the 'delete' operator to an unqualified name is deprecated
JavaScript strict warning: resource:///modules/FeedUtils.jsm, line 283: SyntaxError: applying the 'delete' operator to an unqualified name is deprecated
JavaScript strict warning: resource:///modules/FeedUtils.jsm, line 308: SyntaxError: applying the 'delete' operator to an unqualified name is deprecated
JavaScript strict warning: resource:///modules/FeedUtils.jsm, line 309: SyntaxError: applying the 'delete' operator to an unqualified name is deprecated
JavaScript strict warning: resource:///modules/FeedUtils.jsm, line 465: SyntaxError: applying the 'delete' operator to an unqualified name is deprecated
JavaScript strict warning: resource:///modules/FeedUtils.jsm, line 1464: SyntaxError: applying the 'delete' operator to an unqualified name is deprecated
JavaScript strict warning: chrome://messenger-newsblog/content/Feed.js, line 412: SyntaxError: applying the 'delete' operator to an unqualified name is deprecated
JavaScript strict warning: chrome://communicator/content/tasksOverlay.js, line 91: SyntaxError: in strict mode code, functions may be declared only at top level or immediately within another function
++DOCSHELL 0x7fe7548e8400 == 5 [pid = 2313] [id = 5]
Mentor: neil, philip.chee
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: polish
Summary: JavaScript strict warning: chrome://messenger/content/mailCommands.js, line 77: SyntaxError: test for equality (==) mistyped as assignment (=)? → Do not use '=' inside 'if()' condition in mailCommands.js, line 77 as it triggers JS strict warnings: SyntaxError: test for equality (==) mistyped as assignment (=)?
Whiteboard: [good first bug][lang=js]
To silence the warning change:
    while (header = currentHeaderData[key]) {
to:
    while ((header = currentHeaderData[key])) {
Summary: Do not use '=' inside 'if()' condition in mailCommands.js, line 77 as it triggers JS strict warnings: SyntaxError: test for equality (==) mistyped as assignment (=)? → JavaScript strict warning: .../mailCommands.js, line 77: SyntaxError: test for equality (==) mistyped as assignment (=)?
(In reply to Philip Chee from comment #1)
> To silence the warning change:
>     while (header = currentHeaderData[key]) {
> to:
>     while ((header = currentHeaderData[key])) {

You too mistyped = instead of '==' I guess 

I would like to work on it can you assign this bug to me
Flags: needinfo?(neil)
(In reply to Tummala Dhanvi from comment #2)
> You too mistyped = instead of '==' I guess 

No, the point is to assign to the variable. Adding the parentheses doesn't really make that clearer either; probably the simplest solution is just to remove that variable and repeat the use of currentHeaderData[key].
Flags: needinfo?(neil)
Attached patch Bug-1158522.patch (obsolete) — Splinter Review
Attachment #8647563 - Flags: review?
Assignee: nobody → dhanvicse
Status: NEW → ASSIGNED
Philip can you review this patch for me ?
Flags: needinfo?(philip.chee)
Comment on attachment 8647563 [details] [diff] [review]
Bug-1158522.patch

Thanks for the patch! But in Comment 3 Neil wrote:

> No, the point is to assign to the variable. Adding the parentheses doesn't
> really make that clearer either; probably the simplest solution is just to
> remove that variable and repeat the use of currentHeaderData[key].
I suggest something like:

    while (currentHeaderData[key]) {
      deliveredTos.push(currentHeaderData[key].headerValue.toLowerCase().trim());
      key = "delivered-to" + index++;
    }
Flags: needinfo?(philip.chee)
Attachment #8647563 - Flags: review? → feedback+
I will do it
(In reply to neil@parkwaycc.co.uk from comment #3)
> (In reply to Tummala Dhanvi from comment #2)
> > You too mistyped = instead of '==' I guess 
> 
> No, the point is to assign to the variable. Adding the parentheses doesn't
> really make that clearer either; probably the simplest solution is just to
> remove that variable and repeat the use of currentHeaderData[key].

but what if the currentHeaderData[key] becomes zero ? 

(I haven't dived into the source so it might be a silly doubt)
Flags: needinfo?(neil)
(In reply to Tummala Dhanvi from comment #8)
> but what if the currentHeaderData[key] becomes zero ? 

The header data won't change as you enumerate it, if that's what you're asking.
Flags: needinfo?(neil)
Attached patch bug-1158522-v2.patch (obsolete) — Splinter Review
Done
Attachment #8647563 - Attachment is obsolete: true
Flags: needinfo?(philip.chee)
Attachment #8670302 - Flags: review+
(In reply to neil@parkwaycc.co.uk from comment #9)
> (In reply to Tummala Dhanvi from comment #8)
> > but what if the currentHeaderData[key] becomes zero ? 
> 
> The header data won't change as you enumerate it, if that's what you're
> asking.

ya that's what I was asking :) so if my patch looks good can you review it for me ?
Flags: needinfo?(neil)
Comment on attachment 8670302 [details] [diff] [review]
bug-1158522-v2.patch

>       deliveredTos.push(header.headerValue.toLowerCase().trim());
This line needs to be changed too.
Flags: needinfo?(neil)
Attachment #8670302 - Flags: review+ → review-
Done, 

I have missed such a silly one clearly written in the comments
Attachment #8670302 - Attachment is obsolete: true
Flags: needinfo?(philip.chee) → needinfo?(neil)
Attachment #8670361 - Flags: review+
Comment on attachment 8670361 [details] [diff] [review]
bug-1158522-v3.patch

You need to set review to ? to request review... let me fix it for you.
Flags: needinfo?(neil)
Attachment #8670361 - Flags: review+
Attachment #8670361 - Flags: review+
(In reply to neil@parkwaycc.co.uk from comment #14)
> Comment on attachment 8670361 [details] [diff] [review]
> bug-1158522-v3.patch
> 
> You need to set review to ? to request review... let me fix it for you.

I didn't know it I thought that I need to keep + for requesting review, I won't repeat this mistake again
Pushed to comm-central:
http://hg.mozilla.org/comm-central/rev/dff28c2b43af
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.41
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: