Closed Bug 798237 Opened 12 years ago Closed 12 years ago

Test for bug 797677

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 19
Tracking Status
firefox18 --- fixed
firefox19 --- fixed

People

(Reporter: jruderman, Assigned: keeler)

Details

Attachments

(1 file, 1 obsolete file)

See https://bugzilla.mozilla.org/show_bug.cgi?id=797677#c5

Do we need to test crazy types like "0" and "9000" and "length", or just some valid and some invalid types?
Assignee: nobody → dkeeler
Attached patch test (obsolete) — Splinter Review
It looks like using valid indices or properties that exist on navigator.mimeTypes doesn't actually cause a failure. In the first case, we might get the plugin name wrong, but since it's already an unsupported plugin type, I think this is okay (we never use pluginName in that case). In the second case, this results in a valid js object that doesn't have a property called 'enabledPlugin', so the getPluginInfo doesn't do anything bad with it.
So, the only way we can test this is by using a large, invalid index. Hopefully this is good enough.
Jared - thoughts?
Attachment #668511 - Flags: review?(jaws)
Comment on attachment 668511 [details] [diff] [review]
test

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

I'd like to get review from Mihai on the nsIConsoleService usage since he knows more about it than I do.

::: browser/base/content/test/browser_bug797677.js
@@ +1,1 @@
> +var rootDir = getRootDirectory(gTestPath);

Need a license header.

@@ +5,5 @@
> +var gTestBrowser = null;
> +var gErrorListener = null;
> +var gConsoleErrors = 0;
> +var gConsoleService = Cc["@mozilla.org/consoleservice;1"]
> +                      .getService(Ci.nsIConsoleService);

nit: indent this line by two more spaces so the period lines up with the open bracket.

@@ +15,5 @@
> +  gTestBrowser = gBrowser.selectedBrowser;
> +  gTestBrowser.addEventListener("load", pageLoad, true);
> +  gErrorListener = {
> +    observe: function(aMessage) {
> +      if (aMessage.message.indexOf("NS_ERROR") > -1) {

nit: if (aMessage.message.contains("NS_ERROR"))
also, no need for the curly brackets here.

@@ +35,5 @@
> +
> +function pageLoad() {
> +  // The plugin events are async dispatched and can come after the load event
> +  // This just allows the events to fire before we then go on to test the states
> +  executeSoon(runTest);

This seems too fragile. Maybe something like the waitForCondition that is used in other plugin tests?
Attachment #668511 - Flags: review?(mihai.sucan)
Attachment #668511 - Flags: review?(jaws)
Attachment #668511 - Flags: feedback+
Comment on attachment 668511 [details] [diff] [review]
test

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

nsIConsoleService usage looks fine, but my worry is that the test could finish() too early. You could wait something like ~2s after page load, but timeouts are not what we want to use.
Attachment #668511 - Flags: review?(mihai.sucan) → review+
Please request review again after making the changes.

I'm curious to see if you can use waitForCondition here to remove the executeSoon.
Why not use a listener for the plugin event you care about, rather than the load event, and use executeSoon to ensure the browser code's handler runs first?
Attached patch test v2Splinter Review
Attachment #668511 - Attachment is obsolete: true
Attachment #669190 - Flags: review?(jaws)
Comment on attachment 669190 [details] [diff] [review]
test v2

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

Thanks! This looks good to me.
Attachment #669190 - Flags: review?(jaws) → review+
OS: Mac OS X → All
Hardware: x86_64 → All
https://hg.mozilla.org/mozilla-central/rev/3a14bf605a71
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 19
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: