Closed Bug 873683 Opened 11 years ago Closed 11 years ago

Need to be able to call nsIAppShell::RunBeforeNextEvent from test

Categories

(Core :: Widget, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: joe, Assigned: joe)

References

Details

Attachments

(1 file)

In order to verify we don't go back into the event queue, I need to be able to call RunBeforeNextEvent from a test for bug 867758. My ideal way to do this is to have a JavaScript interface, perhaps nsIAppShell, to call with a function. Unfortunately, nsIAppShell is not scriptable.

So, Ben: what do you prefer least, me making nsIAppShell scriptable, or me adding something to (for example) nsIDOMWindowUtils that calls the nsIAppShell function?

(Or, worst of all, do you hate both?)
Flags: needinfo?(bent.mozilla)
Let's please use a backdoor with nsIDOMWindowUtils or something. Or make a new interface if you need it in places without a window (components, JSM, etc). Making nsIAppShell scriptable sounds awful.
Flags: needinfo?(bent.mozilla)
I thought briefly about adding a separate service, but this seemed like a more expedient way. I'm willing to listen to reason, though.
Attachment #752565 - Flags: review?(bent.mozilla)
Comment on attachment 752565 [details] [diff] [review]
expose runBeforeNextEvent and runInStableState on nsIDOMWindowUtils

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

r=me

::: dom/base/nsDOMWindowUtils.cpp
@@ +3318,5 @@
> +  }
> +
> +  nsCOMPtr<nsIAppShell> appShell(do_GetService(kAppShellCID));
> +  if (!appShell)
> +    return NS_ERROR_NOT_AVAILABLE;

Nit: braces here and below.

::: dom/interfaces/base/nsIDOMWindowUtils.idl
@@ +1379,5 @@
> +    * In practice this runs aRunnable once the currently executing event
> +    * finishes. If called multiple times per task/event, all the runnables will
> +    * be executed, in the order in which runInStableState() was called.
> +    */
> +   void runInStableState(in nsIRunnable runnable);

Might want to add a big XXX comment saying that these methods can wreak all sorts of havoc if the runnable does anything but twiddle a few bits or something...
Attachment #752565 - Flags: review?(bent.mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/ec36b8eeb2e7
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: