Closed Bug 1056035 Opened 10 years ago Closed 10 years ago

Unnecessarily line displayed above Find Updates option for h264 plugin

Categories

(Toolkit :: Add-ons Manager, defect)

defect
Not set
minor
Points:
3

Tracking

()

VERIFIED FIXED
mozilla35
Iteration:
35.2
Tracking Status
firefox33 --- affected
firefox35 --- verified

People

(Reporter: ikram, Assigned: bruteforks, Mentored)

Details

(Whiteboard: [lang=js])

Attachments

(2 files, 4 obsolete files)

Attached image screenshot.jpg
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36 OPR/23.0.1522.77

Steps to reproduce:

Install OpenH264 Video Codec plugin . Open Add-ons Manager . Double click on the OpenH264 Plugin . Now in the information area of this plugin , in a space , click right of the mouse button.


Actual results:

You will see a extra line above find updates


Expected results:

The line shouldn't be here.
Severity: normal → minor
Reproducible on:

latest Nightly (Build ID: 20140819030202) : Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0

latest Aurora (Build ID: ) : User agent
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: firefox-backlog+
Reproducible on latest Aurora (Build ID: 20140819004001) : Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
The broken assumption here is that we only need to hide the separator if we have only one active context menu entry:
http://hg.mozilla.org/mozilla-central/annotate/ffdd1a398105/toolkit/mozapps/extensions/content/extensions.js#l448
Instead we should only count the number of enabled entries that come *before* the separator.

We can add a check for this to the detail view tests here:
http://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/test/browser/browser_openH264.js

This file shows how to get the context menu in a browser test (gContextMenu):
http://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/test/browser/browser_bug591465.js
Mentor: georg.fritzsche
Points: --- → 3
Whiteboard: [lang=js]
Hi, I am new to Bugzilla. I just graduated with a degree in computer science and want to get involved. I've built mozilla-central, can run the nightly build of Firefox, can reproduce the bug, and have located the files relevant to this bug.

I'd like to have a crack at it. Would it be possible to have some guidance to get me started?

Cheers!
Great, welcome!

I would ignore the tests at first and test whether the first paragraph of comment 3 works out.
If in [1] we break out of the loop when we encounter |menuSep| (which is one of the children of the context menu per [2]) and adjust the .hidden condition below the context, the bug should be fixed. 

Feel free to also contact me directly per mail or IRC (gfritzsche there) if something is unclear.

[1] http://hg.mozilla.org/mozilla-central/annotate/5bd6e09f074e/toolkit/mozapps/extensions/content/extensions.js#l441
[2] http://hg.mozilla.org/mozilla-central/annotate/5bd6e09f074e/toolkit/mozapps/extensions/content/extensions.xul#l57
Attached patch Patch v1 for bug 1056035 (obsolete) — Splinter Review
Thanks Georg.

I have attached a patch which hides the separator. Is this along the right lines?
Comment on attachment 8493233 [details] [diff] [review]
Patch v1 for bug 1056035

Review of attachment 8493233 [details] [diff] [review]:
-----------------------------------------------------------------

This looks like it should work right to me.

::: toolkit/mozapps/extensions/content/extensions.js
@@ +438,3 @@
>  
>        var menuSep = document.getElementById("addonitem-menuseparator");
>        var countEnabledMenuCmds = 0;

The meaning for this variable changed, i think we should rename it accordingly.

@@ +442,5 @@
>          if (child.nodeName == "menuitem" &&
>            gViewController.isCommandEnabled(child.command)) {
>              countEnabledMenuCmds++;
>          }
> +        if (child.nodeName == "menuseparator") {

You should be able to just compare them directly, |child == menuSep|.
Move this check up before the previous one or make it an |else if ...| to avoid double comparisons.
Attached patch bug1056035v1.1.patch (obsolete) — Splinter Review
Ok, I made the suggested adjustments. Is the new variable name I provided appropriate?
Attachment #8493233 - Attachment is obsolete: true
Comment on attachment 8493793 [details] [diff] [review]
bug1056035v1.1.patch

Review of attachment 8493793 [details] [diff] [review]:
-----------------------------------------------------------------

This looks good, have you tried it out?
Are the comments on the test changes helpful?

::: toolkit/mozapps/extensions/content/extensions.js
@@ +436,5 @@
>        var addon = gViewController.currentViewObj.getSelectedAddon();
>        contextMenu.setAttribute("addontype", addon.type);
>  
>        var menuSep = document.getElementById("addonitem-menuseparator");
> +      var countMenuItemsAboveSep = 0;

I would maybe use "before" instead of "above".
Attachment #8493793 - Flags: feedback+
Assignee: nobody → bruteforks
Status: NEW → ASSIGNED
Flags: qe-verify?
Yes I have compiled the code and tried it out and it works. I will make the change to the variable name.

I'm not quite sure what needs to be done with browser_openH264.js to add the test. Could you clarify for me?
I would probably just add this to |testInstalledDetails()|.

This already opens the detail view. In there get the context menu like comment 3 shows and check that the menu separator is |.hidden|.
Attached patch bug1056035v1.2.patch (obsolete) — Splinter Review
Here is the latest patch which includes the working mochitest. I think it is good...

Thanks for all your help Georg
Attachment #8493793 - Attachment is obsolete: true
Comment on attachment 8495375 [details] [diff] [review]
bug1056035v1.2.patch

Review of attachment 8495375 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks, this looks good!
I'd also not mention the count explicitly in the patch message here - what we really care about is whether we have any visible items before the separator.

After addressing the below comments you can request review from Unfocused / Blair McBride on the new patch.

::: toolkit/mozapps/extensions/content/extensions.js
@@ +448,4 @@
>          }
>        }
>  
> +      // If menu items above separator is 0, hide separator

"Hide the separator if there are no visible menu items before it" ?

::: toolkit/mozapps/extensions/test/browser/browser_openH264.js
@@ +111,5 @@
>    gIsEnUsLocale = chrome.getSelectedLocale("global") == "en-US";
>  
>    Services.obs.addObserver(gOptionsObserver, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, false);
>  
> +  //	 Start out with OpenH264 not being installed, disabled and automatic updates disabled.

What's with this change?

@@ +204,5 @@
> +    contextMenu.removeEventListener("popupshown", listener, false);
> +    deferred.resolve();
> +  };
> +  contextMenu.addEventListener("popupshown", listener, false);
> +  

Unneeded whitespace here.

@@ +209,5 @@
> +  el = doc.getElementsByClassName("detail-view-container")[0];
> +  EventUtils.synthesizeMouse(el, 4, 4, { }, gManagerWindow);
> +  EventUtils.synthesizeMouse(el, 4, 4, { type: "contextmenu", button: 2 }, gManagerWindow);
> +  yield deferred.promise;
> +  

Unneeded whitespace here.
Attachment #8495375 - Flags: feedback+
Attached patch bug1056035v1.3.patch (obsolete) — Splinter Review
Ok I have addressed the issues you raised, updated the patch, and requested review. Thanks.

> ::: toolkit/mozapps/extensions/test/browser/browser_openH264.js
> @@ +111,5 @@
> >    gIsEnUsLocale = chrome.getSelectedLocale("global") == "en-US";
> >  
> >    Services.obs.addObserver(gOptionsObserver, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, false);
> >  
> > +  //	 Start out with OpenH264 not being installed, disabled and automatic updates disabled.
> 
> What's with this change?
Whoops, an accidental insertion of a tab character. I've gotten rid of it.
Attachment #8495375 - Attachment is obsolete: true
Attachment #8495882 - Flags: review?(bmcbride)
Comment on attachment 8495882 [details] [diff] [review]
bug1056035v1.3.patch

Review of attachment 8495882 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good - thanks!
Attachment #8495882 - Flags: review?(bmcbride) → review+
Comment on attachment 8495882 [details] [diff] [review]
bug1056035v1.3.patch

Review of attachment 8495882 [details] [diff] [review]:
-----------------------------------------------------------------

This should be r=unfocused in the patch message now.
So, try looks all green & good, thanks!
Can you fix the commit message and set checkin-needed when you uploaded the new patch?
Flags: needinfo?(bruteforks)
Updated reviewer field in commit message
Attachment #8495882 - Attachment is obsolete: true
Flags: needinfo?(bruteforks)
Keywords: checkin-needed
https://hg.mozilla.org/integration/fx-team/rev/139c533264d7
Flags: in-testsuite+
Keywords: checkin-needed
Whiteboard: [lang=js] → [lang=js][fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/139c533264d7
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [lang=js][fixed-in-fx-team] → [lang=js]
Target Milestone: --- → mozilla35
Iteration: --- → 35.2
Verified as fixed with latest Nightly 2014-09-30 on Windows 7 64-bit, Ubuntu 14.04 32-bit and Mac OS X 10.9.5.
Status: RESOLVED → VERIFIED
Flags: qe-verify? → qe-verify+
QA Contact: alexandra.lucinet
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: