nsresult rv; NS_WITH_SERVICE(nsIAppShellService, appShellService, kAppShellServiceCID, &rv) if ( NS_SUCCEEDED( rv ) ) { nsCOMPtr<nsIDOMWindow> hiddenWindow; JSContext *jsContext; rv = appShellService->GetHiddenWindowAndJSContext( getter_AddRefs( hiddenWindow ), &jsContext ); if ( NS_SUCCEEDED( rv ) ) { void *stackPtr; jsval *argv = JS_PushArguments( jsContext, &stackPtr, "sssW", urlstr, "_blank", "chrome,dialog=no,all", args ); if( argv ) { nsCOMPtr<nsIDOMWindow> newWindow; rv = hiddenWindow->OpenDialog( jsContext, argv, 4, getter_AddRefs( newWindow ) ); JS_PopArguments( jsContext, stackPtr ); }
nsresult rv; nsCOMPtr<nsIAppShellService> appShellService = do_GetService(kAppShellServiceCID, &rv); if (NS_SUCCEEDED(rv)) { nsCOMPtr<nsIDOMWindow> hiddenWindow; JSContext *jsContext; rv = appShellService->GetHiddenWindowAndJSContext(getter_AddRefs(hiddenWindow), &jsContext); if (NS_SUCCEEDED(rv)) { void *stackPtr; jsval *argv = JS_PushArguments( jsContext, &stackPtr, "sssW", urlstr, "_blank", "chrome,dialog=no,all", args );  if( argv ) { nsCOMPtr<nsIDOMWindow> newWindow; rv = hiddenWindow->OpenDialog( jsContext, argv, 4, getter_AddRefs( newWindow ) );  JS_PopArguments( jsContext, stackPtr );
static nsresult OpenWindow( const char*urlstr, const PRUnichar *args ){#ifdef DEBUG_CMD_LINE    printf("OpenWindow(%s,?)\n",urlstr);#endif /* DEBUG_CMD_LINE */    nsresult rv;    NS_WITH_SERVICE(nsIAppShellService, appShellService, kAppShellServiceCID, &rv)    if ( NS_SUCCEEDED( rv ) ) {        nsCOMPtr<nsIDOMWindow> hiddenWindow;        JSContext *jsContext;        rv = appShellService->GetHiddenWindowAndJSContext( getter_AddRefs( hiddenWindow ),                                                           &jsContext );        if ( NS_SUCCEEDED( rv ) ) {            void *stackPtr;            jsval *argv = JS_PushArguments( jsContext,                                            &stackPtr,                                            "sssW",                                            urlstr,                                            "_blank",                                            "chrome,dialog=no,all",                                            args );            if( argv ) {                nsCOMPtr<nsIDOMWindow> newWindow;                rv = hiddenWindow->OpenDialog( jsContext,                                               argv,                                               4,                                               getter_AddRefs( newWindow ) );                JS_PopArguments( jsContext, stackPtr );            }        }    }    return rv;}