Bug 1164292 - Re-implement dumpImpl in terms of GetScriptLocation. r=gabor

The existing setup adds a lot of complication and not a lot of value.
This commit is contained in:
Bobby Holley 2015-05-11 14:17:07 -07:00
parent 5b0940d8bc
commit 86a6789c6b
8 changed files with 3 additions and 59 deletions

View File

@ -83,7 +83,9 @@ JS_EXPORT_API(void)
JSPrincipals::dump()
{
if (debugToken == nsJSPrincipals::DEBUG_TOKEN) {
static_cast<nsJSPrincipals *>(this)->dumpImpl();
nsAutoCString str;
static_cast<nsJSPrincipals *>(this)->GetScriptLocation(str);
fprintf(stderr, "nsIPrincipal (%p) = %s\n", static_cast<void*>(this), str.get());
} else if (debugToken == mozilla::dom::workers::kJSPrincipalsDebugToken) {
fprintf(stderr, "Web Worker principal singleton (%p)\n", this);
} else {

View File

@ -43,11 +43,6 @@ public:
* Return a string that can be used as JS script filename in error reports.
*/
virtual void GetScriptLocation(nsACString &aStr) = 0;
#ifdef DEBUG
virtual void dumpImpl() = 0;
#endif
static const uint32_t DEBUG_TOKEN = 0x0bf41760;
protected:

View File

@ -75,15 +75,6 @@ nsNullPrincipal::GetScriptLocation(nsACString &aStr)
mURI->GetSpec(aStr);
}
#ifdef DEBUG
void nsNullPrincipal::dumpImpl()
{
nsAutoCString str;
mURI->GetSpec(str);
fprintf(stderr, "nsNullPrincipal (%p) = %s\n", this, str.get());
}
#endif
/**
* nsIPrincipal implementation
*/

View File

@ -52,10 +52,6 @@ public:
virtual void GetScriptLocation(nsACString &aStr) override;
#ifdef DEBUG
virtual void dumpImpl() override;
#endif
protected:
virtual ~nsNullPrincipal() {}

View File

@ -68,15 +68,6 @@ nsBasePrincipal::SetCsp(nsIContentSecurityPolicy* aCsp)
return NS_OK;
}
#ifdef DEBUG
void nsPrincipal::dumpImpl()
{
nsAutoCString str;
GetScriptLocation(str);
fprintf(stderr, "nsPrincipal (%p) = %s\n", static_cast<void*>(this), str.get());
}
#endif
NS_IMPL_CLASSINFO(nsPrincipal, nullptr, nsIClassInfo::MAIN_THREAD_ONLY,
NS_PRINCIPAL_CID)
NS_IMPL_QUERY_INTERFACE_CI(nsPrincipal,
@ -997,13 +988,6 @@ nsExpandedPrincipal::GetScriptLocation(nsACString& aStr)
aStr.Append(")");
}
#ifdef DEBUG
void nsExpandedPrincipal::dumpImpl()
{
fprintf(stderr, "nsExpandedPrincipal (%p)\n", static_cast<void*>(this));
}
#endif
//////////////////////////////////////////
// Methods implementing nsISerializable //
//////////////////////////////////////////

View File

@ -32,11 +32,6 @@ public:
static const char sInvalid[];
protected:
#ifdef DEBUG
virtual void dumpImpl() = 0;
#endif
nsCOMPtr<nsIContentSecurityPolicy> mCSP;
};
@ -63,9 +58,6 @@ public:
NS_IMETHOD GetIsNullPrincipal(bool* aIsNullPrincipal) override;
NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
virtual bool IsOnCSSUnprefixingWhitelist() override;
#ifdef DEBUG
virtual void dumpImpl() override;
#endif
nsPrincipal();
@ -155,10 +147,6 @@ public:
NS_IMETHOD GetIsNullPrincipal(bool* aIsNullPrincipal) override;
NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override;
virtual bool IsOnCSSUnprefixingWhitelist() override;
#ifdef DEBUG
virtual void dumpImpl() override;
#endif
virtual void GetScriptLocation(nsACString &aStr) override;
private:

View File

@ -37,14 +37,6 @@ nsSystemPrincipal::GetScriptLocation(nsACString &aStr)
aStr.Assign(SYSTEM_PRINCIPAL_SPEC);
}
#ifdef DEBUG
void nsSystemPrincipal::dumpImpl()
{
fprintf(stderr, "nsSystemPrincipal (%p)\n", this);
}
#endif
///////////////////////////////////////
// Methods implementing nsIPrincipal //
///////////////////////////////////////

View File

@ -28,10 +28,6 @@ public:
virtual void GetScriptLocation(nsACString &aStr) override;
#ifdef DEBUG
virtual void dumpImpl() override;
#endif
protected:
virtual ~nsSystemPrincipal(void) {}
};