In bug 723206, we added the ability to receive arguments for global constructors implemented in IDL. Javascript initializers are passed a reference to the calling window, but constructors aren't, and is required in many cases.
The proposal is to append a window reference to the end of the argument list passed to the constructor in order to remain compatible with existing objects registered as Javascript-global-constructors.

Comment on attachment 648503[details][diff][review]
Pass the calling as the last argument to the constructor
Review of attachment 648503[details][diff][review]:
-----------------------------------------------------------------
This looks right, but I think we should pass the window as the first argument instead of the last. That way code can be written that knows where the window will be passed.
::: dom/base/nsDOMClassInfo.cpp
@@ +5738,5 @@
> rooter.changeLength(i + 1);
> }
>
> + // Append window to the end of arguments
> + JS::Value win;
Why not wrap directly into args, i.e. why use the temporary?
@@ +5742,5 @@
> + JS::Value win;
> + nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
> + nsCOMPtr<nsIDOMWindow> currentWin(do_GetInterface(currentInner));
> + rv = WrapNative(cx, obj, currentWin, &NS_GET_IID(nsIDOMWindow),
> + true, &win, getter_AddRefs(holder));
Nit: Please make |true| line up with |cx|.

(In reply to Blake Kaplan (:mrbkap) from comment #3)
> This looks right, but I think we should pass the window as the first
> argument instead of the last. That way code can be written that knows where
> the window will be passed.
I didn't want existing code that used Javascript-global-constructor to break. Should I look for existing instances and roll in the changes needed into this patch?

(In reply to Anant Narayanan [:anant] from comment #4)
> I didn't want existing code that used Javascript-global-constructor to
> break. Should I look for existing instances and roll in the changes needed
> into this patch?
Please keep add-ons and documentation for them in mind when you do this... I'm not using this currently in any add-on work, but in the past at other companies I might have.