summaryrefslogtreecommitdiffstats
path: root/dom/html
diff options
context:
space:
mode:
authorathenian200 <athenian200@outlook.com>2020-01-27 22:59:08 -0600
committerathenian200 <athenian200@outlook.com>2020-01-27 22:59:08 -0600
commit3c4f414db74b84f7d2a6fb13fd888a47a153699b (patch)
treeea81fca559849967a79d598a6f460830762ec9ea /dom/html
parent1f8d508258ac5d7d57fc4eb35cac90f28bc8ca03 (diff)
parentc4b0715baaffc541670fd1158557aa7e61e521d3 (diff)
downloadUXP-3c4f414db74b84f7d2a6fb13fd888a47a153699b.tar
UXP-3c4f414db74b84f7d2a6fb13fd888a47a153699b.tar.gz
UXP-3c4f414db74b84f7d2a6fb13fd888a47a153699b.tar.lz
UXP-3c4f414db74b84f7d2a6fb13fd888a47a153699b.tar.xz
UXP-3c4f414db74b84f7d2a6fb13fd888a47a153699b.zip
Merge branch 'master' of https://github.com/MoonchildProductions/UXP into form-disabled-issue
Diffstat (limited to 'dom/html')
-rw-r--r--dom/html/HTMLDetailsElement.cpp30
-rw-r--r--dom/html/HTMLDetailsElement.h2
-rw-r--r--dom/html/HTMLElement.cpp9
-rw-r--r--dom/html/HTMLSummaryElement.cpp12
-rw-r--r--dom/html/nsGenericHTMLElement.cpp6
-rw-r--r--dom/html/nsGenericHTMLElement.h16
-rw-r--r--dom/html/nsHTMLContentSink.cpp141
-rw-r--r--dom/html/nsHTMLDocument.cpp59
-rw-r--r--dom/html/nsHTMLDocument.h4
-rw-r--r--dom/html/test/file_iframe_sandbox_c_if4.html11
-rw-r--r--dom/html/test/file_iframe_sandbox_j_if1.html30
-rw-r--r--dom/html/test/file_iframe_sandbox_j_if2.html28
-rw-r--r--dom/html/test/file_iframe_sandbox_j_if3.html27
-rw-r--r--dom/html/test/mochitest.ini10
-rw-r--r--dom/html/test/test_bug391777.html25
-rw-r--r--dom/html/test/test_iframe_sandbox_general.html2
-rw-r--r--dom/html/test/test_iframe_sandbox_modal.html122
17 files changed, 176 insertions, 358 deletions
diff --git a/dom/html/HTMLDetailsElement.cpp b/dom/html/HTMLDetailsElement.cpp
index ed20b50ca..8619b1450 100644
--- a/dom/html/HTMLDetailsElement.cpp
+++ b/dom/html/HTMLDetailsElement.cpp
@@ -6,39 +6,11 @@
#include "mozilla/dom/HTMLDetailsElement.h"
#include "mozilla/dom/HTMLDetailsElementBinding.h"
-#include "mozilla/dom/HTMLUnknownElement.h"
-#include "mozilla/Preferences.h"
-
-// Expand NS_IMPL_NS_NEW_HTML_ELEMENT(Details) to add pref check.
-nsGenericHTMLElement*
-NS_NewHTMLDetailsElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
- mozilla::dom::FromParser aFromParser)
-{
- if (!mozilla::dom::HTMLDetailsElement::IsDetailsEnabled()) {
- return new mozilla::dom::HTMLUnknownElement(aNodeInfo);
- }
-
- return new mozilla::dom::HTMLDetailsElement(aNodeInfo);
-}
+NS_IMPL_NS_NEW_HTML_ELEMENT(Details)
namespace mozilla {
namespace dom {
-/* static */ bool
-HTMLDetailsElement::IsDetailsEnabled()
-{
- static bool isDetailsEnabled = false;
- static bool added = false;
-
- if (!added) {
- Preferences::AddBoolVarCache(&isDetailsEnabled,
- "dom.details_element.enabled");
- added = true;
- }
-
- return isDetailsEnabled;
-}
-
HTMLDetailsElement::~HTMLDetailsElement()
{
}
diff --git a/dom/html/HTMLDetailsElement.h b/dom/html/HTMLDetailsElement.h
index 5a3af27b4..6adf567bf 100644
--- a/dom/html/HTMLDetailsElement.h
+++ b/dom/html/HTMLDetailsElement.h
@@ -23,8 +23,6 @@ class HTMLDetailsElement final : public nsGenericHTMLElement
public:
using NodeInfo = mozilla::dom::NodeInfo;
- static bool IsDetailsEnabled();
-
explicit HTMLDetailsElement(already_AddRefed<NodeInfo>& aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
diff --git a/dom/html/HTMLElement.cpp b/dom/html/HTMLElement.cpp
index b2f23b931..d3901bdf3 100644
--- a/dom/html/HTMLElement.cpp
+++ b/dom/html/HTMLElement.cpp
@@ -52,3 +52,12 @@ NS_NewHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
{
return new mozilla::dom::HTMLElement(aNodeInfo);
}
+
+// Distinct from the above in order to have function pointer that compared unequal
+// to a function pointer to the above.
+nsGenericHTMLElement*
+NS_NewCustomElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
+ mozilla::dom::FromParser aFromParser)
+{
+ return new mozilla::dom::HTMLElement(aNodeInfo);
+}
diff --git a/dom/html/HTMLSummaryElement.cpp b/dom/html/HTMLSummaryElement.cpp
index ee3c07b20..42ead6b87 100644
--- a/dom/html/HTMLSummaryElement.cpp
+++ b/dom/html/HTMLSummaryElement.cpp
@@ -14,17 +14,7 @@
#include "mozilla/TextEvents.h"
#include "nsFocusManager.h"
-// Expand NS_IMPL_NS_NEW_HTML_ELEMENT(Summary) to add pref check.
-nsGenericHTMLElement*
-NS_NewHTMLSummaryElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
- mozilla::dom::FromParser aFromParser)
-{
- if (!mozilla::dom::HTMLDetailsElement::IsDetailsEnabled()) {
- return new mozilla::dom::HTMLUnknownElement(aNodeInfo);
- }
-
- return new mozilla::dom::HTMLSummaryElement(aNodeInfo);
-}
+NS_IMPL_NS_NEW_HTML_ELEMENT(Summary)
namespace mozilla {
namespace dom {
diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp
index 0c8bcc9c8..78e4d5b95 100644
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -497,7 +497,7 @@ nsGenericHTMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
// We need to consider a labels element is moved to another subtree
// with different root, it needs to update labels list and its root
// as well.
- nsDOMSlots* slots = GetExistingDOMSlots();
+ nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
if (slots && slots->mLabelsList) {
slots->mLabelsList->MaybeResetRoot(SubtreeRoot());
}
@@ -524,7 +524,7 @@ nsGenericHTMLElement::UnbindFromTree(bool aDeep, bool aNullParent)
// We need to consider a labels element is removed from tree,
// it needs to update labels list and its root as well.
- nsDOMSlots* slots = GetExistingDOMSlots();
+ nsExtendedDOMSlots* slots = GetExistingExtendedDOMSlots();
if (slots && slots->mLabelsList) {
slots->mLabelsList->MaybeResetRoot(SubtreeRoot());
}
@@ -1730,7 +1730,7 @@ nsGenericHTMLElement::Labels()
{
MOZ_ASSERT(IsLabelable(),
"Labels() only allow labelable elements to use it.");
- nsDOMSlots* slots = DOMSlots();
+ nsExtendedDOMSlots* slots = ExtendedDOMSlots();
if (!slots->mLabelsList) {
slots->mLabelsList = new nsLabelsNodeList(SubtreeRoot(), MatchLabelsElement,
diff --git a/dom/html/nsGenericHTMLElement.h b/dom/html/nsGenericHTMLElement.h
index acbebe087..2b8b608b9 100644
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -1588,6 +1588,15 @@ protected:
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(_interface, \
mNodeInfo->Equals(nsGkAtoms::_tag))
+namespace mozilla {
+namespace dom {
+
+typedef nsGenericHTMLElement* (*HTMLContentCreatorFunction)(
+ already_AddRefed<mozilla::dom::NodeInfo>&&,
+ mozilla::dom::FromParser aFromParser);
+
+} // namespace dom
+} // namespace mozilla
/**
* A macro to declare the NS_NewHTMLXXXElement() functions.
@@ -1636,6 +1645,13 @@ nsGenericHTMLElement*
NS_NewHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
+// Distinct from the above in order to have function pointer that compared unequal
+// to a function pointer to the above.
+nsGenericHTMLElement*
+NS_NewCustomElement(
+ already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
+ mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
+
NS_DECLARE_NS_NEW_HTML_ELEMENT(Shared)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedObject)
diff --git a/dom/html/nsHTMLContentSink.cpp b/dom/html/nsHTMLContentSink.cpp
index 3e8e019b8..1fe5d2a86 100644
--- a/dom/html/nsHTMLContentSink.cpp
+++ b/dom/html/nsHTMLContentSink.cpp
@@ -84,10 +84,6 @@ using namespace mozilla::dom;
//----------------------------------------------------------------------
-typedef nsGenericHTMLElement*
- (*contentCreatorCallback)(already_AddRefed<mozilla::dom::NodeInfo>&&,
- FromParser aFromParser);
-
nsGenericHTMLElement*
NS_NewHTMLNOTUSEDElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
FromParser aFromParser)
@@ -96,14 +92,12 @@ NS_NewHTMLNOTUSEDElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
return nullptr;
}
-#define HTML_TAG(_tag, _classname) NS_NewHTML##_classname##Element,
-#define HTML_HTMLELEMENT_TAG(_tag) NS_NewHTMLElement,
+#define HTML_TAG(_tag, _classname, _interfacename) NS_NewHTML##_classname##Element,
#define HTML_OTHER(_tag) NS_NewHTMLNOTUSEDElement,
-static const contentCreatorCallback sContentCreatorCallbacks[] = {
+static const HTMLContentCreatorFunction sHTMLContentCreatorFunctions[] = {
NS_NewHTMLUnknownElement,
#include "nsHTMLTagList.h"
#undef HTML_TAG
-#undef HTML_HTMLELEMENT_TAG
#undef HTML_OTHER
NS_NewHTMLUnknownElement
};
@@ -234,9 +228,35 @@ public:
int32_t mStackPos;
};
+static void
+DoCustomElementCreate(Element** aElement, nsIDocument* aDoc, nsIAtom* aLocalName,
+ CustomElementConstructor* aConstructor, ErrorResult& aRv)
+{
+ RefPtr<Element> element =
+ aConstructor->Construct("Custom Element Create", aRv);
+ if (aRv.Failed()) {
+ return;
+ }
+
+ if (!element || !element->IsHTMLElement()) {
+ aRv.ThrowTypeError<MSG_THIS_DOES_NOT_IMPLEMENT_INTERFACE>(NS_LITERAL_STRING("HTMLElement"));
+ return;
+ }
+
+ if (aDoc != element->OwnerDoc() || element->GetParentNode() ||
+ element->HasChildren() || element->GetAttrCount() ||
+ element->NodeInfo()->NameAtom() != aLocalName) {
+ aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
+ return;
+ }
+
+ element.forget(aElement);
+}
+
nsresult
NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
- FromParser aFromParser, const nsAString* aIs)
+ FromParser aFromParser, const nsAString* aIs,
+ mozilla::dom::CustomElementDefinition* aDefinition)
{
*aResult = nullptr;
@@ -247,16 +267,109 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
return NS_ERROR_OUT_OF_MEMORY;
nsIAtom *name = nodeInfo->NameAtom();
+ RefPtr<nsIAtom> tagAtom = nodeInfo->NameAtom();
+ RefPtr<nsIAtom> typeAtom = aIs ? NS_Atomize(*aIs) : tagAtom;
NS_ASSERTION(nodeInfo->NamespaceEquals(kNameSpaceID_XHTML),
"Trying to HTML elements that don't have the XHTML namespace");
int32_t tag = parserService->HTMLCaseSensitiveAtomTagToId(name);
- // Per the Custom Element specification, unknown tags that are valid custom
- // element names should be HTMLElement instead of HTMLUnknownElement.
bool isCustomElementName = (tag == eHTMLTag_userdefined &&
nsContentUtils::IsCustomElementName(name));
+ bool isCustomElement = isCustomElementName || aIs;
+ MOZ_ASSERT_IF(aDefinition, isCustomElement);
+
+ // https://dom.spec.whatwg.org/#concept-create-element
+ // We only handle the "synchronous custom elements flag is set" now.
+ // For the unset case (e.g. cloning a node), see bug 1319342 for that.
+ // Step 4.
+ CustomElementDefinition* definition = aDefinition;
+ if (CustomElementRegistry::IsCustomElementEnabled() && isCustomElement &&
+ !definition) {
+ MOZ_ASSERT(nodeInfo->NameAtom()->Equals(nodeInfo->LocalName()));
+ definition =
+ nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
+ nodeInfo->NameAtom(),
+ nodeInfo->NamespaceID(),
+ typeAtom);
+ }
+
+ // It might be a problem that parser synchronously calls constructor, so filed
+ // bug 1378079 to figure out what we should do for parser case.
+ if (definition) {
+ /*
+ * Synchronous custom elements flag is determined by 3 places in spec,
+ * 1) create an element for a token, the flag is determined by
+ * "will execute script" which is not originally created
+ * for the HTML fragment parsing algorithm.
+ * 2) createElement and createElementNS, the flag is the same as
+ * NOT_FROM_PARSER.
+ * 3) clone a node, our implementation will not go into this function.
+ * For the unset case which is non-synchronous only applied for
+ * inner/outerHTML.
+ */
+ bool synchronousCustomElements = aFromParser != dom::FROM_PARSER_FRAGMENT ||
+ aFromParser == dom::NOT_FROM_PARSER;
+ // Per discussion in https://github.com/w3c/webcomponents/issues/635,
+ // use entry global in those places that are called from JS APIs and use the
+ // node document's global object if it is called from parser.
+ nsIGlobalObject* global;
+ if (aFromParser == dom::NOT_FROM_PARSER) {
+ global = GetEntryGlobal();
+ } else {
+ global = nodeInfo->GetDocument()->GetScopeObject();
+ }
+ if (!global) {
+ // In browser chrome code, one may have access to a document which doesn't
+ // have scope object anymore.
+ return NS_ERROR_FAILURE;
+ }
+
+ AutoEntryScript aes(global, "create custom elements");
+ JSContext* cx = aes.cx();
+ ErrorResult rv;
+
+ // Step 5.
+ if (definition->IsCustomBuiltIn()) {
+ // SetupCustomElement() should be called with an element that don't have
+ // CustomElementData setup, if not we will hit the assertion in
+ // SetCustomElementData().
+ // Built-in element
+ *aResult = CreateHTMLElement(tag, nodeInfo.forget(), aFromParser).take();
+ (*aResult)->SetCustomElementData(new CustomElementData(typeAtom));
+ if (synchronousCustomElements) {
+ CustomElementRegistry::Upgrade(*aResult, definition, rv);
+ if (rv.MaybeSetPendingException(cx)) {
+ aes.ReportException();
+ }
+ } else {
+ nsContentUtils::EnqueueUpgradeReaction(*aResult, definition);
+ }
+
+ return NS_OK;
+ }
+
+ // Step 6.1.
+ if (synchronousCustomElements) {
+ DoCustomElementCreate(aResult, nodeInfo->GetDocument(),
+ nodeInfo->NameAtom(),
+ definition->mConstructor, rv);
+ if (rv.MaybeSetPendingException(cx)) {
+ NS_IF_ADDREF(*aResult = NS_NewHTMLUnknownElement(nodeInfo.forget(), aFromParser));
+ }
+ return NS_OK;
+ }
+
+ // Step 6.2.
+ NS_IF_ADDREF(*aResult = NS_NewHTMLElement(nodeInfo.forget(), aFromParser));
+ (*aResult)->SetCustomElementData(new CustomElementData(definition->mType));
+ nsContentUtils::EnqueueUpgradeReaction(*aResult, definition);
+ return NS_OK;
+ }
+
+ // Per the Custom Element specification, unknown tags that are valid custom
+ // element names should be HTMLElement instead of HTMLUnknownElement.
if (isCustomElementName) {
NS_IF_ADDREF(*aResult = NS_NewHTMLElement(nodeInfo.forget(), aFromParser));
} else {
@@ -267,8 +380,8 @@ NS_NewHTMLElement(Element** aResult, already_AddRefed<mozilla::dom::NodeInfo>&&
return NS_ERROR_OUT_OF_MEMORY;
}
- if (isCustomElementName || aIs) {
- nsContentUtils::SetupCustomElement(*aResult, aIs);
+ if (CustomElementRegistry::IsCustomElementEnabled() && isCustomElement) {
+ (*aResult)->SetCustomElementData(new CustomElementData(typeAtom));
}
return NS_OK;
@@ -283,7 +396,7 @@ CreateHTMLElement(uint32_t aNodeType,
aNodeType == eHTMLTag_userdefined,
"aNodeType is out of bounds");
- contentCreatorCallback cb = sContentCreatorCallbacks[aNodeType];
+ HTMLContentCreatorFunction cb = sHTMLContentCreatorFunctions[aNodeType];
NS_ASSERTION(cb != NS_NewHTMLNOTUSEDElement,
"Don't know how to construct tag element!");
diff --git a/dom/html/nsHTMLDocument.cpp b/dom/html/nsHTMLDocument.cpp
index 0f2d90673..f530d75e1 100644
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -1013,26 +1013,6 @@ nsHTMLDocument::SetDomain(const nsAString& aDomain, ErrorResult& rv)
rv = NodePrincipal()->SetDomain(newURI);
}
-nsGenericHTMLElement*
-nsHTMLDocument::GetBody()
-{
- Element* html = GetHtmlElement();
- if (!html) {
- return nullptr;
- }
-
- for (nsIContent* child = html->GetFirstChild();
- child;
- child = child->GetNextSibling()) {
- if (child->IsHTMLElement(nsGkAtoms::body) ||
- child->IsHTMLElement(nsGkAtoms::frameset)) {
- return static_cast<nsGenericHTMLElement*>(child);
- }
- }
-
- return nullptr;
-}
-
NS_IMETHODIMP
nsHTMLDocument::GetBody(nsIDOMHTMLElement** aBody)
{
@@ -1054,31 +1034,6 @@ nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody)
return rv.StealNSResult();
}
-void
-nsHTMLDocument::SetBody(nsGenericHTMLElement* newBody, ErrorResult& rv)
-{
- nsCOMPtr<Element> root = GetRootElement();
-
- // The body element must be either a body tag or a frameset tag. And we must
- // have a html root tag, otherwise GetBody will not return the newly set
- // body.
- if (!newBody ||
- !newBody->IsAnyOfHTMLElements(nsGkAtoms::body, nsGkAtoms::frameset) ||
- !root || !root->IsHTMLElement() ||
- !root->IsHTMLElement(nsGkAtoms::html)) {
- rv.Throw(NS_ERROR_DOM_HIERARCHY_REQUEST_ERR);
- return;
- }
-
- // Use DOM methods so that we pass through the appropriate security checks.
- nsCOMPtr<Element> currentBody = GetBodyElement();
- if (currentBody) {
- root->ReplaceChild(*newBody, *currentBody, rv);
- } else {
- root->AppendChild(*newBody, rv);
- }
-}
-
NS_IMETHODIMP
nsHTMLDocument::GetHead(nsIDOMHTMLHeadElement** aHead)
{
@@ -1446,6 +1401,11 @@ nsHTMLDocument::Open(JSContext* cx,
return nullptr;
}
+ if (ShouldThrowOnDynamicMarkupInsertion()) {
+ aError.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
+ return nullptr;
+ }
+
// Set up the content type for insertion
nsAutoCString contentType;
contentType.AssignLiteral("text/html");
@@ -1653,6 +1613,11 @@ nsHTMLDocument::Close(ErrorResult& rv)
return;
}
+ if (ShouldThrowOnDynamicMarkupInsertion()) {
+ rv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
+ return;
+ }
+
if (!mParser || !mParser->IsScriptCreated()) {
return;
}
@@ -1728,6 +1693,10 @@ nsHTMLDocument::WriteCommon(JSContext *cx,
return NS_ERROR_DOM_INVALID_STATE_ERR;
}
+ if (ShouldThrowOnDynamicMarkupInsertion()) {
+ return NS_ERROR_DOM_INVALID_STATE_ERR;
+ }
+
if (mParserAborted) {
// Hixie says aborting the parser doesn't undefine the insertion point.
// However, since we null out mParser in that case, we track the
diff --git a/dom/html/nsHTMLDocument.h b/dom/html/nsHTMLDocument.h
index 1fa81f6cd..c9e46b3fa 100644
--- a/dom/html/nsHTMLDocument.h
+++ b/dom/html/nsHTMLDocument.h
@@ -175,8 +175,8 @@ public:
JS::MutableHandle<JSObject*> aRetval,
mozilla::ErrorResult& rv);
void GetSupportedNames(nsTArray<nsString>& aNames);
- nsGenericHTMLElement *GetBody();
- void SetBody(nsGenericHTMLElement* aBody, mozilla::ErrorResult& rv);
+ using nsIDocument::GetBody;
+ using nsIDocument::SetBody;
mozilla::dom::HTMLSharedElement *GetHead() {
return static_cast<mozilla::dom::HTMLSharedElement*>(GetHeadElement());
}
diff --git a/dom/html/test/file_iframe_sandbox_c_if4.html b/dom/html/test/file_iframe_sandbox_c_if4.html
index 53bf49559..828592d63 100644
--- a/dom/html/test/file_iframe_sandbox_c_if4.html
+++ b/dom/html/test/file_iframe_sandbox_c_if4.html
@@ -12,7 +12,7 @@
}
function doStuff() {
- // try to open a new window via target="_blank", target="BC341604", window.open(), and showModalDialog()
+ // try to open a new window via target="_blank", target="BC341604", and window.open()
// the window we try to open closes itself once it opens
sendMouseEvent({type:'click'}, 'target_blank');
sendMouseEvent({type:'click'}, 'target_BC341604');
@@ -25,15 +25,6 @@
}
ok(threw, "window.open threw a JS exception and was not allowed");
-
- threw = false;
- try {
- window.showModalDialog("about:blank");
- } catch(error) {
- threw = true;
- }
-
- ok(threw, "window.showModalDialog threw a JS exception and was not allowed");
}
</script>
<body onLoad="doStuff()">
diff --git a/dom/html/test/file_iframe_sandbox_j_if1.html b/dom/html/test/file_iframe_sandbox_j_if1.html
deleted file mode 100644
index 6d4347dfc..000000000
--- a/dom/html/test/file_iframe_sandbox_j_if1.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="utf-8">
- <title>Test for Bug 766282</title>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-
-<script type="text/javascript">
- function doStuff() {
- // Open a new window via showModalDialog().
- try {
- window.showModalDialog("file_iframe_sandbox_k_if5.html");
- } catch(e) {
- window.parent.ok_wrapper(false, "iframes sandboxed with allow-popups and allow-modals should be able to open a modal dialog");
- }
-
- // Open a new window via showModalDialog().
- try {
- window.showModalDialog("file_iframe_sandbox_k_if7.html");
- } catch(e) {
- window.parent.ok_wrapper(false, "iframes sandboxed with allow-popups and allow-modals should be able to open a modal dialog");
- }
- }
-</script>
-
-<body onLoad="doStuff()">
- I am sandboxed with "allow-scripts allow-popups allow-same-origin allow-forms allow-top-navigation".
-</body>
-</html>
diff --git a/dom/html/test/file_iframe_sandbox_j_if2.html b/dom/html/test/file_iframe_sandbox_j_if2.html
deleted file mode 100644
index 9552307ee..000000000
--- a/dom/html/test/file_iframe_sandbox_j_if2.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="utf-8">
- <title>Test for Bug 766282</title>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-
-<script type="text/javascript">
- function doSubOpens() {
- // Open a new window showModalDialog().
- try {
- window.showModalDialog("file_iframe_sandbox_k_if9.html");
- } catch(e) {
- window.parent.ok_wrapper(false, "iframes sandboxed with allow-popups and allow-modals should be able to open a modal dialog");
- }
- }
-
- window.doSubOpens = doSubOpens;
-</script>
-
-<body>
- I am sandboxed but with "allow-scripts allow-popups allow-same-origin".
- After my initial load, "allow-same-origin" is removed and then I open file_iframe_sandbox_k_if9.html,
- which attemps to call a function in my parent.
- This should succeed since the new sandbox flags shouldn't have taken affect on me until I'm reloaded.
-</body>
-</html>
diff --git a/dom/html/test/file_iframe_sandbox_j_if3.html b/dom/html/test/file_iframe_sandbox_j_if3.html
deleted file mode 100644
index 07c5b66c1..000000000
--- a/dom/html/test/file_iframe_sandbox_j_if3.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <meta charset="utf-8">
- <title>Tests for Bug 766282</title>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-
-</head>
-<script type="text/javascript">
- function ok(result, desc) {
- window.parent.ok_wrapper(result, desc);
- }
-
- function doStuff() {
- // Try to open a new window via showModalDialog().
- // The window we try to open closes itself once it opens.
- try {
- window.showModalDialog("file_iframe_sandbox_open_window_pass.html");
- } catch(e) {
- ok(false, "iframes sandboxed with allow-popups and allow-modals should be able to open a modal dialog");
- }
- }
-</script>
-<body onLoad="doStuff()">
- I am sandboxed but with "allow-popups allow-scripts allow-same-origin"
-</body>
-</html>
diff --git a/dom/html/test/mochitest.ini b/dom/html/test/mochitest.ini
index 024de1cd9..4a50a9c3f 100644
--- a/dom/html/test/mochitest.ini
+++ b/dom/html/test/mochitest.ini
@@ -154,9 +154,6 @@ support-files =
file_iframe_sandbox_form_pass.html
file_iframe_sandbox_g_if1.html
file_iframe_sandbox_h_if1.html
- file_iframe_sandbox_j_if1.html
- file_iframe_sandbox_j_if2.html
- file_iframe_sandbox_j_if3.html
file_iframe_sandbox_k_if1.html
file_iframe_sandbox_k_if2.html
file_iframe_sandbox_k_if3.html
@@ -471,9 +468,6 @@ skip-if = toolkit == 'android' # just copy the conditions from the test above
tags = openwindow
[test_iframe_sandbox_inheritance.html]
tags = openwindow
-[test_iframe_sandbox_modal.html]
-tags = openwindow
-skip-if = toolkit == 'android' || e10s #modal tests fail on android
[test_iframe_sandbox_navigation.html]
tags = openwindow
[test_iframe_sandbox_navigation2.html]
@@ -540,8 +534,6 @@ skip-if = toolkit == 'android' #bug 811644
[test_bug369370.html]
skip-if = toolkit == "android" || toolkit == "windows" # disabled on Windows because of bug 1234520
[test_bug380383.html]
-[test_bug391777.html]
-skip-if = toolkit == 'android' || e10s
[test_bug402680.html]
[test_bug403868.html]
[test_bug403868.xhtml]
@@ -607,4 +599,4 @@ skip-if = os == "android" # up/down arrow keys not supported on android
[test_script_module.html]
support-files =
file_script_module.html
- file_script_nomodule.html \ No newline at end of file
+ file_script_nomodule.html
diff --git a/dom/html/test/test_bug391777.html b/dom/html/test/test_bug391777.html
deleted file mode 100644
index aa01a45de..000000000
--- a/dom/html/test/test_bug391777.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=391777
--->
-<head>
- <title>Test for Bug 391777</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=391777">Mozilla Bug 391777</a>
-<p id="display"></p>
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 391777 **/
-var arg = {};
-arg.testVal = "foo";
-var result = window.showModalDialog("javascript:window.returnValue = window.dialogArguments.testVal; window.close(); 'This window should close on its own.';", arg);
-ok(true, "We should get here without user interaction");
-is(result, "foo", "Unexpected result from showModalDialog");
-
-</script>
-</body>
-</html>
diff --git a/dom/html/test/test_iframe_sandbox_general.html b/dom/html/test/test_iframe_sandbox_general.html
index 6d3a190ee..83f0e9045 100644
--- a/dom/html/test/test_iframe_sandbox_general.html
+++ b/dom/html/test/test_iframe_sandbox_general.html
@@ -41,7 +41,7 @@ function ok_wrapper(result, desc) {
passedTests++;
}
- if (completedTests == 33) {
+ if (completedTests == 32) {
is(passedTests, completedTests, "There are " + completedTests + " general tests that should pass");
SimpleTest.finish();
}
diff --git a/dom/html/test/test_iframe_sandbox_modal.html b/dom/html/test/test_iframe_sandbox_modal.html
deleted file mode 100644
index 1307ea9a5..000000000
--- a/dom/html/test/test_iframe_sandbox_modal.html
+++ /dev/null
@@ -1,122 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=766282
-implement allow-popups directive for iframe sandbox
--->
-<head>
- <meta charset="utf-8">
- <title>Tests for Bug 766282</title>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-
-<script>
-
-SimpleTest.waitForExplicitFinish();
-SimpleTest.requestFlakyTimeout("untriaged");
-
-// A postMessage handler that is used by sandboxed iframes without
-// 'allow-same-origin' to communicate pass/fail back to this main page.
-window.addEventListener("message", receiveMessage, false);
-
-function receiveMessage(event) {
- switch (event.data.type) {
- case "attempted":
- testAttempted();
- break;
- case "ok":
- ok_wrapper(event.data.ok, event.data.desc, event.data.addToAttempted);
- break;
- default:
- // allow for old style message
- if (event.data.ok != undefined) {
- ok_wrapper(event.data.ok, event.data.desc, event.data.addToAttempted);
- }
- }
-}
-
-var attemptedTests = 0;
-var passedTests = 0;
-var totalTestsToPass = 5;
-var totalTestsToAttempt = 5;
-
-function ok_wrapper(result, desc, addToAttempted = true) {
- ok(result, desc);
-
- if (result) {
- passedTests++;
- }
-
- if (addToAttempted) {
- testAttempted();
- }
-}
-
-// Added so that tests that don't register unless they fail,
-// can at least notify that they've attempted to run.
-function testAttempted() {
- attemptedTests++;
- if (attemptedTests == totalTestsToAttempt) {
- // Make sure all tests have had a chance to complete.
- setTimeout(function() {finish();}, 1000);
- }
-}
-
-var finishCalled = false;
-
-function finish() {
- if (!finishCalled) {
- finishCalled = true;
- is(passedTests, totalTestsToPass, "There are " + totalTestsToPass + " modal tests that should pass");
-
- SimpleTest.finish();
- }
-}
-
-function doTest() {
- // passes if good and fails if bad
- // 1) A window opened from inside an iframe that has sandbox = "allow-scripts allow-popups
- // allow-same-origin" should not have its origin sandbox flag set and be able to access
- // document.cookie. (Done by file_iframe_sandbox_k_if5.html opened from
- // file_iframe_sandbox_j_if1.html) using showModalDialog.)
-
- // passes if good
- // 2) A window opened from inside an iframe that has sandbox = "allow-scripts allow-popups
- // allow-top-navigation" should not have its top-level navigation sandbox flag set and be able to
- // navigate top. (Done by file_iframe_sandbox_k_if5.html (and if6) opened from
- // file_iframe_sandbox_j_if1.html) using showModalDialog.)
-
- // passes if good
- // 3) A window opened from inside an iframe that has sandbox = "allow-scripts allow-popups
- // all-forms" should not have its forms sandbox flag set and be able to submit forms.
- // (Done by file_iframe_sandbox_k_if7.html opened from
- // file_iframe_sandbox_j_if1.html) using showModalDialog.)
-
- // passes if good
- // 4) Make sure that the sandbox flags copied to a new browsing context are taken from the
- // current active document not the browsing context (iframe / docShell).
- // This is done by removing allow-same-origin and calling doSubOpens from file_iframe_sandbox_j_if2.html,
- // which opens file_iframe_sandbox_k_if9.html using showModalDialog.
- var if_2 = document.getElementById('if_2');
- if_2.sandbox = 'allow-scripts allow-popups';
- if_2.contentWindow.doSubOpens();
-
- // passes if good
- // 5) Test that a sandboxed iframe with "allow-popups" can open a new window using window.ShowModalDialog.
- // This is done via file_iframe_sandbox_j_if3.html which is sandboxed with "allow-popups allow-scripts
- // allow-same-origin". The window it attempts to open calls window.opener.ok(true, ...) and
- // file_iframe_j_if3.html has an ok() function that calls window.parent.ok_wrapper.
-}
-
-addLoadEvent(doTest);
-</script>
-
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=766282">Mozilla Bug 766282</a> - implement allow-popups directive for iframe sandbox
-<p id="display"></p>
-<div id="content">
-<iframe sandbox="allow-scripts allow-popups allow-modals allow-same-origin allow-forms allow-top-navigation" id="if_1" src="file_iframe_sandbox_j_if1.html" height="10" width="10"></iframe>
-<iframe sandbox="allow-scripts allow-popups allow-modals allow-same-origin" id="if_2" src="file_iframe_sandbox_j_if2.html" height="10" width="10"></iframe>
-<iframe sandbox="allow-popups allow-modals allow-same-origin allow-scripts" id="if_3" src="file_iframe_sandbox_j_if3.html" height="10" width="10"></iframe>
-</div>