|
384 | 384 | #include "nsINodeList.h" |
385 | 385 | #include "nsIObjectLoadingContent.h" |
386 | 386 | #include "nsIObserverService.h" |
| 387 | +#include "nsIParentalControlsService.h" |
387 | 388 | #include "nsIPermission.h" |
388 | 389 | #include "nsIPrompt.h" |
389 | 390 | #include "nsIPropertyBag2.h" |
@@ -11857,6 +11858,34 @@ void Document::ProcessMETATag(HTMLMetaElement* aMetaElement) { |
11857 | 11858 | SetHeaderData(nsGkAtoms::handheldFriendly, result); |
11858 | 11859 | } |
11859 | 11860 | } |
| 11861 | + // Check for Restricted To Adults meta tag |
| 11862 | + if (aMetaElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::name, |
| 11863 | + nsGkAtoms::rating, eIgnoreCase)) { |
| 11864 | + if (aMetaElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::content, |
| 11865 | + nsGkAtoms::adult, eIgnoreCase) || |
| 11866 | + aMetaElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::content, |
| 11867 | + nsGkAtoms::restrictToAdults, eIgnoreCase)) { |
| 11868 | + BrowsingContext* bc = GetBrowsingContext(); |
| 11869 | + if (bc && bc->GetParentalControlsEnabled() && GetDocShell()) { |
| 11870 | + RefPtr<nsDocShell> docShell = nsDocShell::Cast(GetDocShell()); |
| 11871 | + nsCOMPtr<nsIRunnable> redirect = NewRunnableMethod( |
| 11872 | + "Document::ProcessMETATag::DisplayRestrictedContentError", docShell, |
| 11873 | + &nsDocShell::DisplayRestrictedContentError); |
| 11874 | + nsContentUtils::AddScriptRunner(redirect.forget()); |
| 11875 | + } |
| 11876 | + } |
| 11877 | + } |
| 11878 | +} |
| 11879 | + |
| 11880 | +void Document::TerminateParserAndDisableScripts() { |
| 11881 | + if (mParser) { |
| 11882 | + Unused << mParser->Terminate(); |
| 11883 | + MOZ_ASSERT(!mParser, "mParser should have been null'd out"); |
| 11884 | + } |
| 11885 | + |
| 11886 | + if (WindowContext* wc = GetWindowContext()) { |
| 11887 | + Unused << wc->SetAllowJavascript(false); |
| 11888 | + } |
11860 | 11889 | } |
11861 | 11890 |
|
11862 | 11891 | already_AddRefed<Element> Document::CreateElem(const nsAString& aName, |
|
0 commit comments