diff --git a/mozilla/dom/src/jsurl/nsJSProtocolHandler.cpp b/mozilla/dom/src/jsurl/nsJSProtocolHandler.cpp index a6ab0743da9..5c840161ed5 100644 --- a/mozilla/dom/src/jsurl/nsJSProtocolHandler.cpp +++ b/mozilla/dom/src/jsurl/nsJSProtocolHandler.cpp @@ -46,6 +46,7 @@ #include "nsIByteArrayInputStream.h" #include "nsIWindowMediator.h" #include "nsIDOMWindowInternal.h" +#include "nsIJSConsoleService.h" static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID); @@ -54,11 +55,6 @@ static NS_DEFINE_CID(kWindowMediatorCID, NS_WINDOWMEDIATOR_CID); static NS_DEFINE_IID(kProxyObjectManagerCID, NS_PROXYEVENT_MANAGER_CID); -#define CONSOLE_CHROME_URL \ - NS_LITERAL_STRING("chrome://global/content/console.xul") -#define CONSOLE_WINDOW_OPTIONS \ - NS_LITERAL_STRING("chrome,menubar,toolbar,resizable") - class nsJSThunk; //////////////////////////////////////////////////////////////////////////////// @@ -211,18 +207,13 @@ nsEvaluateStringProxy::BringUpConsole() globalOwner->GetScriptGlobalObject(getter_AddRefs(global)); NS_ENSURE_TRUE(global, NS_ERROR_FAILURE); - nsCOMPtr scriptContext; - rv = global->GetContext(getter_AddRefs(scriptContext)); - if (NS_FAILED(rv)) return rv; - // Finally, QI global to nsIDOMWindow and open the console. - nsCOMPtr window = do_QueryInterface(global, &rv); + nsCOMPtr window = do_QueryInterface(global, &rv); NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE); - nsCOMPtr tmp; - - rv = window->Open(CONSOLE_CHROME_URL, NS_LITERAL_STRING("_blank"), - CONSOLE_WINDOW_OPTIONS, getter_AddRefs(tmp)); + NS_WITH_SERVICE(nsIJSConsoleService, jsconsole, "@mozilla.org/embedcomp/jsconsole-service;1", &rv); + if (NS_FAILED(rv) || !jsconsole) return rv; + jsconsole->Open ( window ); } return rv; } diff --git a/mozilla/embedding/components/Makefile.in b/mozilla/embedding/components/Makefile.in index d8265e65eb1..8324ca2f621 100644 --- a/mozilla/embedding/components/Makefile.in +++ b/mozilla/embedding/components/Makefile.in @@ -24,6 +24,6 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk -DIRS = windowwatcher appstartup find ui build +DIRS = windowwatcher appstartup find ui build jsconsole include $(topsrcdir)/config/rules.mk diff --git a/mozilla/embedding/components/build/Makefile.in b/mozilla/embedding/components/build/Makefile.in index 99c6154e21f..c72c70773cf 100644 --- a/mozilla/embedding/components/build/Makefile.in +++ b/mozilla/embedding/components/build/Makefile.in @@ -28,13 +28,14 @@ LIBRARY_NAME = embedcomponents EXPORT_LIBRARY = 1 SHORT_LIBNAME = embedcmp IS_COMPONENT = 1 -REQUIRES = js xpcom string windowwatcher find embed_base dom txtsvc +REQUIRES = js xpcom string windowwatcher jsconsole find embed_base dom txtsvc CPPSRCS = nsModule.cpp ifeq ($(MOZ_WIDGET_TOOLKIT),os2) EXTRA_DSO_LIBS = \ windowwatcher_s \ + jsconsole_s \ appstartupnotifier_s \ find_s \ $(NULL) @@ -61,6 +62,7 @@ endif LOCAL_INCLUDES = \ -I$(srcdir)/../windowwatcher/src \ -I$(srcdir)/../appstartup/src \ + -I$(srcdir)/../jsconsole/src \ -I$(srcdir)/../find/src \ $(NULL) diff --git a/mozilla/embedding/components/build/makefile.win b/mozilla/embedding/components/build/makefile.win index 3b36565db54..9cc61e8471b 100644 --- a/mozilla/embedding/components/build/makefile.win +++ b/mozilla/embedding/components/build/makefile.win @@ -36,12 +36,14 @@ LLIBS = \ $(DIST)\lib\js3250.lib \ $(DIST)\lib\xpcom.lib \ $(DIST)\lib\windowwatcher_s.lib \ + $(DIST)\lib\jsconsole_s.lib \ $(DIST)\lib\appstartupnotifier_s.lib \ $(DIST)\lib\find_s.lib \ $(NULL) INCS = $(INCS) \ -I$(DEPTH)\embedding\components\windowwatcher\src \ + -I$(DEPTH)\embedding\components\jsconsole\src \ -I$(DEPTH)\embedding\components\appstartup\src \ -I$(DEPTH)\embedding\components\find\src \ $(NULL) diff --git a/mozilla/embedding/components/build/nsModule.cpp b/mozilla/embedding/components/build/nsModule.cpp index 95d79c946b3..19382298f3c 100644 --- a/mozilla/embedding/components/build/nsModule.cpp +++ b/mozilla/embedding/components/build/nsModule.cpp @@ -25,18 +25,21 @@ #include "nsPromptService.h" #include "nsWindowWatcher.h" #include "nsAppStartupNotifier.h" +#include "nsJSConsoleService.h" #include "nsWebBrowserFind.h" NS_GENERIC_FACTORY_CONSTRUCTOR(nsDialogParamBlock) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPromptService, Init) NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowWatcher, Init) NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppStartupNotifier) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSConsoleService) NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserFind) static nsModuleComponentInfo gComponents[] = { { "Dialog ParamBlock", NS_DIALOGPARAMBLOCK_CID, NS_DIALOGPARAMBLOCK_CONTRACTID, nsDialogParamBlockConstructor }, { "Prompt Service", NS_PROMPTSERVICE_CID, NS_PROMPTSERVICE_CONTRACTID, nsPromptServiceConstructor }, + { "JS Console Service", NS_JSCONSOLESERVICE_CID, NS_JSCONSOLESERVICE_CONTRACTID, nsJSConsoleServiceConstructor }, { "Window Watcher", NS_WINDOWWATCHER_CID, NS_WINDOWWATCHER_CONTRACTID, nsWindowWatcherConstructor }, { "Find", NS_WEB_BROWSER_FIND_CID, NS_WEB_BROWSER_FIND_CONTRACTID, nsWebBrowserFindConstructor }, { NS_APPSTARTUPNOTIFIER_CLASSNAME, NS_APPSTARTUPNOTIFIER_CID, NS_APPSTARTUPNOTIFIER_CONTRACTID, nsAppStartupNotifierConstructor } diff --git a/mozilla/embedding/components/makefile.win b/mozilla/embedding/components/makefile.win index f44249273f9..ab9be5cace9 100644 --- a/mozilla/embedding/components/makefile.win +++ b/mozilla/embedding/components/makefile.win @@ -24,6 +24,7 @@ DIRS= \ windowwatcher \ appstartup \ find \ + jsconsole \ ui \ build \ $(NULL)