Closed
Bug 1140725
Opened 10 years ago
Closed 10 years ago
Unreachable code after semicolon-less return statement in isDisabledForEvents.
Categories
(Core :: DOM: Events, defect)
Core
DOM: Events
Tracking
()
RESOLVED
FIXED
mozilla40
Tracking | Status | |
---|---|---|
firefox40 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(1 file, 2 obsolete files)
2.24 KB,
patch
|
Dolske
:
review+
|
Details | Diff | Splinter Review |
patch for bug 1005110 hits following warning.
> SyntaxError: unreachable code after semicolon-less return statement nsContextMenu.js:1529:6
https://hg.mozilla.org/mozilla-central/annotate/d9b06c673f80/browser/base/content/nsContextMenu.js#l1525
> isDisabledForEvents: function(aNode) {
> let ownerDoc = aNode.ownerDocument;
> return
> ownerDoc.defaultView &&
> ownerDoc.defaultView
> .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
> .getInterface(Components.interfaces.nsIDOMWindowUtils)
> .isNodeDisabledForEvents(aNode);
> },
Assignee | ||
Comment 1•10 years ago
|
||
Assignee | ||
Comment 2•10 years ago
|
||
Almost green on try run: https://treeherder.mozilla.org/#/jobs?repo=try&revision=2e7a78e63b62
(I guess the failure in linux asan M(oth) is not related to this patch)
Attachment #8574319 -
Flags: review?(jst)
Comment 3•10 years ago
|
||
Comment on attachment 8574319 [details] [diff] [review]
Fix unreachable code after semicolon-less return statement in nsContextMenu.js.
Thanks for the fix! r=jst, but someone who actually works on this code should stamp this too.
Attachment #8574319 -
Flags: review?(jst)
Attachment #8574319 -
Flags: review?(dolske)
Attachment #8574319 -
Flags: review+
Comment 4•10 years ago
|
||
Comment on attachment 8574319 [details] [diff] [review]
Fix unreachable code after semicolon-less return statement in nsContextMenu.js.
Review of attachment 8574319 [details] [diff] [review]:
-----------------------------------------------------------------
Seems to suppress the context menu as originally intended for <input disabled>.
Attachment #8574319 -
Flags: review?(dolske) → review+
Assignee | ||
Comment 5•10 years ago
|
||
Thank you for reviewing :D
https://hg.mozilla.org/integration/mozilla-inbound/rev/48188cd36ed1
Assignee | ||
Comment 6•10 years ago
|
||
Backed out for mochitest failure on Windows and Mac.
I should've tested on all OS for this type of fix.
https://hg.mozilla.org/integration/mozilla-inbound/rev/1add3c464199
test_contextmenu_input.html seems to expect menu for <input disabled>, so the test itself should be fixed.
Assignee | ||
Comment 7•10 years ago
|
||
test for <input disabled> in test_contextmenu_input.html is no more valid with the behavior change (originally in bug 816340).
could you review that part?
Almost green on try run: https://treeherder.mozilla.org/#/jobs?repo=try&revision=bf719bcf07a3
Attachment #8574319 -
Attachment is obsolete: true
Attachment #8575457 -
Flags: review?(netzen)
Comment 8•10 years ago
|
||
Comment on attachment 8575457 [details] [diff] [review]
Fix unreachable code after semicolon-less return statement in nsContextMenu.js. r=jst,dolske
Review of attachment 8575457 [details] [diff] [review]:
-----------------------------------------------------------------
Please go with one of the original reviewers.
Attachment #8575457 -
Flags: review?(netzen)
Assignee | ||
Comment 9•10 years ago
|
||
Comment on attachment 8575457 [details] [diff] [review]
Fix unreachable code after semicolon-less return statement in nsContextMenu.js. r=jst,dolske
(In reply to Brian R. Bondy [:bbondy] from comment #8)
> Please go with one of the original reviewers.
oops, sorry.
Attachment #8575457 -
Flags: review?(dolske)
Comment 10•10 years ago
|
||
Hum. Now that I think about this some more, and see the related bug 433168, I'm not sure the original addition of this code in 816340 was doing the right thing.
Suppressing the context menu entirely can be bad, because there's no feedback to the user when they attempt to activate it. It so happens most of the menuitems are disabled on disabled-elements, but at least you get feedback by seeing the menu. And, for some users, you'll have access to items provided by addons which may not be disabled (eg Inspect Element from our devtools, and in my case the Copy Short URL addon that globally adds a menu command for everything on the page.)
Smaug, am I missing some reason to make this code functional? (Since you wrote the patch in 816340.) If not, we should just entirely remove isDisabledForEvents() from nsContextMenu.
Tooru: sorry for adding more confusion here. :(
Flags: needinfo?(bugs)
Comment 11•10 years ago
|
||
Meant to add: as far as I can tell from bug 816340 comment 3, around the time that patch was written the context menu was actually _broken_ on disabled elements. And that's why it as being suppressed. But sometime between that claim and when this test was written, it apparently was fixed to work anyway?
Assignee | ||
Comment 12•10 years ago
|
||
Oops, I landed a patch in bug 1005110 leaving this bug unresolved.
Prepared a patch that removes isDisabledForEvents :)
https://treeherder.mozilla.org/#/jobs?repo=try&revision=18dddda0166a
Assignee: nobody → arai.unmht
Attachment #8575457 -
Attachment is obsolete: true
Attachment #8575457 -
Flags: review?(dolske)
Attachment #8587808 -
Flags: review?(dolske)
Attachment #8587808 -
Flags: feedback?(bugs)
Comment 14•10 years ago
|
||
Comment on attachment 8587808 [details] [diff] [review]
Remove isDisabledForEvents from nsContextMenu.js.
Ugh, sorry this got dropped for so long. The minimal way to unblock this would be to add the semicolon to the return, comment out the already-dead code, and leave a bug open on figuring out what the original patch was supposed to do and how to properly fix things.
But seeing as I don't understand if the original fix was even correct (if it had worked), let's just remove the code as you've done here.
Leaving the needinfo on for Smaug in case he wants to investigate further.
Attachment #8587808 -
Flags: review?(dolske)
Attachment #8587808 -
Flags: review+
Attachment #8587808 -
Flags: feedback?(bugs)
Assignee | ||
Comment 15•10 years ago
|
||
Thank you for reviewing :D
https://hg.mozilla.org/integration/mozilla-inbound/rev/b647d34b31b2
Comment 16•10 years ago
|
||
(In reply to Justin Dolske [:Dolske] from comment #10)
> Smaug, am I missing some reason to make this code functional? (Since you
> wrote the patch in 816340.) If not, we should just entirely remove
> isDisabledForEvents() from nsContextMenu.
The reason was to not change the existing behavior, where event wasn't fired at all on disabled elements.
Flags: needinfo?(bugs)
Comment 17•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox40:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Comment 18•10 years ago
|
||
...but apparently I managed to break the old behavior, but perhaps the current behavior is ok.
You need to log in
before you can comment on or make changes to this bug.
Description
•