If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

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

RESOLVED FIXED in mozilla24

Status

()

Core
Widget
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: Joe Drew (not getting mail), Assigned: Joe Drew (not getting mail))

Tracking

unspecified
mozilla24
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

4 years ago
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)
(Assignee)

Comment 2

4 years ago
Created attachment 752565 [details] [diff] [review]
expose runBeforeNextEvent and runInStableState on nsIDOMWindowUtils

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+
(Assignee)

Comment 4

4 years ago
Done! https://hg.mozilla.org/integration/mozilla-inbound/rev/ec36b8eeb2e7

Comment 5

4 years ago
https://hg.mozilla.org/mozilla-central/rev/ec36b8eeb2e7
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.