зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1373677 - Remove support for the moz-extremely-unstable-and-will-change-webcomponents permission; r=wchen
This commit is contained in:
Родитель
84176294e0
Коммит
b306e0842e
|
@ -6049,6 +6049,10 @@ nsDocument::CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value*
|
|||
bool
|
||||
nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject)
|
||||
{
|
||||
if (!nsContentUtils::IsWebComponentsEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> obj(aCx, aObject);
|
||||
|
||||
JSAutoCompartment ac(aCx, obj);
|
||||
|
@ -6056,15 +6060,6 @@ nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject)
|
|||
nsCOMPtr<nsPIDOMWindowInner> window =
|
||||
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(global));
|
||||
|
||||
bool enabled =
|
||||
nsContentUtils::IsWebComponentsEnabled() ||
|
||||
// Check for the webcomponents permission. See Bug 1181555.
|
||||
IsWebComponentsEnabled(window);
|
||||
|
||||
if (!enabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIDocument* doc = window ? window->GetExtantDoc() : nullptr;
|
||||
if (doc && doc->IsStyledByServo()) {
|
||||
NS_WARNING("stylo: Web Components not supported yet");
|
||||
|
@ -6077,21 +6072,11 @@ nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject)
|
|||
bool
|
||||
nsDocument::IsWebComponentsEnabled(dom::NodeInfo* aNodeInfo)
|
||||
{
|
||||
nsIDocument* doc = aNodeInfo->GetDocument();
|
||||
|
||||
bool enabled = nsContentUtils::IsWebComponentsEnabled();
|
||||
if (!enabled) {
|
||||
// Use GetScopeObject() here so that data documents work the same way as the
|
||||
// main document they're associated with.
|
||||
nsCOMPtr<nsPIDOMWindowInner> window =
|
||||
do_QueryInterface(doc->GetScopeObject());
|
||||
enabled = IsWebComponentsEnabled(window);
|
||||
}
|
||||
|
||||
if (!enabled) {
|
||||
if (!nsContentUtils::IsWebComponentsEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIDocument* doc = aNodeInfo->GetDocument();
|
||||
if (doc->IsStyledByServo()) {
|
||||
NS_WARNING("stylo: Web Components not supported yet");
|
||||
return false;
|
||||
|
@ -6100,26 +6085,6 @@ nsDocument::IsWebComponentsEnabled(dom::NodeInfo* aNodeInfo)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDocument::IsWebComponentsEnabled(nsPIDOMWindowInner* aWindow)
|
||||
{
|
||||
if (aWindow) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPermissionManager> permMgr =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
uint32_t perm;
|
||||
rv = permMgr->TestPermissionFromWindow(
|
||||
aWindow, "moz-extremely-unstable-and-will-change-webcomponents", &perm);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
return perm == nsIPermissionManager::ALLOW_ACTION;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::ScheduleSVGForPresAttrEvaluation(nsSVGElement* aSVG)
|
||||
{
|
||||
|
|
|
@ -1395,9 +1395,6 @@ private:
|
|||
void UpdatePossiblyStaleDocumentState();
|
||||
static bool CustomElementConstructor(JSContext* aCx, unsigned aArgc, JS::Value* aVp);
|
||||
|
||||
// Check whether web components are enabled for the given window.
|
||||
static bool IsWebComponentsEnabled(nsPIDOMWindowInner* aWindow);
|
||||
|
||||
public:
|
||||
virtual already_AddRefed<mozilla::dom::CustomElementRegistry>
|
||||
GetCustomElementRegistry() override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче