зеркало из https://github.com/mozilla/gecko-dev.git
fix layout-debug extension build with Firefox. Bug 277798, r=bsmedberg.
This commit is contained in:
Родитель
4200010bcd
Коммит
5e1109f607
|
@ -63,6 +63,7 @@ REQUIRES = xpcom \
|
|||
pref \
|
||||
appshell \
|
||||
appcomps \
|
||||
toolkitcomps \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
|
|
|
@ -43,11 +43,49 @@
|
|||
#include "nsLayoutDebuggingTools.h"
|
||||
#include "nsLayoutDebugCLH.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsRegressionTester)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLayoutDebuggingTools)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLayoutDebugCLH)
|
||||
|
||||
#ifdef MOZ_XUL_APP
|
||||
|
||||
static NS_IMETHODIMP
|
||||
RegisterCommandLineHandlers(nsIComponentManager* compMgr, nsIFile* path,
|
||||
const char *location, const char *type,
|
||||
const nsModuleComponentInfo *info)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
|
||||
NS_ENSURE_TRUE(catMan, NS_ERROR_FAILURE);
|
||||
|
||||
rv = catMan->AddCategoryEntry("command-line-handler", "m-layoutdebug",
|
||||
"@mozilla.org/commandlinehandler/general-startup;1?type=layoutdebug",
|
||||
PR_TRUE, PR_TRUE, nsnull);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static NS_IMETHODIMP
|
||||
UnregisterCommandLineHandlers(nsIComponentManager* compMgr, nsIFile *path,
|
||||
const char *location,
|
||||
const nsModuleComponentInfo *info)
|
||||
{
|
||||
nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID));
|
||||
NS_ENSURE_TRUE(catMan, NS_ERROR_FAILURE);
|
||||
|
||||
catMan->DeleteCategoryEntry("command-line-handler", "m-layoutdebug",
|
||||
PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static const nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "nsRegressionTester",
|
||||
|
@ -64,8 +102,13 @@ static const nsModuleComponentInfo components[] =
|
|||
NS_LAYOUTDEBUGCLH_CID,
|
||||
"@mozilla.org/commandlinehandler/general-startup;1?type=layoutdebug",
|
||||
nsLayoutDebugCLHConstructor,
|
||||
#ifdef MOZ_XUL_APP
|
||||
RegisterCommandLineHandlers,
|
||||
UnregisterCommandLineHandlers
|
||||
#else
|
||||
nsLayoutDebugCLH::RegisterProc,
|
||||
nsLayoutDebugCLH::UnregisterProc
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -40,6 +40,14 @@
|
|||
#include "nsLayoutDebugCLH.h"
|
||||
#include "nsString.h"
|
||||
#include "plstr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
|
||||
#ifdef MOZ_XUL_APP
|
||||
#include "nsICommandLine.h"
|
||||
#endif
|
||||
|
||||
nsLayoutDebugCLH::nsLayoutDebugCLH()
|
||||
{
|
||||
|
@ -49,7 +57,41 @@ nsLayoutDebugCLH::~nsLayoutDebugCLH()
|
|||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsLayoutDebugCLH, nsICmdLineHandler)
|
||||
NS_IMPL_ISUPPORTS1(nsLayoutDebugCLH, ICOMMANDLINEHANDLER)
|
||||
|
||||
#ifdef MOZ_XUL_APP
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLayoutDebugCLH::Handle(nsICommandLine* aCmdLine)
|
||||
{
|
||||
nsresult rv;
|
||||
PRBool found;
|
||||
|
||||
rv = aCmdLine->HandleFlag(NS_LITERAL_STRING("layoutdebug"),
|
||||
PR_FALSE, &found);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> wwatch (do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||
NS_ENSURE_TRUE(wwatch, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> opened;
|
||||
// XXX passing |aCmdLine| here to work around inconsistent
|
||||
// window watcher behavior (see bug 277798)
|
||||
wwatch->OpenWindow(nsnull, "chrome://layoutdebug/content/",
|
||||
"_blank", "chrome,dialog=no,all", aCmdLine,
|
||||
getter_AddRefs(opened));
|
||||
aCmdLine->SetPreventDefault(PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLayoutDebugCLH::GetHelpInfo(nsACString& aResult)
|
||||
{
|
||||
aResult.Assign(NS_LITERAL_CSTRING(" -layoutdebug Start with Layout Debugger\n"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#else // !MOZ_XUL_APP
|
||||
|
||||
CMDLINEHANDLER_IMPL(nsLayoutDebugCLH, "-layoutdebug",
|
||||
"general.startup.layoutdebug",
|
||||
|
@ -60,3 +102,5 @@ CMDLINEHANDLER_IMPL(nsLayoutDebugCLH, "-layoutdebug",
|
|||
PR_TRUE,
|
||||
"",
|
||||
PR_TRUE)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,21 +40,31 @@
|
|||
#ifndef nsLayoutDebugCLH_h_
|
||||
#define nsLayoutDebugCLH_h_
|
||||
|
||||
#ifdef MOZ_XUL_APP
|
||||
#include "nsICommandLineHandler.h"
|
||||
#define ICOMMANDLINEHANDLER nsICommandLineHandler
|
||||
#else
|
||||
#include "nsICmdLineHandler.h"
|
||||
#define ICOMMANDLINEHANDLER nsICmdLineHandler
|
||||
#endif
|
||||
|
||||
#define NS_LAYOUTDEBUGCLH_CID \
|
||||
{ 0xa8f52633, 0x5ecf, 0x424a, \
|
||||
{ 0xa1, 0x47, 0x47, 0xc3, 0x22, 0xf7, 0xbc, 0xe2 }}
|
||||
|
||||
class nsLayoutDebugCLH : public nsICmdLineHandler
|
||||
class nsLayoutDebugCLH : public ICOMMANDLINEHANDLER
|
||||
{
|
||||
public:
|
||||
nsLayoutDebugCLH();
|
||||
virtual ~nsLayoutDebugCLH();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
#ifdef MOZ_XUL_APP
|
||||
NS_DECL_NSICOMMANDLINEHANDLER
|
||||
#else
|
||||
NS_DECL_NSICMDLINEHANDLER
|
||||
CMDLINEHANDLER_REGISTERPROC_DECLS
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* !defined(nsLayoutDebugCLH_h_) */
|
||||
|
|
Загрузка…
Ссылка в новой задаче