forked from mirrors/gecko-dev
Bug 1820280 - Enable chrome rules in Thunderbird's about:3pane. r=aleca,dholbert
For now a static list of URIs is probably fine. I asked Nika / Gijs if we can do something better in any case. We already have tests for stuff not getting exposed to content. Differential Revision: https://phabricator.services.mozilla.com/D171641
This commit is contained in:
parent
6e32187716
commit
4a50082613
4 changed files with 32 additions and 6 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
#include "mozilla/dom/PrototypeDocumentContentSink.h"
|
#include "mozilla/dom/PrototypeDocumentContentSink.h"
|
||||||
#include "nsIParser.h"
|
#include "nsIParser.h"
|
||||||
#include "mozilla/dom/Document.h"
|
#include "mozilla/dom/Document.h"
|
||||||
|
#include "mozilla/dom/URL.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@
|
||||||
#include "nsWrapperCache.h"
|
#include "nsWrapperCache.h"
|
||||||
|
|
||||||
class gfxFontFaceBufferSource;
|
class gfxFontFaceBufferSource;
|
||||||
|
class nsIGlobalObject;
|
||||||
|
|
||||||
struct RawServoFontFaceRule;
|
struct RawServoFontFaceRule;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
@ -44,8 +46,7 @@ class FontFace final : public nsISupports, public nsWrapperCache {
|
||||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FontFace)
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(FontFace)
|
||||||
|
|
||||||
nsIGlobalObject* GetParentObject() const { return mParent; }
|
nsIGlobalObject* GetParentObject() const { return mParent; }
|
||||||
virtual JSObject* WrapObject(JSContext* aCx,
|
JSObject* WrapObject(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
|
||||||
JS::Handle<JSObject*> aGivenProto) override;
|
|
||||||
|
|
||||||
static already_AddRefed<FontFace> CreateForRule(nsIGlobalObject* aGlobal,
|
static already_AddRefed<FontFace> CreateForRule(nsIGlobalObject* aGlobal,
|
||||||
FontFaceSet* aFontFaceSet,
|
FontFaceSet* aFontFaceSet,
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include "mozilla/URLExtraData.h"
|
#include "mozilla/URLExtraData.h"
|
||||||
|
|
||||||
#include "mozilla/NullPrincipal.h"
|
#include "mozilla/NullPrincipal.h"
|
||||||
|
#include "nsAboutProtocolUtils.h"
|
||||||
#include "ReferrerInfo.h"
|
#include "ReferrerInfo.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
@ -29,6 +30,32 @@ void URLExtraData::Init() {
|
||||||
sDummyChrome->mChromeRulesEnabled = true;
|
sDummyChrome->mChromeRulesEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsPrivilegedAboutURIForCSS(nsIURI* aURI) {
|
||||||
|
#ifdef MOZ_THUNDERBIRD
|
||||||
|
if (!aURI->SchemeIs("about")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// TODO: we might want to do something a bit less special-casey, perhaps using
|
||||||
|
// nsIAboutModule::GetChromeURI or so? But nsIAboutModule can involve calling
|
||||||
|
// into JS so this is probably fine for now, if it doesn't get too unwieldy.
|
||||||
|
nsAutoCString name;
|
||||||
|
if (NS_WARN_IF(NS_FAILED(NS_GetAboutModuleName(aURI, name)))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return name.EqualsLiteral("3pane") || name.EqualsLiteral("addressbook");
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool URLExtraData::ChromeRulesEnabled(nsIURI* aURI) {
|
||||||
|
if (!aURI) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return aURI->SchemeIs("chrome") || aURI->SchemeIs("resource") ||
|
||||||
|
IsPrivilegedAboutURIForCSS(aURI);
|
||||||
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
void URLExtraData::Shutdown() {
|
void URLExtraData::Shutdown() {
|
||||||
sDummy = nullptr;
|
sDummy = nullptr;
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
#include "mozilla/StaticPtr.h"
|
#include "mozilla/StaticPtr.h"
|
||||||
#include "mozilla/UserAgentStyleSheetID.h"
|
#include "mozilla/UserAgentStyleSheetID.h"
|
||||||
#include "mozilla/dom/URL.h"
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIPrincipal.h"
|
#include "nsIPrincipal.h"
|
||||||
#include "nsIReferrerInfo.h"
|
#include "nsIReferrerInfo.h"
|
||||||
|
|
@ -22,9 +21,7 @@
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
struct URLExtraData {
|
struct URLExtraData {
|
||||||
static bool ChromeRulesEnabled(nsIURI* aURI) {
|
static bool ChromeRulesEnabled(nsIURI* aURI);
|
||||||
return aURI && (aURI->SchemeIs("chrome") || aURI->SchemeIs("resource"));
|
|
||||||
}
|
|
||||||
|
|
||||||
URLExtraData(already_AddRefed<nsIURI> aBaseURI,
|
URLExtraData(already_AddRefed<nsIURI> aBaseURI,
|
||||||
already_AddRefed<nsIReferrerInfo> aReferrerInfo,
|
already_AddRefed<nsIReferrerInfo> aReferrerInfo,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue