diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/accessible/base/TextUpdater.cpp firefox-trunk-62.0~a1~hg20180620r423058/accessible/base/TextUpdater.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/accessible/base/TextUpdater.cpp 2018-06-11 13:02:05.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/accessible/base/TextUpdater.cpp 2018-06-20 17:28:58.000000000 +0000
@@ -46,7 +46,7 @@
mHyperText = parent->AsHyperText();
if (!mHyperText) {
- NS_ERROR("Text leaf parent is not hypertext!");
+ MOZ_ASSERT_UNREACHABLE("Text leaf parent is not hypertext!");
return;
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/accessible/generic/Accessible.cpp firefox-trunk-62.0~a1~hg20180620r423058/accessible/generic/Accessible.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/accessible/generic/Accessible.cpp 2018-06-11 13:02:05.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/accessible/generic/Accessible.cpp 2018-06-20 17:28:58.000000000 +0000
@@ -357,7 +357,7 @@
if (deckFrame->GetContent()->IsXULElement(nsGkAtoms::tabpanels))
return states::OFFSCREEN;
- NS_NOTREACHED("Children of not selected deck panel are not accessible.");
+ MOZ_ASSERT_UNREACHABLE("Children of not selected deck panel are not accessible.");
return states::INVISIBLE;
}
@@ -1957,8 +1957,8 @@
return;
}
- NS_ASSERTION(mParent,
- "Called on accessible unbound from tree. Result can be wrong.");
+ MOZ_ASSERT(mParent,
+ "Called on accessible unbound from tree. Result can be wrong.");
if (frame->IsBrFrame()) {
aText += kForcedNewLineChar;
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/accessible/tests/browser/browser.ini firefox-trunk-62.0~a1~hg20180620r423058/accessible/tests/browser/browser.ini
--- firefox-trunk-62.0~a1~hg20180611r422292/accessible/tests/browser/browser.ini 2018-06-11 13:02:05.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/accessible/tests/browser/browser.ini 2018-06-20 17:28:58.000000000 +0000
@@ -11,7 +11,7 @@
[browser_shutdown_multi_acc_reference_doc.js]
[browser_shutdown_multi_reference.js]
[browser_shutdown_parent_own_reference.js]
-skip-if = !e10s || (os == 'win' && os_version == '5.1') || (verify && debug && (os == 'win')) # e10s specific test for a11y start/shutdown between parent and content.
+skip-if = !e10s || (verify && debug && (os == 'win')) # e10s specific test for a11y start/shutdown between parent and content.
[browser_shutdown_pref.js]
[browser_shutdown_proxy_acc_reference.js]
skip-if = !e10s || (os == 'win') # e10s specific test for a11y start/shutdown between parent and content.
@@ -22,11 +22,11 @@
[browser_shutdown_multi_proxy_acc_reference_obj.js]
skip-if = !e10s || (os == 'win') || (verify && debug && (os == 'linux')) # e10s specific test for a11y start/shutdown between parent and content.
[browser_shutdown_remote_no_reference.js]
-skip-if = !e10s || (os == 'win' && os_version == '5.1') || (verify && debug && (os == 'win')) # e10s specific test for a11y start/shutdown between parent and content.
+skip-if = !e10s || (verify && debug && (os == 'win')) # e10s specific test for a11y start/shutdown between parent and content.
[browser_shutdown_remote_only.js]
-skip-if = !e10s || (os == 'win' && os_version == '5.1') # e10s specific test for a11y start/shutdown between parent and content.
+skip-if = !e10s # e10s specific test for a11y start/shutdown between parent and content.
[browser_shutdown_remote_own_reference.js]
-skip-if = !e10s || (os == 'win' && os_version == '5.1') # e10s specific test for a11y start/shutdown between parent and content.
+skip-if = !e10s # e10s specific test for a11y start/shutdown between parent and content.
[browser_shutdown_scope_lifecycle.js]
[browser_shutdown_start_restart.js]
skip-if = (verify && debug)
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/accessible/tests/mochitest/actions/a11y.ini firefox-trunk-62.0~a1~hg20180620r423058/accessible/tests/mochitest/actions/a11y.ini
--- firefox-trunk-62.0~a1~hg20180611r422292/accessible/tests/mochitest/actions/a11y.ini 2018-06-11 13:02:05.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/accessible/tests/mochitest/actions/a11y.ini 2018-06-20 17:28:58.000000000 +0000
@@ -12,7 +12,6 @@
[test_keys_menu.xul]
[test_link.html]
[test_media.html]
-skip-if = buildapp == 'mulet'
[test_select.html]
[test_tree.xul]
[test_treegrid.xul]
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/accessible/tests/mochitest/aom/test_general.html firefox-trunk-62.0~a1~hg20180620r423058/accessible/tests/mochitest/aom/test_general.html
--- firefox-trunk-62.0~a1~hg20180611r422292/accessible/tests/mochitest/aom/test_general.html 2018-06-11 13:02:05.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/accessible/tests/mochitest/aom/test_general.html 2018-06-20 17:28:58.000000000 +0000
@@ -107,7 +107,7 @@
is(anode, node.accessibleNode, "an AccessibleNode is properly cached");
// Adopting node to another document doesn't change .accessibleNode
- anotherDoc = document.implementation.createDocument("", "", null);
+ let anotherDoc = document.implementation.createDocument("", "", null);
let adopted_node = anotherDoc.adoptNode(node);
is(anode, adopted_node.accessibleNode, "adopting node to another document doesn't change node.accessibleNode");
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/accessible/tests/mochitest/elm/a11y.ini firefox-trunk-62.0~a1~hg20180620r423058/accessible/tests/mochitest/elm/a11y.ini
--- firefox-trunk-62.0~a1~hg20180611r422292/accessible/tests/mochitest/elm/a11y.ini 2018-06-11 13:02:05.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/accessible/tests/mochitest/elm/a11y.ini 2018-06-20 17:28:58.000000000 +0000
@@ -5,13 +5,11 @@
!/dom/media/test/bug461281.ogg
[test_HTMLSpec.html]
-skip-if = buildapp == 'mulet'
[test_figure.html]
[test_listbox.xul]
[test_MathMLSpec.html]
[test_nsApplicationAcc.html]
[test_plugin.html]
-skip-if = buildapp == 'mulet'
[test_canvas.html]
[test_shadowroot.html]
support-files = test_shadowroot_subframe.html
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/accessible/tests/mochitest/elm/test_nsApplicationAcc.html firefox-trunk-62.0~a1~hg20180620r423058/accessible/tests/mochitest/elm/test_nsApplicationAcc.html
--- firefox-trunk-62.0~a1~hg20180611r422292/accessible/tests/mochitest/elm/test_nsApplicationAcc.html 2018-06-11 13:02:05.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/accessible/tests/mochitest/elm/test_nsApplicationAcc.html 2018-06-20 17:28:58.000000000 +0000
@@ -13,7 +13,6 @@
src="../role.js">
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/animation/test/crashtests/crashtests.list firefox-trunk-62.0~a1~hg20180620r423058/dom/animation/test/crashtests/crashtests.list
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/animation/test/crashtests/crashtests.list 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/animation/test/crashtests/crashtests.list 2018-06-20 17:29:02.000000000 +0000
@@ -40,3 +40,4 @@
load 1400022-1.html
pref(dom.animations-api.core.enabled,true) load 1401809.html
pref(dom.animations-api.core.enabled,true) load 1411318-1.html
+load 1468294-1.html
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/AnonymousContent.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/AnonymousContent.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/AnonymousContent.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/AnonymousContent.cpp 2018-06-20 17:29:02.000000000 +0000
@@ -228,7 +228,9 @@
}
RefPtr cs =
- new nsComputedDOMStyle(element, NS_LITERAL_STRING(""), shell,
+ new nsComputedDOMStyle(element,
+ NS_LITERAL_STRING(""),
+ element->OwnerDoc(),
nsComputedDOMStyle::eAll);
aRv = cs->GetPropertyValue(aPropertyName, aResult);
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/Attr.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/Attr.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/Attr.cpp 2018-06-11 13:02:08.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/Attr.cpp 2018-06-20 17:29:03.000000000 +0000
@@ -289,18 +289,6 @@
return NS_ERROR_NOT_IMPLEMENTED;
}
-nsresult
-Attr::InsertChildAt_Deprecated(nsIContent* aKid, uint32_t aIndex,
- bool aNotify)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-void
-Attr::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
-{
-}
-
void
Attr::RemoveChildNode(nsIContent* aKid, bool aNotify)
{
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/Attr.h firefox-trunk-62.0~a1~hg20180620r423058/dom/base/Attr.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/Attr.h 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/Attr.h 2018-06-20 17:29:03.000000000 +0000
@@ -63,9 +63,6 @@
virtual int32_t ComputeIndexOf(const nsINode* aPossibleChild) const override;
virtual nsresult InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
bool aNotify) override;
- virtual nsresult InsertChildAt_Deprecated(nsIContent* aKid, uint32_t aIndex,
- bool aNotify) override;
- virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/CharacterData.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/CharacterData.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/CharacterData.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/CharacterData.cpp 2018-06-20 17:29:02.000000000 +0000
@@ -634,19 +634,6 @@
return NS_OK;
}
-nsresult
-CharacterData::InsertChildAt_Deprecated(nsIContent* aKid,
- uint32_t aIndex,
- bool aNotify)
-{
- return NS_OK;
-}
-
-void
-CharacterData::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
-{
-}
-
void
CharacterData::RemoveChildNode(nsIContent* aKid, bool aNotify)
{
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/CharacterData.h firefox-trunk-62.0~a1~hg20180620r423058/dom/base/CharacterData.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/CharacterData.h 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/CharacterData.h 2018-06-20 17:29:03.000000000 +0000
@@ -105,9 +105,6 @@
virtual int32_t ComputeIndexOf(const nsINode* aPossibleChild) const override;
virtual nsresult InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
bool aNotify) override;
- virtual nsresult InsertChildAt_Deprecated(nsIContent* aKid, uint32_t aIndex,
- bool aNotify) override;
- virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
virtual void GetTextContentInternal(nsAString& aTextContent,
OOMReporter& aError) override
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/CustomElementRegistry.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/CustomElementRegistry.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/CustomElementRegistry.cpp 2018-06-11 13:02:08.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/CustomElementRegistry.cpp 2018-06-20 17:29:03.000000000 +0000
@@ -981,6 +981,45 @@
return;
}
+static void
+TryUpgrade(nsINode& aNode)
+{
+ Element* element = aNode.IsElement() ? aNode.AsElement() : nullptr;
+ if (element) {
+ CustomElementData* ceData = element->GetCustomElementData();
+ if (ceData) {
+ NodeInfo* nodeInfo = element->NodeInfo();
+ nsAtom* typeAtom = ceData->GetCustomElementType();
+ CustomElementDefinition* definition =
+ nsContentUtils::LookupCustomElementDefinition(nodeInfo->GetDocument(),
+ nodeInfo->NameAtom(),
+ nodeInfo->NamespaceID(),
+ typeAtom);
+ if (definition) {
+ nsContentUtils::EnqueueUpgradeReaction(element, definition);
+ }
+ }
+
+ if (ShadowRoot* root = element->GetShadowRoot()) {
+ for (Element* child = root->GetFirstElementChild(); child;
+ child = child->GetNextElementSibling()) {
+ TryUpgrade(*child);
+ }
+ }
+ }
+
+ for (Element* child = aNode.GetFirstElementChild(); child;
+ child = child->GetNextElementSibling()) {
+ TryUpgrade(*child);
+ }
+}
+
+void
+CustomElementRegistry::Upgrade(nsINode& aRoot)
+{
+ TryUpgrade(aRoot);
+}
+
void
CustomElementRegistry::Get(JSContext* aCx, const nsAString& aName,
JS::MutableHandle aRetVal)
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/CustomElementRegistry.h firefox-trunk-62.0~a1~hg20180620r423058/dom/base/CustomElementRegistry.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/CustomElementRegistry.h 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/CustomElementRegistry.h 2018-06-20 17:29:03.000000000 +0000
@@ -554,6 +554,8 @@
// Chrome-only method that give JS an opportunity to only load the custom
// element definition script when needed.
void SetElementCreationCallback(const nsAString& aName, CustomElementCreationCallback& aCallback, ErrorResult& aRv);
+
+ void Upgrade(nsINode& aRoot);
};
class MOZ_RAII AutoCEReaction final {
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/DirectionalityUtils.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/DirectionalityUtils.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/DirectionalityUtils.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/DirectionalityUtils.cpp 2018-06-20 17:29:02.000000000 +0000
@@ -213,6 +213,7 @@
#include "mozilla/AutoRestore.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/dom/Element.h"
+#include "mozilla/dom/ShadowRoot.h"
#include "nsUnicodeProperties.h"
#include "nsTextFragment.h"
#include "nsAttrValue.h"
@@ -222,6 +223,7 @@
namespace mozilla {
using mozilla::dom::Element;
+using mozilla::dom::ShadowRoot;
/**
* Returns true if aElement is one of the elements whose text content should not
@@ -241,7 +243,7 @@
nodeInfo->Equals(nsGkAtoms::script) ||
nodeInfo->Equals(nsGkAtoms::style) ||
nodeInfo->Equals(nsGkAtoms::textarea) ||
- (aElement->IsInAnonymousSubtree() && !aElement->HasDirAuto()));
+ aElement->IsInAnonymousSubtree());
}
/**
@@ -254,8 +256,7 @@
{
return (DoesNotParticipateInAutoDirection(aElement) ||
aElement->IsHTMLElement(nsGkAtoms::bdi) ||
- aElement->HasFixedDir() ||
- aElement->IsInAnonymousSubtree());
+ aElement->HasFixedDir());
}
/**
@@ -277,18 +278,16 @@
}
}
+// FIXME(bug 1100912): Should ShadowRoot children affect the host if it's
+// dir=auto? Probably not at least in closed mode.
inline static bool
NodeAffectsDirAutoAncestor(nsINode* aTextNode)
{
Element* parent = aTextNode->GetParentElement();
- // In the anonymous content, we limit our implementation to only
- // allow the children text node of the direct dir=auto parent in
- // the same anonymous subtree to affact the direction.
return (parent &&
!DoesNotParticipateInAutoDirection(parent) &&
parent->NodeOrAncestorHasDirAuto() &&
- (!aTextNode->IsInAnonymousSubtree() ||
- parent->HasDirAuto()));
+ !aTextNode->IsInAnonymousSubtree());
}
Directionality
@@ -376,7 +375,7 @@
* @return the text node containing the character that determined the direction
*/
static nsTextNode*
-WalkDescendantsSetDirectionFromText(Element* aElement, bool aNotify = true,
+WalkDescendantsSetDirectionFromText(Element* aElement, bool aNotify,
nsINode* aChangedNode = nullptr)
{
MOZ_ASSERT(aElement, "Must have an element");
@@ -630,51 +629,69 @@
MOZ_ASSERT(!aElement->HasDirAuto(),
"RecomputeDirectionality called with dir=auto");
+ if (aElement->HasValidDir()) {
+ return aElement->GetDirectionality();
+ }
+
Directionality dir = eDir_LTR;
+ if (nsINode* parent = aElement->GetParentNode()) {
+ if (ShadowRoot* shadow = ShadowRoot::FromNode(parent)) {
+ parent = shadow->GetHost();
+ }
- if (aElement->HasValidDir()) {
- dir = aElement->GetDirectionality();
- } else {
- Element* parent = aElement->GetParentElement();
- if (parent) {
- // If the element doesn't have an explicit dir attribute with a valid
- // value, the directionality is the same as the parent element (but
- // don't propagate the parent directionality if it isn't set yet).
- Directionality parentDir = parent->GetDirectionality();
+ if (parent && parent->IsElement()) {
+ // If the node doesn't have an explicit dir attribute with a valid value,
+ // the directionality is the same as the parent element (but don't propagate
+ // the parent directionality if it isn't set yet).
+ Directionality parentDir = parent->AsElement()->GetDirectionality();
if (parentDir != eDir_NotSet) {
dir = parentDir;
}
- } else {
- // If there is no parent element and no dir attribute, the directionality
- // is LTR.
- dir = eDir_LTR;
}
-
- aElement->SetDirectionality(dir, aNotify);
}
+
+ aElement->SetDirectionality(dir, aNotify);
return dir;
}
-void
-SetDirectionalityOnDescendants(Element* aElement, Directionality aDir,
- bool aNotify)
+static void
+SetDirectionalityOnDescendantsInternal(nsINode* aNode,
+ Directionality aDir,
+ bool aNotify)
{
- for (nsIContent* child = aElement->GetFirstChild(); child; ) {
+ if (Element* element = Element::FromNode(aNode)) {
+ if (ShadowRoot* shadow = element->GetShadowRoot()) {
+ SetDirectionalityOnDescendantsInternal(shadow, aDir, aNotify);
+ }
+ }
+
+ for (nsIContent* child = aNode->GetFirstChild(); child; ) {
if (!child->IsElement()) {
- child = child->GetNextNode(aElement);
+ child = child->GetNextNode(aNode);
continue;
}
Element* element = child->AsElement();
if (element->HasValidDir() || element->HasDirAuto()) {
- child = child->GetNextNonChildNode(aElement);
+ child = child->GetNextNonChildNode(aNode);
continue;
}
+ if (ShadowRoot* shadow = element->GetShadowRoot()) {
+ SetDirectionalityOnDescendantsInternal(shadow, aDir, aNotify);
+ }
element->SetDirectionality(aDir, aNotify);
- child = child->GetNextNode(aElement);
+ child = child->GetNextNode(aNode);
}
}
+// We want the public version of this only to acc
+void
+SetDirectionalityOnDescendants(Element* aElement, Directionality aDir,
+ bool aNotify)
+{
+ return SetDirectionalityOnDescendantsInternal(aElement, aDir, aNotify);
+}
+
/**
* Walk the parent chain of a text node whose dir attribute has been removed and
* reset the direction of any of its ancestors which have dir=auto and whose
@@ -787,8 +804,9 @@
}
}
-void SetAncestorDirectionIfAuto(nsTextNode* aTextNode, Directionality aDir,
- bool aNotify = true)
+void
+SetAncestorDirectionIfAuto(nsTextNode* aTextNode, Directionality aDir,
+ bool aNotify = true)
{
MOZ_ASSERT(aTextNode->NodeType() == nsINode::TEXT_NODE,
"Must be a text node");
@@ -923,19 +941,14 @@
void
ResetDirectionSetByTextNode(nsTextNode* aTextNode)
{
- // We used to check NodeAffectsDirAutoAncestor() in this function, but
- // stopped doing that since calling IsInAnonymousSubtree()
- // too late (during nsTextNode::UnbindFromTree) is impossible and this
- // function was no-op when there's no directionality map.
- if (!aTextNode->HasTextNodeDirectionalityMap()) {
+ if (!NodeAffectsDirAutoAncestor(aTextNode)) {
+ nsTextNodeDirectionalityMap::EnsureMapIsClearFor(aTextNode);
return;
}
Directionality dir = GetDirectionFromText(aTextNode->GetText());
- if (dir != eDir_NotSet) {
+ if (dir != eDir_NotSet && aTextNode->HasTextNodeDirectionalityMap()) {
nsTextNodeDirectionalityMap::ResetTextNodeDirection(aTextNode, aTextNode);
- } else {
- nsTextNodeDirectionalityMap::EnsureMapIsClearFor(aTextNode);
}
}
@@ -1006,7 +1019,7 @@
}
void
-SetDirOnBind(mozilla::dom::Element* aElement, nsIContent* aParent)
+SetDirOnBind(Element* aElement, nsIContent* aParent)
{
// Set the AncestorHasDirAuto flag, unless this element shouldn't affect
// ancestors that have dir=auto
@@ -1044,7 +1057,8 @@
}
}
-void ResetDir(mozilla::dom::Element* aElement)
+void
+ResetDir(Element* aElement)
{
if (aElement->HasDirAutoSet()) {
nsTextNode* setByNode =
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/DocGroup.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/DocGroup.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/DocGroup.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/DocGroup.cpp 2018-06-20 17:29:02.000000000 +0000
@@ -5,9 +5,9 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/DocGroup.h"
-#include "mozilla/dom/DOMPrefs.h"
#include "mozilla/dom/DOMTypes.h"
#include "mozilla/dom/TabGroup.h"
+#include "mozilla/StaticPrefs.h"
#include "mozilla/Telemetry.h"
#include "nsIDocShell.h"
#include "nsDOMMutationObserver.h"
@@ -52,8 +52,8 @@
: mKey(aKey), mTabGroup(aTabGroup)
{
// This method does not add itself to mTabGroup->mDocGroups as the caller does it for us.
- if (mozilla::dom::DOMPrefs::SchedulerLoggingEnabled()) {
- mPerformanceCounter = new mozilla::PerformanceCounter(aKey);
+ if (mozilla::StaticPrefs::dom_performance_enable_scheduler_timing()) {
+ mPerformanceCounter = new mozilla::PerformanceCounter(NS_LITERAL_CSTRING("DocGroup:") + aKey);
}
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/DOMPrefsInternal.h firefox-trunk-62.0~a1~hg20180620r423058/dom/base/DOMPrefsInternal.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/DOMPrefsInternal.h 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/DOMPrefsInternal.h 2018-06-20 17:29:03.000000000 +0000
@@ -23,7 +23,6 @@
DOM_PREF(DOMCachesEnabled, "dom.caches.enabled")
DOM_PREF(DOMCachesTestingEnabled, "dom.caches.testing.enabled")
DOM_PREF(PerformanceLoggingEnabled, "dom.performance.enable_user_timing_logging")
-DOM_PREF(SchedulerLoggingEnabled, "dom.performance.enable_scheduler_timing")
DOM_PREF(NotificationEnabled, "dom.webnotifications.enabled")
DOM_PREF(NotificationEnabledInServiceWorkers, "dom.webnotifications.serviceworker.enabled")
DOM_PREF(NotificationRIEnabled, "dom.webnotifications.requireinteraction.enabled")
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/Element.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/Element.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/Element.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/Element.cpp 2018-06-20 17:29:02.000000000 +0000
@@ -1994,16 +1994,12 @@
}
if (aDeep) {
- // Do the kids. Don't call GetChildCount() here since that'll force
- // XUL to generate template children, which there is no need for since
- // all we're going to do is unbind them anyway.
- uint32_t i, n = mAttrsAndChildren.ChildCount();
-
- for (i = 0; i < n; ++i) {
+ for (nsIContent* child = GetFirstChild(); child;
+ child = child->GetNextSibling()) {
// Note that we pass false for aNullParent here, since we don't want
// the kids to forget us. We _do_ want them to forget their binding
// parent, though, since this only walks non-anonymous kids.
- mAttrsAndChildren.ChildAt(i)->UnbindFromTree(true, false);
+ child->UnbindFromTree(true, false);
}
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/FragmentOrElement.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/FragmentOrElement.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/FragmentOrElement.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/FragmentOrElement.cpp 2018-06-20 17:29:03.000000000 +0000
@@ -1225,27 +1225,6 @@
return doInsertChildAt(aKid, index, aNotify, mAttrsAndChildren);
}
-nsresult
-FragmentOrElement::InsertChildAt_Deprecated(nsIContent* aKid,
- uint32_t aIndex,
- bool aNotify)
-{
- MOZ_ASSERT(aKid, "null ptr");
-
- return doInsertChildAt(aKid, aIndex, aNotify, mAttrsAndChildren);
-}
-
-void
-FragmentOrElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
-{
- nsCOMPtr oldKid = mAttrsAndChildren.GetSafeChildAt(aIndex);
- NS_ASSERTION(oldKid == GetChildAt_Deprecated(aIndex), "Unexpected child in RemoveChildAt_Deprecated");
-
- if (oldKid) {
- doRemoveChildAt(aIndex, aNotify, oldKid, mAttrsAndChildren);
- }
-}
-
void
FragmentOrElement::RemoveChildNode(nsIContent* aKid, bool aNotify)
{
@@ -1274,8 +1253,6 @@
void
FragmentOrElement::DestroyContent()
{
- nsIDocument* document = OwnerDoc();
-
// Drop any servo data. We do this before the RemovedFromDocument call below
// so that it doesn't need to try to keep the style state sane when shuffling
// around the flattened tree.
@@ -1286,17 +1263,28 @@
AsElement()->ClearServoData();
}
+ nsIDocument* document = OwnerDoc();
+
document->BindingManager()->RemovedFromDocument(this, document,
nsBindingManager::eRunDtor);
document->ClearBoxObjectFor(this);
- uint32_t i, count = mAttrsAndChildren.ChildCount();
- for (i = 0; i < count; ++i) {
- // The child can remove itself from the parent in BindToTree.
- mAttrsAndChildren.ChildAt(i)->DestroyContent();
+#ifdef DEBUG
+ uint32_t oldChildCount = GetChildCount();
+#endif
+
+ for (nsIContent* child = GetFirstChild();
+ child;
+ child = child->GetNextSibling()) {
+ child->DestroyContent();
+ MOZ_ASSERT(child->GetParent() == this,
+ "Mutating the tree during XBL destructors is evil");
}
- ShadowRoot* shadowRoot = GetShadowRoot();
- if (shadowRoot) {
+
+ MOZ_ASSERT(oldChildCount == GetChildCount(),
+ "Mutating the tree during XBL destructors is evil");
+
+ if (ShadowRoot* shadowRoot = GetShadowRoot()) {
shadowRoot->DestroyContent();
}
}
@@ -1304,10 +1292,14 @@
void
FragmentOrElement::SaveSubtreeState()
{
- uint32_t i, count = mAttrsAndChildren.ChildCount();
- for (i = 0; i < count; ++i) {
- mAttrsAndChildren.ChildAt(i)->SaveSubtreeState();
+ for (nsIContent* child = GetFirstChild();
+ child;
+ child = child->GetNextSibling()) {
+ child->SaveSubtreeState();
}
+
+ // FIXME(bug 1469277): Pretty sure this wants to dig into shadow trees as
+ // well.
}
//----------------------------------------------------------------------
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/FragmentOrElement.h firefox-trunk-62.0~a1~hg20180620r423058/dom/base/FragmentOrElement.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/FragmentOrElement.h 2018-06-11 13:02:08.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/FragmentOrElement.h 2018-06-20 17:29:03.000000000 +0000
@@ -98,9 +98,6 @@
virtual int32_t ComputeIndexOf(const nsINode* aPossibleChild) const override;
virtual nsresult InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
bool aNotify) override;
- virtual nsresult InsertChildAt_Deprecated(nsIContent* aKid, uint32_t aIndex,
- bool aNotify) override;
- virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
virtual void GetTextContentInternal(nsAString& aTextContent,
mozilla::OOMReporter& aError) override;
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsContentIterator.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsContentIterator.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsContentIterator.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsContentIterator.cpp 2018-06-20 17:29:03.000000000 +0000
@@ -893,9 +893,7 @@
RefPtr mRange;
- // these arrays all typically are used and have elements
AutoTArray mEndNodes;
- AutoTArray mEndOffsets;
};
NS_IMPL_ADDREF_INHERITED(nsContentSubtreeIterator, nsContentIterator)
@@ -1015,8 +1013,13 @@
}
// cache ancestors
- nsContentUtils::GetAncestorsAndOffsets(endContainer, endOffset,
- &mEndNodes, &mEndOffsets);
+ mEndNodes.Clear();
+ nsIContent* endNode =
+ endContainer->IsContent() ? endContainer->AsContent() : nullptr;
+ while (endNode) {
+ mEndNodes.AppendElement(endNode);
+ endNode = endNode->GetParent();
+ }
nsIContent* firstCandidate = nullptr;
nsIContent* lastCandidate = nullptr;
@@ -1029,7 +1032,8 @@
// no children, start at the node itself
node = startContainer;
} else {
- nsIContent* child = startContainer->GetChildAt_Deprecated(offset);
+ nsIContent* child = mRange->GetChildAtStartOffset();
+ MOZ_ASSERT(child == startContainer->GetChildAt_Deprecated(offset));
if (!child) {
// offset after last child
node = startContainer;
@@ -1078,7 +1082,8 @@
if (!offset || !numChildren) {
node = endContainer;
} else {
- lastCandidate = endContainer->GetChildAt_Deprecated(--offset);
+ lastCandidate = mRange->EndRef().Ref();
+ MOZ_ASSERT(lastCandidate == endContainer->GetChildAt_Deprecated(--offset));
NS_ASSERTION(lastCandidate,
"tree traversal trouble in nsContentSubtreeIterator::Init");
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsContentUtils.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsContentUtils.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsContentUtils.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsContentUtils.cpp 2018-06-20 17:29:03.000000000 +0000
@@ -9884,11 +9884,11 @@
}
}
- RefPtr tagAtom = nodeInfo->NameAtom();
- RefPtr typeAtom;
+ nsAtom* tagAtom = nodeInfo->NameAtom();
+ nsAtom* typeAtom = nullptr;
bool isCustomElement = isCustomElementName || aIsAtom;
if (isCustomElement) {
- typeAtom = isCustomElementName ? tagAtom.get() : aIsAtom;
+ typeAtom = isCustomElementName ? tagAtom : aIsAtom;
}
MOZ_ASSERT_IF(aDefinition, isCustomElement);
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsDocument.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsDocument.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsDocument.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsDocument.cpp 2018-06-20 17:29:03.000000000 +0000
@@ -248,6 +248,7 @@
#include "mozilla/ServoStyleSet.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
+#include "mozilla/dom/SVGDocument.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "mozilla/dom/DocGroup.h"
#include "mozilla/dom/TabGroup.h"
@@ -2603,13 +2604,8 @@
bool
nsIDocument::IsSynthesized() {
- nsCOMPtr internalChan = do_QueryInterface(mChannel);
- bool synthesized = false;
- if (internalChan) {
- DebugOnly rv = internalChan->GetResponseSynthesized(&synthesized);
- MOZ_ASSERT(NS_SUCCEEDED(rv), "GetResponseSynthesized shouldn't fail.");
- }
- return synthesized;
+ nsCOMPtr loadInfo = mChannel ? mChannel->GetLoadInfo() : nullptr;
+ return loadInfo && loadInfo->GetServiceWorkerTaintingSynthesized();
}
bool
@@ -4085,9 +4081,9 @@
// Loop backwards because any non-elements, such as doctypes and PIs
// are likely to appear before the root element.
- uint32_t i;
- for (i = mChildren.ChildCount(); i > 0; --i) {
- if (Element* element = Element::FromNode(mChildren.ChildAt(i - 1))) {
+ for (nsIContent* child = GetLastChild(); child;
+ child = child->GetPreviousSibling()) {
+ if (Element* element = Element::FromNode(child)) {
const_cast(this)->mCachedRootElement = element;
return element;
}
@@ -4113,46 +4109,6 @@
return doInsertChildAt(aKid, index, aNotify, mChildren);
}
-nsresult
-nsIDocument::InsertChildAt_Deprecated(nsIContent* aKid,
- uint32_t aIndex,
- bool aNotify)
-{
- if (aKid->IsElement() && GetRootElement()) {
- NS_WARNING("Inserting root element when we already have one");
- return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
- }
-
- return doInsertChildAt(aKid, aIndex, aNotify, mChildren);
-}
-
-void
-nsIDocument::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
-{
- nsCOMPtr oldKid = GetChildAt_Deprecated(aIndex);
- if (!oldKid) {
- return;
- }
-
- if (oldKid->IsElement()) {
- // Destroy the link map up front before we mess with the child list.
- DestroyElementMaps();
- }
-
- // Preemptively clear mCachedRootElement, since we may be about to remove it
- // from our child list, and we don't want to return this maybe-obsolete value
- // from any GetRootElement() calls that happen inside of doRemoveChildAt().
- // (NOTE: for this to be useful, doRemoveChildAt() must NOT trigger any
- // GetRootElement() calls until after it's removed the child from mChildren.
- // Any call before that point would restore this soon-to-be-obsolete cached
- // answer, and our clearing here would be fruitless.)
- mCachedRootElement = nullptr;
- doRemoveChildAt(aIndex, aNotify, oldKid, mChildren);
- MOZ_ASSERT(mCachedRootElement != oldKid,
- "Stale pointer in mCachedRootElement, after we tried to clear it "
- "(maybe somebody called GetRootElement() too early?)");
-}
-
void
nsIDocument::RemoveChildNode(nsIContent* aKid, bool aNotify)
{
@@ -4197,9 +4153,13 @@
// This is like |AddStyleSheetToStyleSets|, but for an agent sheet.
if (nsIPresShell* shell = GetShell()) {
// Note that prepending here is necessary to make sure that html.css etc.
- // do not override Firefox OS/Mobile's content.css sheet. Maybe we should
- // have an insertion point to match the order of
+ // does not override Firefox OS/Mobile's content.css sheet.
+ //
+ // Maybe we should have an insertion point to match the order of
// nsDocumentViewer::CreateStyleSet though?
+ //
+ // FIXME(emilio): We probably should, randomly prepending stuff here is
+ // very prone to subtle bugs, behavior differences...
shell->StyleSet()->PrependStyleSheet(SheetType::Agent, aSheet);
shell->ApplicableStylesChanged();
}
@@ -5398,6 +5358,12 @@
return nullptr;
}
+ // We're about to insert random content here that will be rendered. We're
+ // going to need more than svg.css here...
+ if (IsSVGDocument()) {
+ AsSVGDocument()->EnsureNonSVGUserAgentStyleSheetsLoaded();
+ }
+
nsAutoScriptBlocker scriptBlocker;
nsCOMPtr container = shell->GetCanvasFrame()
->GetCustomContentContainer();
@@ -8125,10 +8091,18 @@
bool oldVal = mInUnlinkOrDeletion;
mInUnlinkOrDeletion = true;
- uint32_t i, count = mChildren.ChildCount();
- for (i = 0; i < count; ++i) {
- mChildren.ChildAt(i)->DestroyContent();
+
+#ifdef DEBUG
+ uint32_t oldChildCount = GetChildCount();
+#endif
+
+ for (nsIContent* child = GetFirstChild(); child;
+ child = child->GetNextSibling()) {
+ child->DestroyContent();
+ MOZ_ASSERT(child->GetParentNode() == this);
}
+ MOZ_ASSERT(oldChildCount == GetChildCount());
+
mInUnlinkOrDeletion = oldVal;
mLayoutHistoryState = nullptr;
@@ -8148,9 +8122,9 @@
mRemovedFromDocShell = true;
EnumerateActivityObservers(NotifyActivityChanged, nullptr);
- uint32_t i, count = mChildren.ChildCount();
- for (i = 0; i < count; ++i) {
- mChildren.ChildAt(i)->SaveSubtreeState();
+ for (nsIContent* child = GetFirstChild(); child;
+ child = child->GetNextSibling()) {
+ child->SaveSubtreeState();
}
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsFocusManager.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsFocusManager.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsFocusManager.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsFocusManager.cpp 2018-06-20 17:29:03.000000000 +0000
@@ -3486,10 +3486,11 @@
}
}
- // If aStartContent is not in scope owned by aRootContent
- // (e.g., aStartContent is already in shadow DOM),
+ // If aStartContent is not in a scope owned by the root element
+ // (i.e. aStartContent is already in shadow DOM),
// search from scope including aStartContent
- if (aRootContent != FindOwner(aStartContent)) {
+ nsIContent* rootElement = aRootContent->OwnerDoc()->GetRootElement();
+ if (rootElement != FindOwner(aStartContent)) {
nsIContent* contentToFocus =
GetNextTabbableContentInAncestorScopes(&aStartContent,
aOriginalStartContent,
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsGlobalWindowOuter.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsGlobalWindowOuter.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsGlobalWindowOuter.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsGlobalWindowOuter.cpp 2018-06-20 17:29:03.000000000 +0000
@@ -6691,35 +6691,12 @@
const nsAString& aPseudoElt,
bool aDefaultStylesOnly)
{
- if (!mDocShell) {
+ if (!mDoc) {
return nullptr;
}
- nsCOMPtr presShell = mDocShell->GetPresShell();
-
- if (!presShell) {
- // Try flushing frames on our parent in case there's a pending
- // style change that will create the presshell.
- auto* parent = nsGlobalWindowOuter::Cast(GetPrivateParent());
- if (!parent) {
- return nullptr;
- }
-
- parent->FlushPendingNotifications(FlushType::Frames);
-
- // Might have killed mDocShell
- if (!mDocShell) {
- return nullptr;
- }
-
- presShell = mDocShell->GetPresShell();
- if (!presShell) {
- return nullptr;
- }
- }
-
RefPtr compStyle =
- NS_NewComputedDOMStyle(&aElt, aPseudoElt, presShell,
+ NS_NewComputedDOMStyle(&aElt, aPseudoElt, mDoc,
aDefaultStylesOnly ? nsComputedDOMStyle::eDefaultOnly :
nsComputedDOMStyle::eAll);
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsIDocument.h firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsIDocument.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsIDocument.h 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsIDocument.h 2018-06-20 17:29:03.000000000 +0000
@@ -548,9 +548,6 @@
nsresult InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
bool aNotify) override;
- nsresult InsertChildAt_Deprecated(nsIContent* aKid, uint32_t aIndex,
- bool aNotify) override;
- void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) final;
void RemoveChildNode(nsIContent* aKid, bool aNotify) final;
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo,
nsINode **aResult,
@@ -4594,13 +4591,29 @@
return OwnerDoc();
}
+// ShouldUseXBLScope is defined here as a template so that we can get the faster
+// version of IsInAnonymousSubtree if we're statically known to be an
+// nsIContent. we could try defining ShouldUseXBLScope separately on nsINode
+// and nsIContent, but then we couldn't put its nsINode implementation here
+// (because this header does not include nsIContent) and we can't put it in
+// nsIContent.h, because the definition of nsIContent::IsInAnonymousSubtree is
+// in nsIContentInlines.h. And then we get include hell from people trying to
+// call nsINode::GetParentObject but not including nsIContentInlines.h and with
+// no really good way to include it.
+template
+inline bool ShouldUseXBLScope(const T* aNode)
+{
+ return aNode->IsInAnonymousSubtree() &&
+ !aNode->IsAnonymousContentInSVGUseSubtree();
+}
+
inline mozilla::dom::ParentObject
nsINode::GetParentObject() const
{
mozilla::dom::ParentObject p(OwnerDoc());
// Note that mUseXBLScope is a no-op for chrome, and other places where we
// don't use XBL scopes.
- p.mUseXBLScope = IsInAnonymousSubtree() && !IsAnonymousContentInSVGUseSubtree();
+ p.mUseXBLScope = ShouldUseXBLScope(this);
return p;
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsINode.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsINode.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsINode.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsINode.cpp 2018-06-20 17:29:03.000000000 +0000
@@ -33,6 +33,7 @@
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/PromiseNativeHandler.h"
#include "mozilla/dom/ShadowRoot.h"
+#include "mozilla/dom/ScriptSettings.h"
#include "nsAttrValueOrString.h"
#include "nsBindingManager.h"
#include "nsCCUncollectableMarker.h"
@@ -532,7 +533,7 @@
nsINode*
nsINode::RemoveChild(nsINode& aOldChild, ErrorResult& aError)
{
- if (IsCharacterData()) {
+ if (!aOldChild.IsContent()) {
// aOldChild can't be one of our children.
aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
return nullptr;
@@ -542,14 +543,16 @@
nsContentUtils::MaybeFireNodeRemoved(&aOldChild, this);
}
- int32_t index = ComputeIndexOf(&aOldChild);
- if (index == -1) {
+ // Check again, we may not be the child's parent anymore.
+ // Can be triggered by dom/base/crashtests/293388-1.html
+ if (aOldChild.AsContent()->IsRootOfAnonymousSubtree() ||
+ aOldChild.GetParentNode() != this) {
// aOldChild isn't one of our children.
aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
return nullptr;
}
- RemoveChildAt_Deprecated(index, true);
+ RemoveChildNode(aOldChild.AsContent(), true);
return &aOldChild;
}
@@ -639,7 +642,7 @@
"Should always have a parent unless "
"mutation events messed us up");
if (parent) {
- parent->RemoveChildAt_Deprecated(parent->ComputeIndexOf(node), true);
+ parent->RemoveChildNode(node, true);
}
}
}
@@ -1299,6 +1302,49 @@
}
}
+static nsresult
+ReparentWrappersInSubtree(nsIContent* aRoot)
+{
+ MOZ_ASSERT(ShouldUseXBLScope(aRoot));
+ // Start off with no global so we don't fire any error events on failure.
+ AutoJSAPI jsapi;
+ jsapi.Init();
+
+ JSContext* cx = jsapi.cx();
+
+ nsIGlobalObject* docGlobal = aRoot->OwnerDoc()->GetScopeObject();
+ if (NS_WARN_IF(!docGlobal)) {
+ return NS_ERROR_UNEXPECTED;
+ }
+
+ JS::Rooted rootedGlobal(cx, docGlobal->GetGlobalJSObject());
+ if (NS_WARN_IF(!rootedGlobal)) {
+ return NS_ERROR_UNEXPECTED;
+ }
+
+ rootedGlobal = xpc::GetXBLScope(cx, rootedGlobal);
+
+ ErrorResult rv;
+ JS::Rooted reflector(cx);
+ for (nsIContent* cur = aRoot; cur; cur = cur->GetNextNode(aRoot)) {
+ if ((reflector = cur->GetWrapper())) {
+ JSAutoRealm ar(cx, reflector);
+ ReparentWrapper(cx, reflector, rv);
+ rv.WouldReportJSException();
+ if (rv.Failed()) {
+ // We _could_ consider BlastSubtreeToPieces here, but it's not really
+ // needed. Having some nodes in here accessible to content while others
+ // are not is probably OK. We just need to fail out of the actual
+ // insertion, so they're not in the DOM. Returning a failure here will
+ // do that.
+ return rv.StealNSResult();
+ }
+ }
+ }
+
+ return NS_OK;
+}
+
nsresult
nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex,
bool aNotify, nsAttrAndChildArray& aChildArray)
@@ -1350,9 +1396,15 @@
nsIContent* parent = IsContent() ? AsContent() : nullptr;
+ bool wasInXBLScope = ShouldUseXBLScope(aKid);
rv = aKid->BindToTree(doc, parent,
parent ? parent->GetBindingParent() : nullptr,
true);
+ if (NS_SUCCEEDED(rv) && !wasInXBLScope && ShouldUseXBLScope(aKid)) {
+ MOZ_ASSERT(ShouldUseXBLScope(this),
+ "Why does the kid need to use an XBL scope?");
+ rv = ReparentWrappersInSubtree(aKid);
+ }
if (NS_FAILED(rv)) {
if (GetFirstChild() == aKid) {
mFirstChild = aKid->GetNextSibling();
@@ -1947,11 +1999,12 @@
}
// Record the node to insert before, if any
- nsINode* nodeToInsertBefore;
+ nsIContent* nodeToInsertBefore;
if (aReplace) {
nodeToInsertBefore = aRefChild->GetNextSibling();
} else {
- nodeToInsertBefore = aRefChild;
+ // Since aRefChild is our child, it must be an nsIContent object.
+ nodeToInsertBefore = aRefChild ? aRefChild->AsContent() : nullptr;
}
if (nodeToInsertBefore == aNewChild) {
// We're going to remove aNewChild from its parent, so use its next sibling
@@ -1965,14 +2018,6 @@
nsIContent* newContent = aNewChild->AsContent();
nsCOMPtr oldParent = newContent->GetParentNode();
if (oldParent) {
- int32_t removeIndex = oldParent->ComputeIndexOf(newContent);
- if (removeIndex < 0) {
- // newContent is anonymous. We can't deal with this, so just bail
- NS_ERROR("How come our flags didn't catch this?");
- aError.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
- return nullptr;
- }
-
// Hold a strong ref to nodeToInsertBefore across the removal of newContent
nsCOMPtr kungFuDeathGrip = nodeToInsertBefore;
@@ -1984,11 +2029,14 @@
{
mozAutoDocUpdate batch(newContent->GetComposedDoc(), true);
nsAutoMutationBatch mb(oldParent, true, true);
- oldParent->RemoveChildAt_Deprecated(removeIndex, true);
+ // ScriptBlocker ensures previous and next stay alive.
+ nsIContent* previous = aNewChild->GetPreviousSibling();
+ nsIContent* next = aNewChild->GetNextSibling();
+ oldParent->RemoveChildNode(aNewChild->AsContent(), true);
if (nsAutoMutationBatch::GetCurrentBatch() == &mb) {
mb.RemovalDone();
- mb.SetPrevSibling(oldParent->GetChildAt_Deprecated(removeIndex - 1));
- mb.SetNextSibling(oldParent->GetChildAt_Deprecated(removeIndex));
+ mb.SetPrevSibling(previous);
+ mb.SetNextSibling(next);
}
}
@@ -2027,7 +2075,7 @@
if (aReplace) {
nodeToInsertBefore = aRefChild->GetNextSibling();
} else {
- nodeToInsertBefore = aRefChild;
+ nodeToInsertBefore = aRefChild ? aRefChild->AsContent() : nullptr;
}
}
}
@@ -2062,8 +2110,8 @@
mozAutoDocUpdate batch(newContent->GetComposedDoc(), true);
nsAutoMutationBatch mb(newContent, false, true);
- for (uint32_t i = count; i > 0;) {
- newContent->RemoveChildAt_Deprecated(--i, true);
+ while (newContent->HasChildren()) {
+ newContent->RemoveChildNode(newContent->GetLastChild(), true);
}
}
@@ -2101,7 +2149,8 @@
if (aReplace) {
nodeToInsertBefore = aRefChild->GetNextSibling();
} else {
- nodeToInsertBefore = aRefChild;
+ // If aRefChild has 'this' as a parent, it must be an nsIContent.
+ nodeToInsertBefore = aRefChild ? aRefChild->AsContent() : nullptr;
}
// And verify that newContent is still allowed as our child. Sadly, we
@@ -2132,23 +2181,6 @@
mozAutoDocUpdate batch(GetComposedDoc(), true);
nsAutoMutationBatch mb;
- // Figure out which index we want to insert at. Note that we use
- // nodeToInsertBefore to determine this, because it's possible that
- // aRefChild == aNewChild, in which case we just removed it from the
- // parent list.
- int32_t insPos;
- if (nodeToInsertBefore) {
- insPos = ComputeIndexOf(nodeToInsertBefore);
- if (insPos < 0) {
- // XXXbz How the heck would _that_ happen, exactly?
- aError.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
- return nullptr;
- }
- }
- else {
- insPos = GetChildCount();
- }
-
// If we're replacing and we haven't removed aRefChild yet, do so now
if (aReplace && aRefChild != aNewChild) {
mb.Init(this, true, true);
@@ -2158,11 +2190,11 @@
NS_ASSERTION(aRefChild->GetNextSibling() == nodeToInsertBefore,
"Unexpected nodeToInsertBefore");
- // An since nodeToInsertBefore is at index insPos, we want to remove
- // at the previous index.
- NS_ASSERTION(insPos >= 1, "insPos too small");
- RemoveChildAt_Deprecated(insPos-1, true);
- --insPos;
+ nsIContent* toBeRemoved = nodeToInsertBefore ?
+ nodeToInsertBefore->GetPreviousSibling() : GetLastChild();
+ MOZ_ASSERT(toBeRemoved);
+
+ RemoveChildNode(toBeRemoved, true);
}
// Move new child over to our document if needed. Do this after removing
@@ -2196,8 +2228,9 @@
nsAutoMutationBatch* mutationBatch = nsAutoMutationBatch::GetCurrentBatch();
if (mutationBatch) {
mutationBatch->RemovalDone();
- mutationBatch->SetPrevSibling(GetChildAt_Deprecated(insPos - 1));
- mutationBatch->SetNextSibling(GetChildAt_Deprecated(insPos));
+ mutationBatch->SetPrevSibling(nodeToInsertBefore ?
+ nodeToInsertBefore->GetPreviousSibling() : GetLastChild());
+ mutationBatch->SetNextSibling(nodeToInsertBefore);
}
uint32_t count = fragChildren->Length();
@@ -2205,16 +2238,16 @@
return result;
}
- bool appending = !IsDocument() && uint32_t(insPos) == GetChildCount();
+ bool appending = !IsDocument() && !nodeToInsertBefore;
nsIContent* firstInsertedContent = fragChildren->ElementAt(0);
// Iterate through the fragment's children, and insert them in the new
// parent
- for (uint32_t i = 0; i < count; ++i, ++insPos) {
+ for (uint32_t i = 0; i < count; ++i) {
// XXXbz how come no reparenting here? That seems odd...
// Insert the child.
- aError = InsertChildAt_Deprecated(fragChildren->ElementAt(i), insPos,
- !appending);
+ aError = InsertChildBefore(fragChildren->ElementAt(i), nodeToInsertBefore,
+ !appending);
if (aError.Failed()) {
// Make sure to notify on any children that we did succeed to insert
if (appending && i != 0) {
@@ -2250,13 +2283,13 @@
// We need to reparent here for nodes for which the parent of their
// wrapper is not the wrapper for their ownerDocument (XUL elements,
// form controls, ...). Also applies in the fragment code above.
-
if (nsAutoMutationBatch::GetCurrentBatch() == &mb) {
mb.RemovalDone();
- mb.SetPrevSibling(GetChildAt_Deprecated(insPos - 1));
- mb.SetNextSibling(GetChildAt_Deprecated(insPos));
+ mb.SetPrevSibling(nodeToInsertBefore ?
+ nodeToInsertBefore->GetPreviousSibling() : GetLastChild());
+ mb.SetNextSibling(nodeToInsertBefore);
}
- aError = InsertChildAt_Deprecated(newContent, insPos, true);
+ aError = InsertChildBefore(newContent, nodeToInsertBefore, true);
if (aError.Failed()) {
return nullptr;
}
@@ -2490,6 +2523,9 @@
Element*
nsINode::QuerySelector(const nsAString& aSelector, ErrorResult& aResult)
{
+ AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
+ "nsINode::QuerySelector", DOM, aSelector);
+
const RawServoSelectorList* list = ParseSelectorList(aSelector, aResult);
if (!list) {
return nullptr;
@@ -2502,6 +2538,9 @@
already_AddRefed
nsINode::QuerySelectorAll(const nsAString& aSelector, ErrorResult& aResult)
{
+ AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
+ "nsINode::QuerySelectorAll", DOM, aSelector);
+
RefPtr contentList = new nsSimpleContentList(this);
const RawServoSelectorList* list = ParseSelectorList(aSelector, aResult);
if (!list) {
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsINode.h firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsINode.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsINode.h 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsINode.h 2018-06-20 17:29:03.000000000 +0000
@@ -822,29 +822,6 @@
bool aNotify) = 0;
/**
- * Insert a content node at a particular index. This method handles calling
- * BindToTree on the child appropriately.
- *
- * @param aKid the content to insert
- * @param aIndex the index it is being inserted at (the index it will have
- * after it is inserted)
- * @param aNotify whether to notify the document (current document for
- * nsIContent, and |this| for nsIDocument) that the insert has
- * occurred
- *
- * @throws NS_ERROR_DOM_HIERARCHY_REQUEST_ERR if one attempts to have more
- * than one element node as a child of a document. Doing this will also
- * assert -- you shouldn't be doing it! Check with
- * nsIDocument::GetRootElement() first if you're not sure. Apart from this
- * one constraint, this doesn't do any checking on whether aKid is a valid
- * child of |this|.
- *
- * @throws NS_ERROR_OUT_OF_MEMORY in some cases (from BindToTree).
- */
- virtual nsresult InsertChildAt_Deprecated(nsIContent* aKid, uint32_t aIndex,
- bool aNotify) = 0;
-
- /**
* Append a content node to the end of the child list. This method handles
* calling BindToTree on the child appropriately.
*
@@ -864,26 +841,10 @@
*/
nsresult AppendChildTo(nsIContent* aKid, bool aNotify)
{
- return InsertChildAt_Deprecated(aKid, GetChildCount(), aNotify);
+ return InsertChildBefore(aKid, nullptr, aNotify);
}
/**
- * NOTE: this function is going to be removed soon (hopefully!) Don't use it
- * in new code.
- *
- * Remove a child from this node. This method handles calling UnbindFromTree
- * on the child appropriately.
- *
- * @param aIndex the index of the child to remove
- * @param aNotify whether to notify the document (current document for
- * nsIContent, and |this| for nsIDocument) that the remove has
- * occurred
- *
- * Note: If there is no child at aIndex, this method will simply do nothing.
- */
- virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) = 0;
-
- /**
* Remove a child from this node. This method handles calling UnbindFromTree
* on the child appropriately.
*
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsJSEnvironment.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsJSEnvironment.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/nsJSEnvironment.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/nsJSEnvironment.cpp 2018-06-20 17:29:02.000000000 +0000
@@ -1281,7 +1281,9 @@
if (!aDeadline.IsNull()) {
if (aDeadline < now) {
// This slice overflowed the idle period.
- idleDuration = aDeadline - startTimeStamp;
+ if (aDeadline > startTimeStamp) {
+ idleDuration = aDeadline - startTimeStamp;
+ }
} else {
idleDuration = duration;
}
@@ -2261,9 +2263,9 @@
nsString mMessage;
public:
- explicit NotifyGCEndRunnable(const nsString& aMessage)
+ explicit NotifyGCEndRunnable(nsString&& aMessage)
: mozilla::Runnable("NotifyGCEndRunnable")
- , mMessage(aMessage)
+ , mMessage(std::move(aMessage))
{
}
@@ -2321,7 +2323,7 @@
Telemetry::CanRecordExtended()) {
nsString json;
json.Adopt(aDesc.formatJSON(aCx, PR_Now()));
- RefPtr notify = new NotifyGCEndRunnable(json);
+ RefPtr notify = new NotifyGCEndRunnable(std::move(json));
SystemGroup::Dispatch(TaskCategory::GarbageCollection, notify.forget());
}
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/TabGroup.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/base/TabGroup.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/TabGroup.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/TabGroup.cpp 2018-06-20 17:29:03.000000000 +0000
@@ -9,6 +9,7 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/DocGroup.h"
+#include "mozilla/dom/TimeoutManager.h"
#include "mozilla/AbstractThread.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/StaticPtr.h"
@@ -23,6 +24,8 @@
static StaticRefPtr sChromeTabGroup;
+LinkedList* TabGroup::sTabGroups = nullptr;
+
TabGroup::TabGroup(bool aIsChrome)
: mLastWindowLeft(false)
, mThrottledQueuesInitialized(false)
@@ -31,6 +34,11 @@
, mIsChrome(aIsChrome)
, mForegroundCount(0)
{
+ if (!sTabGroups) {
+ sTabGroups = new LinkedList();
+ }
+ sTabGroups->insertBack(this);
+
CreateEventTargets(/* aNeedValidation = */ !aIsChrome);
// Do not throttle runnables from chrome windows. In theory we should
@@ -54,6 +62,15 @@
MOZ_ASSERT(mDocGroups.IsEmpty());
MOZ_ASSERT(mWindows.IsEmpty());
MOZ_RELEASE_ASSERT(mLastWindowLeft || mIsChrome);
+
+ LinkedListElement* listElement =
+ static_cast*>(this);
+ listElement->remove();
+
+ if (sTabGroups->isEmpty()) {
+ delete sTabGroups;
+ sTabGroups = nullptr;
+ }
}
void
@@ -323,5 +340,37 @@
return count;
}
+/*static*/ bool
+TabGroup::HasOnlyThrottableTabs()
+{
+ if (!sTabGroups) {
+ return false;
+ }
+
+ for (TabGroup* tabGroup = sTabGroups->getFirst(); tabGroup;
+ tabGroup =
+ static_cast*>(tabGroup)->getNext()) {
+ for (auto iter = tabGroup->Iter(); !iter.Done(); iter.Next()) {
+ DocGroup* docGroup = iter.Get()->mDocGroup;
+ for (auto* documentInDocGroup : *docGroup) {
+ if (documentInDocGroup->IsCurrentActiveDocument()) {
+ nsPIDOMWindowInner* win =
+ documentInDocGroup->GetInnerWindow();
+ if (win && win->IsCurrentInnerWindow()) {
+ nsPIDOMWindowOuter* outer = win->GetOuterWindow();
+ if (outer) {
+ TimeoutManager& tm = win->TimeoutManager();
+ if (!tm.BudgetThrottlingEnabled(outer->IsBackground())) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return true;
+}
+
} // namespace dom
} // namespace mozilla
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/TabGroup.h firefox-trunk-62.0~a1~hg20180620r423058/dom/base/TabGroup.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/TabGroup.h 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/TabGroup.h 2018-06-20 17:29:03.000000000 +0000
@@ -46,7 +46,8 @@
class DocGroup;
class TabChild;
-class TabGroup final : public SchedulerGroup
+class TabGroup final : public SchedulerGroup,
+ public LinkedListElement
{
private:
class HashEntry : public nsCStringHashKey
@@ -146,6 +147,16 @@
return mNumOfIndexedDBDatabases;
}
+ static LinkedList* GetTabGroupList()
+ {
+ return sTabGroups;
+ }
+
+ // This returns true if all the window objects in all the TabGroups are
+ // either inactive (for example in bfcache) or are in background tabs which
+ // can be throttled.
+ static bool HasOnlyThrottableTabs();
+
private:
virtual AbstractThread*
AbstractMainThreadForImpl(TaskCategory aCategory) override;
@@ -167,6 +178,8 @@
DocGroupMap mDocGroups;
nsTArray mWindows;
uint32_t mForegroundCount;
+
+ static LinkedList* sTabGroups;
};
} // namespace dom
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/test/chrome.ini firefox-trunk-62.0~a1~hg20180620r423058/dom/base/test/chrome.ini
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/test/chrome.ini 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/test/chrome.ini 2018-06-20 17:29:03.000000000 +0000
@@ -28,7 +28,6 @@
[test_fragment_sanitization.xul]
[test_messagemanager_principal.html]
[test_messagemanager_send_principal.html]
-skip-if = buildapp == 'mulet'
[test_mozbrowser_apis_allowed.html]
[test_navigator_resolve_identity_xrays.xul]
support-files = file_navigator_resolve_identity_xrays.xul
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/test/test_intersectionobservers.html firefox-trunk-62.0~a1~hg20180620r423058/dom/base/test/test_intersectionobservers.html
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/test/test_intersectionobservers.html 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/test/test_intersectionobservers.html 2018-06-20 17:29:02.000000000 +0000
@@ -56,21 +56,16 @@
}
var callbacks = [];
- function callDelayed(fn, delay) {
- callbacks.push({
- fn: fn,
- time: +new Date() + delay
- });
+ function callDelayed(fn) {
+ callbacks.push(fn);
}
requestAnimationFrame(function tick() {
var i = callbacks.length;
while (i--) {
var cb = callbacks[i];
- if (+new Date() >= cb.time) {
- SimpleTest.executeSoon(cb.fn);
- callbacks.splice(i, 1);
- }
+ SimpleTest.executeSoon(function() { SimpleTest.executeSoon(cb) });
+ callbacks.splice(i, 1);
}
requestAnimationFrame(tick);
});
@@ -333,7 +328,7 @@
callDelayed(function() {
expect(spy.callCount).to.be(1);
done();
- }, ASYNC_TIMEOUT);
+ });
});
@@ -348,7 +343,7 @@
callDelayed(function() {
expect(spy.callCount).to.be(0);
done();
- }, ASYNC_TIMEOUT);
+ });
});
it('triggers if target or root becomes invisible',
@@ -485,7 +480,7 @@
callDelayed(function() {
expect(spy.callCount).to.be(2);
done();
- }, ASYNC_TIMEOUT);
+ });
},
function(done) {
targetEl1.style.left = '-10px';
@@ -809,14 +804,14 @@
runSequence([
function(done) {
io.observe(targetEl1);
- callDelayed(done, 0);
+ callDelayed(done);
},
function(done) {
document.getElementById('fixtures').appendChild(rootEl);
callDelayed(function() {
expect(spy.callCount).to.be(1);
done();
- }, ASYNC_TIMEOUT);
+ });
},
function(done) {
parentEl.insertBefore(targetEl1, targetEl2);
@@ -876,7 +871,7 @@
io.observe(targetEl3);
callDelayed(function() {
parentEl.scrollLeft = 40;
- }, 0);
+ });
});
@@ -900,7 +895,7 @@
io.observe(targetEl1);
callDelayed(function() {
targetEl1.style.transform = 'translateX(-40px) translateY(-40px)';
- }, 0);
+ });
});
@@ -925,7 +920,7 @@
callDelayed(function () {
expect(spy.callCount).to.be(1);
done();
- }, ASYNC_TIMEOUT);
+ });
});
});
@@ -945,7 +940,7 @@
callDelayed(function() {
expect(spy.callCount).to.be(0);
done();
- }, ASYNC_TIMEOUT);
+ });
}
targetEl4.src = "intersectionobserver_iframe.html";
@@ -1005,7 +1000,7 @@
expect(lastestRecords.length).to.be(1);
expect(lastestRecords[0].intersectionRatio).to.be(1);
done();
- }, ASYNC_TIMEOUT);
+ });
});
});
@@ -1056,7 +1051,7 @@
callDelayed(function() {
expect(spy.callCount).to.be(2);
done();
- }, ASYNC_TIMEOUT);
+ });
}
], done);
@@ -1095,7 +1090,7 @@
callDelayed(function() {
expect(spy.callCount).to.be(1);
done();
- }, ASYNC_TIMEOUT);
+ });
}
], done);
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/test/unit/test_chromeutils_base64.js firefox-trunk-62.0~a1~hg20180620r423058/dom/base/test/unit/test_chromeutils_base64.js
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/test/unit/test_chromeutils_base64.js 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/test/unit/test_chromeutils_base64.js 2018-06-20 17:29:04.000000000 +0000
@@ -75,9 +75,11 @@
if (paddedValue.length > input.length) {
throws(_ => ChromeUtils.base64URLDecode(paddedValue, { padding: "reject" }),
+ /NS_ERROR_ILLEGAL_VALUE/,
paddedValue + " with padding rejected should throw");
throws(_ => ChromeUtils.base64URLDecode(input, { padding: "require" }),
+ /NS_ERROR_ILLEGAL_VALUE/,
input + " with padding required should throw");
buffer = ChromeUtils.base64URLDecode(paddedValue, { padding: "require" });
@@ -91,6 +93,7 @@
throws(_ => ChromeUtils.base64URLDecode("", {}), /TypeError/,
"Decoding should require the padding option");
throws(_ => ChromeUtils.base64URLDecode("", { padding: "chocolate" }),
+ /TypeError/,
"Decoding should throw for invalid padding policy");
for (let {decoded, encoded} of binaryTests) {
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/base/TimeoutManager.h firefox-trunk-62.0~a1~hg20180620r423058/dom/base/TimeoutManager.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/base/TimeoutManager.h 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/base/TimeoutManager.h 2018-06-20 17:29:03.000000000 +0000
@@ -111,6 +111,8 @@
nsIEventTarget*
EventTarget();
+ bool BudgetThrottlingEnabled(bool aIsBackground) const;
+
static const uint32_t InvalidFiringId;
private:
@@ -149,8 +151,6 @@
void UpdateBudget(const TimeStamp& aNow,
const TimeDuration& aDuration = TimeDuration());
- bool BudgetThrottlingEnabled(bool aIsBackground) const;
-
private:
struct Timeouts {
explicit Timeouts(const TimeoutManager& aManager)
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/bindings/Bindings.conf firefox-trunk-62.0~a1~hg20180620r423058/dom/bindings/Bindings.conf
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/bindings/Bindings.conf 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/bindings/Bindings.conf 2018-06-20 17:29:03.000000000 +0000
@@ -173,16 +173,6 @@
'headerFile': 'mozilla/css/GroupRule.h',
},
-'CSSCounterStyleRule': {
- 'nativeType': 'mozilla::ServoCounterStyleRule',
- 'headerFile': 'mozilla/ServoCounterStyleRule.h',
-},
-
-'CSSFontFaceRule': {
- 'nativeType': 'mozilla::ServoFontFaceRule',
- 'headerFile': 'mozilla/ServoFontFaceRule.h',
-},
-
'CSSGroupingRule': {
'concrete': False,
'nativeType': 'mozilla::css::GroupRule',
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/bindings/BindingUtils.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/bindings/BindingUtils.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/bindings/BindingUtils.cpp 2018-06-11 13:02:10.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/bindings/BindingUtils.cpp 2018-06-20 17:29:03.000000000 +0000
@@ -4010,23 +4010,19 @@
nsIDocument::DeprecatedOperations mOperation;
public:
- DeprecationWarningRunnable(WorkerPrivate* aWorkerPrivate,
- nsIDocument::DeprecatedOperations aOperation)
- : WorkerProxyToMainThreadRunnable(aWorkerPrivate)
- , mOperation(aOperation)
- {
- MOZ_ASSERT(aWorkerPrivate);
- aWorkerPrivate->AssertIsOnWorkerThread();
- }
+ explicit DeprecationWarningRunnable(nsIDocument::DeprecatedOperations aOperation)
+ : mOperation(aOperation)
+ {}
private:
void
- RunOnMainThread() override
+ RunOnMainThread(WorkerPrivate* aWorkerPrivate) override
{
MOZ_ASSERT(NS_IsMainThread());
+ MOZ_ASSERT(aWorkerPrivate);
// Walk up to our containing page
- WorkerPrivate* wp = mWorkerPrivate;
+ WorkerPrivate* wp = aWorkerPrivate;
while (wp->GetParent()) {
wp = wp->GetParent();
}
@@ -4038,7 +4034,7 @@
}
void
- RunBackOnWorkerThreadForCleanup() override
+ RunBackOnWorkerThreadForCleanup(WorkerPrivate* aWorkerPrivate) override
{}
};
@@ -4076,8 +4072,8 @@
}
RefPtr runnable =
- new DeprecationWarningRunnable(workerPrivate, aOperation);
- runnable->Dispatch();
+ new DeprecationWarningRunnable(aOperation);
+ runnable->Dispatch(workerPrivate);
}
namespace binding_detail {
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/bindings/BindingUtils.h firefox-trunk-62.0~a1~hg20180620r423058/dom/bindings/BindingUtils.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/bindings/BindingUtils.h 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/bindings/BindingUtils.h 2018-06-20 17:29:02.000000000 +0000
@@ -3062,8 +3062,7 @@
}
}
- if (aInitStandardClasses &&
- !JS_InitStandardClasses(aCx, aGlobal)) {
+ if (aInitStandardClasses && !JS::InitRealmStandardClasses(aCx)) {
NS_WARNING("Failed to init standard classes");
return false;
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/bindings/ErrorResult.h firefox-trunk-62.0~a1~hg20180620r423058/dom/bindings/ErrorResult.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/bindings/ErrorResult.h 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/bindings/ErrorResult.h 2018-06-20 17:29:02.000000000 +0000
@@ -566,7 +566,7 @@
// reference, not by value.
TErrorResult(const TErrorResult&) = delete;
void operator=(const TErrorResult&) = delete;
-};
+} JS_HAZ_ROOTED;
struct JustAssertCleanupPolicy {
static const bool assertHandled = true;
@@ -838,7 +838,7 @@
// to SuppressException (one from us, one from the ErrorResult destructor
// after asserting).
binding_danger::TErrorResult mInner;
-};
+} JS_HAZ_ROOTED;
/******************************************************************************
** Macros for checking results
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/bindings/test/test_dom_xrays.html firefox-trunk-62.0~a1~hg20180620r423058/dom/bindings/test/test_dom_xrays.html
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/bindings/test/test_dom_xrays.html 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/bindings/test/test_dom_xrays.html 2018-06-20 17:29:04.000000000 +0000
@@ -275,6 +275,14 @@
isnot(typeof Object.getOwnPropertyDescriptor(win.Node.prototype, "ELEMENT_NODE"), "undefined",
"Should see constant property on prototype objects");
+ // Adopting nodes should not lose expandos.
+ var elem = doc.createElement("span");
+ elem.expando = 5;
+ is(elem.expando, 5, "We just set this property");
+ document.adoptNode(elem);
+ is(elem.wrappedJSObject, undefined, "Shouldn't be an Xray anymore");
+ is(elem.expando, 5, "Expando should not get lost");
+
SimpleTest.finish();
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/cache/test/mochitest/mochitest.ini firefox-trunk-62.0~a1~hg20180620r423058/dom/cache/test/mochitest/mochitest.ini
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/cache/test/mochitest/mochitest.ini 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/cache/test/mochitest/mochitest.ini 2018-06-20 17:29:02.000000000 +0000
@@ -46,7 +46,7 @@
[test_cache_orphaned_body.html]
scheme=https
[test_cache_padding.html]
-skip-if = verify
+skip-if = verify || os == 'android' # bug 1468434 for android
[test_cache_untrusted.html]
[test_cache_updateUsage.html]
[test_chrome_constructor.html]
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/canvas/ImageBitmap.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/canvas/ImageBitmap.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/canvas/ImageBitmap.cpp 2018-06-11 13:02:09.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/canvas/ImageBitmap.cpp 2018-06-20 17:29:04.000000000 +0000
@@ -12,6 +12,7 @@
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/StructuredCloneTags.h"
#include "mozilla/dom/WorkerPrivate.h"
+#include "mozilla/dom/WorkerRef.h"
#include "mozilla/dom/WorkerRunnable.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Swizzle.h"
@@ -1219,7 +1220,6 @@
}
class CreateImageBitmapFromBlobRunnable;
-class CreateImageBitmapFromBlobHolder;
class CreateImageBitmapFromBlob final : public CancelableRunnable
, public imgIContainerCallback
@@ -1249,7 +1249,7 @@
return NS_OK;
}
- // Called by the WorkerHolder.
+ // Called by the WorkerRef.
void WorkerShuttingDown();
private:
@@ -1301,7 +1301,7 @@
// The access to this object is protected by mutex but is always nullified on
// the owning thread.
- UniquePtr mWorkerHolder;
+ RefPtr mWorkerRef;
// Touched only on the owning thread.
RefPtr mPromise;
@@ -1348,39 +1348,6 @@
nsresult mStatus;
};
-// This class keeps the worker alive and it informs CreateImageBitmapFromBlob
-// when it goes away.
-class CreateImageBitmapFromBlobHolder final : public WorkerHolder
-{
-public:
- CreateImageBitmapFromBlobHolder(WorkerPrivate* aWorkerPrivate,
- CreateImageBitmapFromBlob* aTask)
- : WorkerHolder("CreateImageBitmapFromBlobHolder")
- , mWorkerPrivate(aWorkerPrivate)
- , mTask(aTask)
- , mNotified(false)
- {}
-
- bool Notify(WorkerStatus aStatus) override
- {
- if (!mNotified) {
- mNotified = true;
- mTask->WorkerShuttingDown();
- }
- return true;
- }
-
- WorkerPrivate* GetWorkerPrivate() const
- {
- return mWorkerPrivate;
- }
-
-private:
- WorkerPrivate* mWorkerPrivate;
- RefPtr mTask;
- bool mNotified;
-};
-
static void
AsyncCreateImageBitmapFromBlob(Promise* aPromise, nsIGlobalObject* aGlobal,
Blob& aBlob, const Maybe& aCropRect)
@@ -2204,19 +2171,21 @@
return task.forget();
}
- // Let's use a WorkerHolder to keep the worker alive if this is not the
+ // Let's use a WorkerRef to keep the worker alive if this is not the
// main-thread.
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(workerPrivate);
- UniquePtr holder(
- new CreateImageBitmapFromBlobHolder(workerPrivate, task));
-
- if (!holder->HoldWorker(workerPrivate, Terminating)) {
+ RefPtr workerRef =
+ StrongWorkerRef::Create(workerPrivate, "CreateImageBitmapFromBlob",
+ [task]() {
+ task->WorkerShuttingDown();
+ });
+ if (NS_WARN_IF(!workerRef)) {
return nullptr;
}
- task->mWorkerHolder = std::move(holder);
+ task->mWorkerRef = new ThreadSafeWorkerRef(workerRef);
return task.forget();
}
@@ -2339,13 +2308,13 @@
if (!IsCurrentThread()) {
MutexAutoLock lock(mMutex);
- if (!mWorkerHolder) {
+ if (!mWorkerRef) {
// The worker is already gone.
return;
}
RefPtr r =
- new CreateImageBitmapFromBlobRunnable(mWorkerHolder->GetWorkerPrivate(),
+ new CreateImageBitmapFromBlobRunnable(mWorkerRef->Private(),
this, aImage, aStatus);
r->Dispatch();
return;
@@ -2368,7 +2337,7 @@
// Let's release what has to be released on the owning thread.
auto raii = MakeScopeExit([&] {
// Doing this we also release the worker.
- mWorkerHolder = nullptr;
+ mWorkerRef = nullptr;
mPromise = nullptr;
mGlobalObject = nullptr;
@@ -2409,7 +2378,7 @@
MutexAutoLock lock(mMutex);
// Let's release all the non-thread-safe objects now.
- mWorkerHolder = nullptr;
+ mWorkerRef = nullptr;
mPromise = nullptr;
mGlobalObject = nullptr;
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/canvas/test/webgl-conf/generated-mochitest.ini firefox-trunk-62.0~a1~hg20180620r423058/dom/canvas/test/webgl-conf/generated-mochitest.ini
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/canvas/test/webgl-conf/generated-mochitest.ini 2018-06-11 13:02:10.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/canvas/test/webgl-conf/generated-mochitest.ini 2018-06-20 17:29:05.000000000 +0000
@@ -4,7 +4,7 @@
[DEFAULT]
subsuite = webgl
-skip-if = (os == 'linux') && (buildapp == 'mulet')
+skip-if = os == 'linux'
support-files = always-fail.html
checkout/00_test_list.txt
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/canvas/test/webgl-conf/mochitest-errata.ini firefox-trunk-62.0~a1~hg20180620r423058/dom/canvas/test/webgl-conf/mochitest-errata.ini
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/canvas/test/webgl-conf/mochitest-errata.ini 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/canvas/test/webgl-conf/mochitest-errata.ini 2018-06-20 17:29:06.000000000 +0000
@@ -23,8 +23,7 @@
[DEFAULT]
subsuite = webgl
-# Bug 1136181 disabled on Mulet for intermittent failures
-skip-if = (os == 'linux') && (buildapp == 'mulet')
+skip-if = os == 'linux'
[generated/test_..__always-fail.html]
fail-if = 1
@@ -199,7 +198,7 @@
[generated/test_conformance__misc__type-conversion-test.html]
fail-if = (os == 'linux')
# Resets device on Android 2.3.
-# Crashes on desktop Linux, and Mulet Linux x64.
+# Crashes on desktop Linux.
skip-if = (os == 'android') || (os == 'linux')
[generated/test_conformance__misc__object-deletion-behaviour.html]
@@ -362,10 +361,9 @@
########################################################################
# "tst-linux{32,64}-spot-NNN" Slaves:
-# Android 2.3, Linux, and Mulet.
+# Android 2.3 and Linux.
# Android: os == 'android'. (Not enough info to separate out 2.3)
# Linux: os == 'linux'.
-# Mulet: buildapp == 'mulet'.
[generated/test_conformance__glsl__bugs__temp-expressions-should-not-crash.html]
# Coincidentally enough, crashes on Linux and Android 4.0.
skip-if = (os == 'android') || (os == 'linux')
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/chrome-webidl/InspectorUtils.webidl firefox-trunk-62.0~a1~hg20180620r423058/dom/chrome-webidl/InspectorUtils.webidl
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/chrome-webidl/InspectorUtils.webidl 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/chrome-webidl/InspectorUtils.webidl 2018-06-20 17:29:04.000000000 +0000
@@ -20,7 +20,6 @@
unsigned long getRuleColumn(CSSRule rule);
unsigned long getRelativeRuleLine(CSSRule rule);
boolean hasRulesModifiedByCSSOM(CSSStyleSheet sheet);
- [NewObject] CSSLexer getCSSLexer(DOMString text);
unsigned long getSelectorCount(CSSStyleRule rule);
[Throws] DOMString getSelectorText(CSSStyleRule rule,
unsigned long selectorIndex);
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/console/Console.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/console/Console.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/console/Console.cpp 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/console/Console.cpp 2018-06-20 17:29:04.000000000 +0000
@@ -667,8 +667,7 @@
{
public:
explicit ConsoleWorkerRunnable(Console* aConsole)
- : WorkerProxyToMainThreadRunnable(GetCurrentThreadWorkerPrivate())
- , mConsole(aConsole)
+ : mConsole(aConsole)
{}
~ConsoleWorkerRunnable() override = default;
@@ -676,14 +675,15 @@
bool
Dispatch(JSContext* aCx)
{
- mWorkerPrivate->AssertIsOnWorkerThread();
+ WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
+ MOZ_ASSERT(workerPrivate);
if (NS_WARN_IF(!PreDispatch(aCx))) {
- RunBackOnWorkerThreadForCleanup();
+ RunBackOnWorkerThreadForCleanup(workerPrivate);
return false;
}
- if (NS_WARN_IF(!WorkerProxyToMainThreadRunnable::Dispatch())) {
+ if (NS_WARN_IF(!WorkerProxyToMainThreadRunnable::Dispatch(workerPrivate))) {
// RunBackOnWorkerThreadForCleanup() will be called by
// WorkerProxyToMainThreadRunnable::Dispatch().
return false;
@@ -694,27 +694,29 @@
protected:
void
- RunOnMainThread() override
+ RunOnMainThread(WorkerPrivate* aWorkerPrivate) override
{
+ MOZ_ASSERT(aWorkerPrivate);
AssertIsOnMainThread();
// Walk up to our containing page
- WorkerPrivate* wp = mWorkerPrivate;
+ WorkerPrivate* wp = aWorkerPrivate;
while (wp->GetParent()) {
wp = wp->GetParent();
}
nsPIDOMWindowInner* window = wp->GetWindow();
if (!window) {
- RunWindowless();
+ RunWindowless(aWorkerPrivate);
} else {
- RunWithWindow(window);
+ RunWithWindow(aWorkerPrivate, window);
}
}
void
- RunWithWindow(nsPIDOMWindowInner* aWindow)
+ RunWithWindow(WorkerPrivate* aWorkerPrivate, nsPIDOMWindowInner* aWindow)
{
+ MOZ_ASSERT(aWorkerPrivate);
AssertIsOnMainThread();
AutoJSAPI jsapi;
@@ -730,15 +732,16 @@
return;
}
- RunConsole(jsapi.cx(), outerWindow, aWindow);
+ RunConsole(jsapi.cx(), aWorkerPrivate, outerWindow, aWindow);
}
void
- RunWindowless()
+ RunWindowless(WorkerPrivate* aWorkerPrivate)
{
+ MOZ_ASSERT(aWorkerPrivate);
AssertIsOnMainThread();
- WorkerPrivate* wp = mWorkerPrivate;
+ WorkerPrivate* wp = aWorkerPrivate;
while (wp->GetParent()) {
wp = wp->GetParent();
}
@@ -761,13 +764,14 @@
JSAutoRealm ar(cx, global);
- RunConsole(cx, nullptr, nullptr);
+ RunConsole(cx, aWorkerPrivate, nullptr, nullptr);
}
void
- RunBackOnWorkerThreadForCleanup() override
+ RunBackOnWorkerThreadForCleanup(WorkerPrivate* aWorkerPrivate) override
{
- mWorkerPrivate->AssertIsOnWorkerThread();
+ MOZ_ASSERT(aWorkerPrivate);
+ aWorkerPrivate->AssertIsOnWorkerThread();
ReleaseData();
mConsole = nullptr;
}
@@ -778,7 +782,8 @@
// This method is called in the main-thread.
virtual void
- RunConsole(JSContext* aCx, nsPIDOMWindowOuter* aOuterWindow,
+ RunConsole(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
+ nsPIDOMWindowOuter* aOuterWindow,
nsPIDOMWindowInner* aInnerWindow) = 0;
// This method is called in the owning thread of the Console object.
@@ -802,7 +807,6 @@
, mCallData(aCallData)
{
MOZ_ASSERT(aCallData);
- mWorkerPrivate->AssertIsOnWorkerThread();
mCallData->AssertIsOnOwningThread();
// Marking this CallData as in use.
@@ -822,9 +826,11 @@
}
void
- RunConsole(JSContext* aCx, nsPIDOMWindowOuter* aOuterWindow,
+ RunConsole(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
+ nsPIDOMWindowOuter* aOuterWindow,
nsPIDOMWindowInner* aInnerWindow) override
{
+ MOZ_ASSERT(aWorkerPrivate);
AssertIsOnMainThread();
// The windows have to run in parallel.
@@ -840,13 +846,13 @@
nsString id = frame.mFilename;
nsString innerID;
- if (mWorkerPrivate->IsSharedWorker()) {
+ if (aWorkerPrivate->IsSharedWorker()) {
innerID = NS_LITERAL_STRING("SharedWorker");
- } else if (mWorkerPrivate->IsServiceWorker()) {
+ } else if (aWorkerPrivate->IsServiceWorker()) {
innerID = NS_LITERAL_STRING("ServiceWorker");
// Use scope as ID so the webconsole can decide if the message should
// show up per tab
- CopyASCIItoUTF16(mWorkerPrivate->ServiceWorkerScope(), id);
+ CopyASCIItoUTF16(aWorkerPrivate->ServiceWorkerScope(), id);
} else {
innerID = NS_LITERAL_STRING("Worker");
}
@@ -961,7 +967,8 @@
}
void
- RunConsole(JSContext* aCx, nsPIDOMWindowOuter* aOuterWindow,
+ RunConsole(JSContext* aCx, WorkerPrivate* aWorkerPrivate,
+ nsPIDOMWindowOuter* aOuterWindow,
nsPIDOMWindowInner* aInnerWindow) override
{
AssertIsOnMainThread();
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/crypto/WebCryptoTask.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/crypto/WebCryptoTask.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/crypto/WebCryptoTask.cpp 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/crypto/WebCryptoTask.cpp 2018-06-20 17:29:04.000000000 +0000
@@ -19,7 +19,7 @@
#include "mozilla/dom/WebCryptoCommon.h"
#include "mozilla/dom/WebCryptoTask.h"
#include "mozilla/dom/WebCryptoThreadPool.h"
-#include "mozilla/dom/WorkerHolder.h"
+#include "mozilla/dom/WorkerRef.h"
#include "mozilla/dom/WorkerPrivate.h"
// Template taken from security/nss/lib/util/templates.c
@@ -135,47 +135,6 @@
JSContext* mCx;
};
-class WebCryptoTask::InternalWorkerHolder final : public WorkerHolder
-{
- InternalWorkerHolder()
- : WorkerHolder("WebCryptoTask::InternalWorkerHolder")
- { }
-
- ~InternalWorkerHolder()
- {
- NS_ASSERT_OWNINGTHREAD(InternalWorkerHolder);
- // Nothing to do here since the parent destructor releases the
- // worker automatically.
- }
-
-public:
- static already_AddRefed
- Create()
- {
- MOZ_ASSERT(!NS_IsMainThread());
- WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
- MOZ_ASSERT(workerPrivate);
- RefPtr ref = new InternalWorkerHolder();
- if (NS_WARN_IF(!ref->HoldWorker(workerPrivate, Canceling))) {
- return nullptr;
- }
- return ref.forget();
- }
-
- virtual bool
- Notify(WorkerStatus aStatus) override
- {
- NS_ASSERT_OWNINGTHREAD(InternalWorkerHolder);
- // Do nothing here. Since WebCryptoTask dispatches back to
- // the worker thread using nsThread::Dispatch() instead of
- // WorkerRunnable it will always be able to execute its
- // runnables.
- return true;
- }
-
- NS_INLINE_DECL_REFCOUNTING(WebCryptoTask::InternalWorkerHolder)
-};
-
template
static nsresult
GetAlgorithmName(JSContext* aCx, const OOS& aAlgorithm, nsString& aName)
@@ -385,11 +344,15 @@
// private may get torn down before we dispatch back to complete
// the transaction.
if (!NS_IsMainThread()) {
- mWorkerHolder = InternalWorkerHolder::Create();
- // If we can't register a holder then the worker is already
- // shutting down. Don't start new work.
- if (!mWorkerHolder) {
+ WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
+ MOZ_ASSERT(workerPrivate);
+
+ RefPtr workerRef =
+ StrongWorkerRef::Create(workerPrivate, "WebCryptoTask");
+ if (NS_WARN_IF(!workerRef)) {
mEarlyRv = NS_BINDING_ABORTED;
+ } else {
+ mWorkerRef = new ThreadSafeWorkerRef(workerRef);
}
}
MAYBE_EARLY_FAIL(mEarlyRv);
@@ -416,7 +379,7 @@
// Stop holding the worker thread alive now that the async work has
// been completed.
- mWorkerHolder = nullptr;
+ mWorkerRef = nullptr;
return NS_OK;
}
@@ -440,7 +403,7 @@
mResultPromise->MaybeReject(aRv);
// Manually release mResultPromise while we're on the main thread
mResultPromise = nullptr;
- mWorkerHolder = nullptr;
+ mWorkerRef = nullptr;
Cleanup();
}
@@ -3675,14 +3638,7 @@
{
}
-WebCryptoTask::~WebCryptoTask()
-{
- if (mWorkerHolder) {
- NS_ProxyRelease(
- "WebCryptoTask::mWorkerHolder",
- mOriginalEventTarget, mWorkerHolder.forget());
- }
-}
+WebCryptoTask::~WebCryptoTask() = default;
} // namespace dom
} // namespace mozilla
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/crypto/WebCryptoTask.h firefox-trunk-62.0~a1~hg20180620r423058/dom/crypto/WebCryptoTask.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/crypto/WebCryptoTask.h 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/crypto/WebCryptoTask.h 2018-06-20 17:29:06.000000000 +0000
@@ -17,6 +17,8 @@
namespace mozilla {
namespace dom {
+class ThreadSafeWorkerRef;
+
typedef ArrayBufferViewOrArrayBuffer CryptoOperationData;
typedef ArrayBufferViewOrArrayBuffer KeyData;
@@ -187,10 +189,8 @@
NS_IMETHOD Run() final;
nsresult Cancel() final;
- class InternalWorkerHolder;
-
nsCOMPtr mOriginalEventTarget;
- RefPtr mWorkerHolder;
+ RefPtr mWorkerRef;
nsresult mRv;
};
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/events/EventDispatcher.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/events/EventDispatcher.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/events/EventDispatcher.cpp 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/events/EventDispatcher.cpp 2018-06-20 17:29:04.000000000 +0000
@@ -236,11 +236,13 @@
MOZ_ASSERT(aTouchEvent,
"mRetargetedTouchTargets should be empty when dispatching non-touch events.");
- WidgetTouchEvent::TouchArray& touches = aTouchEvent->mTouches;
- MOZ_ASSERT(!touches.Length() ||
- touches.Length() == mRetargetedTouchTargets->Length());
- for (uint32_t i = 0; i < touches.Length(); ++i) {
- touches[i]->mTarget = mRetargetedTouchTargets->ElementAt(i);
+ if (mRetargetedTouchTargets.isSome()) {
+ WidgetTouchEvent::TouchArray& touches = aTouchEvent->mTouches;
+ MOZ_ASSERT(!touches.Length() ||
+ touches.Length() == mRetargetedTouchTargets->Length());
+ for (uint32_t i = 0; i < touches.Length(); ++i) {
+ touches[i]->mTarget = mRetargetedTouchTargets->ElementAt(i);
+ }
}
if (aDOMEvent) {
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/events/EventStateManager.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/events/EventStateManager.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/events/EventStateManager.cpp 2018-06-11 13:02:12.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/events/EventStateManager.cpp 2018-06-20 17:29:05.000000000 +0000
@@ -234,6 +234,8 @@
, mCurrentTarget(nullptr)
// init d&d gesture state machine variables
, mGestureDownPoint(0,0)
+ , mGestureModifiers(0)
+ , mGestureDownButtons(0)
, mPresContext(nullptr)
, mLClickCount(0)
, mMClickCount(0)
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/events/IMEContentObserver.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/events/IMEContentObserver.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/events/IMEContentObserver.cpp 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/events/IMEContentObserver.cpp 2018-06-20 17:29:06.000000000 +0000
@@ -198,6 +198,7 @@
IMEContentObserver::IMEContentObserver()
: mESM(nullptr)
, mIMENotificationRequests(nullptr)
+ , mPreAttrChangeLength(0)
, mSuppressNotifications(0)
, mPreCharacterDataChangeLength(-1)
, mSendingNotification(NOTIFY_IME_OF_NOTHING)
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/events/test/pointerevents/mochitest.ini firefox-trunk-62.0~a1~hg20180620r423058/dom/events/test/pointerevents/mochitest.ini
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/events/test/pointerevents/mochitest.ini 2018-06-11 13:02:12.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/events/test/pointerevents/mochitest.ini 2018-06-20 17:29:05.000000000 +0000
@@ -142,8 +142,6 @@
pointerevent_touch-action-pan-left-css_touch-manual.html
pointerevent_touch-action-pan-right-css_touch-manual.html
pointerevent_touch-action-pan-up-css_touch-manual.html
- # bug 1429521 for webrender, bug 1432914 for why this isn't an inline comment
- skip-if = webrender
[test_trigger_fullscreen_by_pointer_events.html]
support-files =
file_test_trigger_fullscreen.html
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/events/TextComposition.h firefox-trunk-62.0~a1~hg20180620r423058/dom/events/TextComposition.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/events/TextComposition.h 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/events/TextComposition.h 2018-06-20 17:29:04.000000000 +0000
@@ -577,6 +577,7 @@
CompositionEventDispatcher()
: Runnable("TextComposition::CompositionEventDispatcher")
+ , mEventMessage(eVoidEvent)
, mIsSynthesizedEvent(false){};
};
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/events/TouchEvent.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/events/TouchEvent.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/events/TouchEvent.cpp 2018-06-11 13:02:12.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/events/TouchEvent.cpp 2018-06-20 17:29:05.000000000 +0000
@@ -222,6 +222,32 @@
// static
bool
+TouchEvent::PlatformSupportsTouch()
+{
+#if defined(MOZ_WIDGET_ANDROID)
+ // Touch support is always enabled on android.
+ return true;
+#elif defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
+ static bool sDidCheckTouchDeviceSupport = false;
+ static bool sIsTouchDeviceSupportPresent = false;
+ // On Windows and GTK3 we auto-detect based on device support.
+ if (!sDidCheckTouchDeviceSupport) {
+ sDidCheckTouchDeviceSupport = true;
+ sIsTouchDeviceSupportPresent = WidgetUtils::IsTouchDeviceSupportPresent();
+ // But touch events are only actually supported if APZ is enabled. If
+ // APZ is disabled globally, we can check that once and incorporate that
+ // into the cached state. If APZ is enabled, we need to further check
+ // based on the widget, which we do below (and don't cache that result).
+ sIsTouchDeviceSupportPresent &= gfxPlatform::AsyncPanZoomEnabled();
+ }
+ return sIsTouchDeviceSupportPresent;
+#else
+ return false;
+#endif
+}
+
+// static
+bool
TouchEvent::PrefEnabled(nsIDocShell* aDocShell)
{
static bool sPrefCached = false;
@@ -244,23 +270,20 @@
enabled = false;
} else {
if (sPrefCacheValue == 2) {
-#if defined(MOZ_WIDGET_ANDROID)
- // Touch support is always enabled on B2G and android.
- enabled = true;
-#elif defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
- static bool sDidCheckTouchDeviceSupport = false;
- static bool sIsTouchDeviceSupportPresent = false;
- // On Windows and GTK3 we auto-detect based on device support.
- if (!sDidCheckTouchDeviceSupport) {
- sDidCheckTouchDeviceSupport = true;
- sIsTouchDeviceSupportPresent = WidgetUtils::IsTouchDeviceSupportPresent();
- // But touch events are only actually supported if APZ is enabled. If
- // APZ is disabled globally, we can check that once and incorporate that
- // into the cached state. If APZ is enabled, we need to further check
- // based on the widget, which we do below (and don't cache that result).
- sIsTouchDeviceSupportPresent &= gfxPlatform::AsyncPanZoomEnabled();
+ enabled = PlatformSupportsTouch();
+
+ static bool firstTime = true;
+ // The touch screen data seems to be inaccurate in the parent process,
+ // and we really need the crash annotation in child processes.
+ if (firstTime && !XRE_IsParentProcess()) {
+ CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("HasDeviceTouchScreen"),
+ enabled ?
+ NS_LITERAL_CSTRING("1") :
+ NS_LITERAL_CSTRING("0"));
+ firstTime = false;
}
- enabled = sIsTouchDeviceSupportPresent;
+
+#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
if (enabled && aDocShell) {
// APZ might be disabled on this particular widget, in which case
// TouchEvent support will also be disabled. Try to detect that.
@@ -270,8 +293,6 @@
enabled &= pc->GetRootWidget()->AsyncPanZoomEnabled();
}
}
-#else
- enabled = false;
#endif
} else {
enabled = !!sPrefCacheValue;
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/events/TouchEvent.h firefox-trunk-62.0~a1~hg20180620r423058/dom/events/TouchEvent.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/events/TouchEvent.h 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/events/TouchEvent.h 2018-06-20 17:29:04.000000000 +0000
@@ -128,6 +128,7 @@
TouchList* aTargetTouches,
TouchList* aChangedTouches);
+ static bool PlatformSupportsTouch();
static bool PrefEnabled(JSContext* aCx, JSObject* aGlobal);
static bool PrefEnabled(nsIDocShell* aDocShell);
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/events/WheelHandlingHelper.h firefox-trunk-62.0~a1~hg20180620r423058/dom/events/WheelHandlingHelper.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/events/WheelHandlingHelper.h 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/events/WheelHandlingHelper.h 2018-06-20 17:29:06.000000000 +0000
@@ -280,6 +280,10 @@
*/
explicit WheelDeltaHorizontalizer(WidgetWheelEvent& aWheelEvent)
: mWheelEvent(aWheelEvent)
+ , mOldDeltaX(0.0)
+ , mOldDeltaZ(0.0)
+ , mOldOverflowDeltaX(0.0)
+ , mOldLineOrPageDeltaX(0)
, mHorizontalized(false)
{
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/events/XULCommandEvent.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/events/XULCommandEvent.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/events/XULCommandEvent.cpp 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/events/XULCommandEvent.cpp 2018-06-20 17:29:06.000000000 +0000
@@ -16,6 +16,7 @@
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetInputEvent(false, eVoidEvent, nullptr))
+ , mInputSource(0)
{
if (aEvent) {
mEventIsInternal = false;
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/BaseBlobImpl.h firefox-trunk-62.0~a1~hg20180620r423058/dom/file/BaseBlobImpl.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/BaseBlobImpl.h 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/BaseBlobImpl.h 2018-06-20 17:29:06.000000000 +0000
@@ -102,6 +102,11 @@
return 0;
}
+ size_t GetAllocationSize(FallibleTArray& aVisitedBlobImpls) const override
+ {
+ return GetAllocationSize();
+ }
+
virtual uint64_t GetSerialNumber() const override { return mSerialNumber; }
virtual already_AddRefed
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/BlobImpl.h firefox-trunk-62.0~a1~hg20180620r423058/dom/file/BlobImpl.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/BlobImpl.h 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/BlobImpl.h 2018-06-20 17:29:06.000000000 +0000
@@ -52,6 +52,7 @@
virtual void GetType(nsAString& aType) = 0;
virtual size_t GetAllocationSize() const = 0;
+ virtual size_t GetAllocationSize(FallibleTArray& aVisitedBlobImpls) const = 0;
/**
* An effectively-unique serial number identifying this instance of FileImpl.
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/BlobSet.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/file/BlobSet.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/BlobSet.cpp 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/BlobSet.cpp 2018-06-20 17:29:06.000000000 +0000
@@ -29,9 +29,7 @@
memcpy((char*)data, aData, aLength);
RefPtr blobImpl = new MemoryBlobImpl(data, aLength, EmptyString());
- mBlobImpls.AppendElement(blobImpl);
-
- return NS_OK;
+ return AppendBlobImpl(blobImpl);
}
nsresult
@@ -61,7 +59,9 @@
BlobSet::AppendBlobImpl(BlobImpl* aBlobImpl)
{
NS_ENSURE_ARG_POINTER(aBlobImpl);
- mBlobImpls.AppendElement(aBlobImpl);
+ if (NS_WARN_IF(!mBlobImpls.AppendElement(aBlobImpl, fallible))) {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
return NS_OK;
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/BlobSet.h firefox-trunk-62.0~a1~hg20180620r423058/dom/file/BlobSet.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/BlobSet.h 2018-06-11 13:02:12.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/BlobSet.h 2018-06-20 17:29:06.000000000 +0000
@@ -20,16 +20,16 @@
class BlobSet final
{
public:
- nsresult AppendVoidPtr(const void* aData, uint32_t aLength);
+ MOZ_MUST_USE nsresult AppendVoidPtr(const void* aData, uint32_t aLength);
- nsresult AppendString(const nsAString& aString, bool nativeEOL);
+ MOZ_MUST_USE nsresult AppendString(const nsAString& aString, bool nativeEOL);
- nsresult AppendBlobImpl(BlobImpl* aBlobImpl);
+ MOZ_MUST_USE nsresult AppendBlobImpl(BlobImpl* aBlobImpl);
- nsTArray>& GetBlobImpls() { return mBlobImpls; }
+ FallibleTArray>& GetBlobImpls() { return mBlobImpls; }
private:
- nsTArray> mBlobImpls;
+ FallibleTArray> mBlobImpls;
};
} // namespace dom
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/ipc/IPCBlobUtils.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/file/ipc/IPCBlobUtils.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/ipc/IPCBlobUtils.cpp 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/ipc/IPCBlobUtils.cpp 2018-06-20 17:29:04.000000000 +0000
@@ -61,12 +61,12 @@
RefPtr blobImpl;
if (aIPCBlob.file().type() == IPCFileUnion::Tvoid_t) {
- blobImpl = StreamBlobImpl::Create(inputStream,
+ blobImpl = StreamBlobImpl::Create(inputStream.forget(),
aIPCBlob.type(),
aIPCBlob.size());
} else {
const IPCFile& file = aIPCBlob.file().get_IPCFile();
- blobImpl = StreamBlobImpl::Create(inputStream,
+ blobImpl = StreamBlobImpl::Create(inputStream.forget(),
file.name(),
aIPCBlob.type(),
file.lastModified(),
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/MemoryBlobImpl.h firefox-trunk-62.0~a1~hg20180620r423058/dom/file/MemoryBlobImpl.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/MemoryBlobImpl.h 2018-06-11 13:02:12.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/MemoryBlobImpl.h 2018-06-20 17:29:06.000000000 +0000
@@ -58,6 +58,11 @@
return mLength;
}
+ size_t GetAllocationSize(FallibleTArray& aVisitedBlobImpls) const override
+ {
+ return GetAllocationSize();
+ }
+
class DataOwner final : public mozilla::LinkedListElement
{
public:
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/MultipartBlobImpl.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/file/MultipartBlobImpl.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/MultipartBlobImpl.cpp 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/MultipartBlobImpl.cpp 2018-06-20 17:29:04.000000000 +0000
@@ -59,6 +59,18 @@
{
*aStream = nullptr;
+ uint32_t length = mBlobImpls.Length();
+ if (length == 0) {
+ aRv = NS_NewCStringInputStream(aStream, EmptyCString());
+ return;
+ }
+
+ if (length == 1) {
+ BlobImpl* blobImpl = mBlobImpls.ElementAt(0);
+ blobImpl->CreateInputStream(aStream, aRv);
+ return;
+ }
+
nsCOMPtr stream =
do_CreateInstance("@mozilla.org/io/multiplex-input-stream;1");
if (NS_WARN_IF(!stream)) {
@@ -67,7 +79,7 @@
}
uint32_t i;
- for (i = 0; i < mBlobImpls.Length(); i++) {
+ for (i = 0; i < length; i++) {
nsCOMPtr scratchStream;
BlobImpl* blobImpl = mBlobImpls.ElementAt(i).get();
@@ -182,7 +194,10 @@
if (data.IsBlob()) {
RefPtr blob = data.GetAsBlob().get();
- blobSet.AppendBlobImpl(blob->Impl());
+ aRv = blobSet.AppendBlobImpl(blob->Impl());
+ if (aRv.Failed()) {
+ return;
+ }
}
else if (data.IsUSVString()) {
@@ -383,7 +398,11 @@
}
BlobSet blobSet;
- blobSet.AppendBlobImpl(static_cast(blob.get())->Impl());
+ rv = blobSet.AppendBlobImpl(static_cast(blob.get())->Impl());
+ if (NS_WARN_IF(NS_FAILED(rv))) {
+ return rv;
+ }
+
mBlobImpls = blobSet.GetBlobImpls();
SetLengthAndModifiedDate(error);
@@ -412,9 +431,30 @@
size_t MultipartBlobImpl::GetAllocationSize() const
{
+ FallibleTArray visitedBlobs;
+
+ // We want to report the unique blob allocation, avoiding duplicated blobs in
+ // the multipart blob tree.
size_t total = 0;
for (uint32_t i = 0; i < mBlobImpls.Length(); ++i) {
- total += mBlobImpls[i]->GetAllocationSize();
+ total += mBlobImpls[i]->GetAllocationSize(visitedBlobs);
+ }
+
+ return total;
+}
+
+size_t MultipartBlobImpl::GetAllocationSize(FallibleTArray& aVisitedBlobs) const
+{
+ FallibleTArray visitedBlobs;
+
+ size_t total = 0;
+ for (BlobImpl* blobImpl : mBlobImpls) {
+ if (!aVisitedBlobs.Contains(blobImpl)) {
+ if (NS_WARN_IF(!aVisitedBlobs.AppendElement(blobImpl, fallible))) {
+ return 0;
+ }
+ total += blobImpl->GetAllocationSize(aVisitedBlobs);
+ }
}
return total;
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/MultipartBlobImpl.h firefox-trunk-62.0~a1~hg20180620r423058/dom/file/MultipartBlobImpl.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/MultipartBlobImpl.h 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/MultipartBlobImpl.h 2018-06-20 17:29:06.000000000 +0000
@@ -93,6 +93,7 @@
virtual bool MayBeClonedToOtherThreads() const override;
size_t GetAllocationSize() const override;
+ size_t GetAllocationSize(FallibleTArray& aVisitedBlobImpls) const override;
protected:
MultipartBlobImpl(nsTArray>&& aBlobImpls,
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/StreamBlobImpl.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/file/StreamBlobImpl.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/StreamBlobImpl.cpp 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/StreamBlobImpl.cpp 2018-06-20 17:29:06.000000000 +0000
@@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "EmptyBlobImpl.h"
+#include "mozilla/InputStreamLengthWrapper.h"
#include "mozilla/SlicedInputStream.h"
#include "StreamBlobImpl.h"
#include "nsStreamUtils.h"
@@ -17,48 +18,52 @@
NS_IMPL_ISUPPORTS_INHERITED(StreamBlobImpl, BlobImpl, nsIMemoryReporter)
/* static */ already_AddRefed
-StreamBlobImpl::Create(nsIInputStream* aInputStream,
+StreamBlobImpl::Create(already_AddRefed aInputStream,
const nsAString& aContentType,
uint64_t aLength)
{
+ nsCOMPtr inputStream = std::move(aInputStream);
+
RefPtr blobImplStream =
- new StreamBlobImpl(aInputStream, aContentType, aLength);
+ new StreamBlobImpl(inputStream.forget(), aContentType, aLength);
blobImplStream->MaybeRegisterMemoryReporter();
return blobImplStream.forget();
}
/* static */ already_AddRefed
-StreamBlobImpl::Create(nsIInputStream* aInputStream,
+StreamBlobImpl::Create(already_AddRefed aInputStream,
const nsAString& aName,
const nsAString& aContentType,
int64_t aLastModifiedDate,
uint64_t aLength)
{
+ nsCOMPtr inputStream = std::move(aInputStream);
+
RefPtr blobImplStream =
- new StreamBlobImpl(aInputStream, aName, aContentType, aLastModifiedDate,
- aLength);
+ new StreamBlobImpl(inputStream.forget(), aName, aContentType,
+ aLastModifiedDate, aLength);
blobImplStream->MaybeRegisterMemoryReporter();
return blobImplStream.forget();
}
-StreamBlobImpl::StreamBlobImpl(nsIInputStream* aInputStream,
+StreamBlobImpl::StreamBlobImpl(already_AddRefed aInputStream,
const nsAString& aContentType,
uint64_t aLength)
: BaseBlobImpl(aContentType, aLength)
- , mInputStream(aInputStream)
+ , mInputStream(std::move(aInputStream))
, mIsDirectory(false)
, mFileId(-1)
{
mImmutable = true;
}
-StreamBlobImpl::StreamBlobImpl(nsIInputStream* aInputStream,
+StreamBlobImpl::StreamBlobImpl(already_AddRefed aInputStream,
const nsAString& aName,
const nsAString& aContentType,
int64_t aLastModifiedDate,
uint64_t aLength)
: BaseBlobImpl(aName, aContentType, aLength, aLastModifiedDate)
- , mInputStream(aInputStream)
+ , mInputStream(std::move(aInputStream))
, mIsDirectory(false)
, mFileId(-1)
{
@@ -86,7 +91,10 @@
mInputStream = replacementStream.forget();
}
- clonedStream.forget(aStream);
+ nsCOMPtr wrappedStream =
+ InputStreamLengthWrapper::MaybeWrap(clonedStream.forget(), mLength);
+
+ wrappedStream.forget(aStream);
}
already_AddRefed
@@ -120,7 +128,7 @@
MOZ_ASSERT(clonedStream);
RefPtr impl =
- new StreamBlobImpl(clonedStream, aContentType, aLength);
+ new StreamBlobImpl(clonedStream.forget(), aContentType, aLength);
return impl.forget();
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/StreamBlobImpl.h firefox-trunk-62.0~a1~hg20180620r423058/dom/file/StreamBlobImpl.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/StreamBlobImpl.h 2018-06-11 13:02:12.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/StreamBlobImpl.h 2018-06-20 17:29:06.000000000 +0000
@@ -23,12 +23,12 @@
NS_DECL_NSIMEMORYREPORTER
static already_AddRefed
- Create(nsIInputStream* aInputStream,
+ Create(already_AddRefed aInputStream,
const nsAString& aContentType,
uint64_t aLength);
static already_AddRefed
- Create(nsIInputStream* aInputStream,
+ Create(already_AddRefed aInputStream,
const nsAString& aName,
const nsAString& aContentType,
int64_t aLastModifiedDate,
@@ -79,12 +79,17 @@
size_t GetAllocationSize() const override;
+ size_t GetAllocationSize(FallibleTArray& aVisitedBlobImpls) const override
+ {
+ return GetAllocationSize();
+ }
+
private:
- StreamBlobImpl(nsIInputStream* aInputStream,
+ StreamBlobImpl(already_AddRefed aInputStream,
const nsAString& aContentType,
uint64_t aLength);
- StreamBlobImpl(nsIInputStream* aInputStream,
+ StreamBlobImpl(already_AddRefed aInputStream,
const nsAString& aName,
const nsAString& aContentType,
int64_t aLastModifiedDate,
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/StringBlobImpl.h firefox-trunk-62.0~a1~hg20180620r423058/dom/file/StringBlobImpl.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/StringBlobImpl.h 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/StringBlobImpl.h 2018-06-20 17:29:06.000000000 +0000
@@ -37,6 +37,11 @@
return mData.Length();
}
+ size_t GetAllocationSize(FallibleTArray& aVisitedBlobImpls) const override
+ {
+ return GetAllocationSize();
+ }
+
private:
StringBlobImpl(const nsACString& aData, const nsAString& aContentType);
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/uri/BlobURLChannel.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/file/uri/BlobURLChannel.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/uri/BlobURLChannel.cpp 1970-01-01 00:00:00.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/uri/BlobURLChannel.cpp 2018-06-20 17:29:06.000000000 +0000
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "BlobURLChannel.h"
+
+using namespace mozilla::dom;
+
+BlobURLChannel::BlobURLChannel(nsIURI* aURI,
+ nsILoadInfo* aLoadInfo)
+ : mInitialized(false)
+{
+ SetURI(aURI);
+ SetOriginalURI(aURI);
+ SetLoadInfo(aLoadInfo);
+
+ // If we're sandboxed, make sure to clear any owner the channel
+ // might already have.
+ if (aLoadInfo && aLoadInfo->GetLoadingSandboxed()) {
+ SetOwner(nullptr);
+ }
+}
+
+BlobURLChannel::~BlobURLChannel() = default;
+
+void
+BlobURLChannel::InitFailed()
+{
+ MOZ_ASSERT(!mInitialized);
+ MOZ_ASSERT(!mInputStream);
+ mInitialized = true;
+}
+
+void
+BlobURLChannel::Initialize(BlobImpl* aBlobImpl)
+{
+ MOZ_ASSERT(!mInitialized);
+
+ nsAutoString contentType;
+ aBlobImpl->GetType(contentType);
+ SetContentType(NS_ConvertUTF16toUTF8(contentType));
+
+ if (aBlobImpl->IsFile()) {
+ nsString filename;
+ aBlobImpl->GetName(filename);
+ SetContentDispositionFilename(filename);
+ }
+
+ ErrorResult rv;
+ uint64_t size = aBlobImpl->GetSize(rv);
+ if (NS_WARN_IF(rv.Failed())) {
+ InitFailed();
+ return;
+ }
+
+ SetContentLength(size);
+
+ aBlobImpl->CreateInputStream(getter_AddRefs(mInputStream), rv);
+ if (NS_WARN_IF(rv.Failed())) {
+ InitFailed();
+ return;
+ }
+
+ MOZ_ASSERT(mInputStream);
+ mInitialized = true;
+}
+
+nsresult
+BlobURLChannel::OpenContentStream(bool aAsync, nsIInputStream** aResult,
+ nsIChannel** aChannel)
+{
+ MOZ_ASSERT(mInitialized);
+
+ if (!mInputStream) {
+ return NS_ERROR_MALFORMED_URI;
+ }
+
+ EnableSynthesizedProgressEvents(true);
+
+ nsCOMPtr stream = mInputStream;
+ stream.forget(aResult);
+
+ return NS_OK;
+}
+
+void
+BlobURLChannel::OnChannelDone()
+{
+ mInputStream = nullptr;
+}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/uri/BlobURLChannel.h firefox-trunk-62.0~a1~hg20180620r423058/dom/file/uri/BlobURLChannel.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/uri/BlobURLChannel.h 1970-01-01 00:00:00.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/uri/BlobURLChannel.h 2018-06-20 17:29:06.000000000 +0000
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_BlobURLChannel_h
+#define mozilla_dom_BlobURLChannel_h
+
+#include "nsBaseChannel.h"
+#include "nsCOMPtr.h"
+#include "nsIInputStream.h"
+
+class nsIURI;
+
+namespace mozilla {
+namespace dom {
+
+class BlobImpl;
+
+class BlobURLChannel final : public nsBaseChannel
+{
+public:
+ BlobURLChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo);
+
+ // This method is called when there is not a valid BlobImpl for this channel.
+ // This method will make ::OpenContentStream to return NS_ERROR_MALFORMED_URI.
+ void InitFailed();
+
+ // There is a valid BlobImpl for the channel. The blob's inputStream will be
+ // used when ::OpenContentStream is called.
+ void Initialize(BlobImpl* aBlobImpl);
+
+private:
+ ~BlobURLChannel();
+
+ nsresult OpenContentStream(bool aAsync, nsIInputStream** aResult,
+ nsIChannel** aChannel) override;
+
+ void OnChannelDone() override;
+
+ // If Initialize() is called, this will contain the blob's inputStream.
+ nsCOMPtr mInputStream;
+
+ // This boolean is used to check that InitFailed() or Initialize() are called
+ // just once.
+ bool mInitialized;
+};
+
+} // dom namespace
+} // mozilla namespace
+
+#endif /* mozilla_dom_BlobURLChannel_h */
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/uri/BlobURLProtocolHandler.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/file/uri/BlobURLProtocolHandler.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/uri/BlobURLProtocolHandler.cpp 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/uri/BlobURLProtocolHandler.cpp 2018-06-20 17:29:04.000000000 +0000
@@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "BlobURLProtocolHandler.h"
+#include "BlobURLChannel.h"
#include "mozilla/dom/BlobURL.h"
#include "mozilla/dom/ChromeUtils.h"
@@ -841,29 +842,34 @@
}
NS_IMETHODIMP
-BlobURLProtocolHandler::NewChannel2(nsIURI* uri,
+BlobURLProtocolHandler::NewChannel2(nsIURI* aURI,
nsILoadInfo* aLoadInfo,
- nsIChannel** result)
+ nsIChannel** aResult)
{
- *result = nullptr;
+ RefPtr channel = new BlobURLChannel(aURI, aLoadInfo);
- DataInfo* info = GetDataInfoFromURI(uri, true /*aAlsoIfRevoked */);
+ auto raii = MakeScopeExit([&] {
+ channel->InitFailed();
+ channel.forget(aResult);
+ });
+
+ DataInfo* info = GetDataInfoFromURI(aURI, true /*aAlsoIfRevoked */);
if (!info || info->mObjectType != DataInfo::eBlobImpl || !info->mBlobImpl) {
- return NS_ERROR_DOM_BAD_URI;
+ return NS_OK;
}
RefPtr blobImpl = info->mBlobImpl;
- nsCOMPtr uriPrinc = do_QueryInterface(uri);
+ nsCOMPtr uriPrinc = do_QueryInterface(aURI);
if (!uriPrinc) {
- return NS_ERROR_DOM_BAD_URI;
+ return NS_OK;
}
nsCOMPtr principal;
nsresult rv = uriPrinc->GetPrincipal(getter_AddRefs(principal));
- NS_ENSURE_SUCCESS(rv, rv);
+ NS_ENSURE_SUCCESS(rv, NS_OK);
if (!principal) {
- return NS_ERROR_DOM_BAD_URI;
+ return NS_OK;
}
MOZ_ASSERT(info->mPrincipal == principal);
@@ -881,47 +887,13 @@
!nsContentUtils::IsSystemPrincipal(aLoadInfo->LoadingPrincipal()) &&
!ChromeUtils::IsOriginAttributesEqualIgnoringFPD(aLoadInfo->GetOriginAttributes(),
BasePrincipal::Cast(principal)->OriginAttributesRef())) {
- return NS_ERROR_DOM_BAD_URI;
- }
-
- ErrorResult error;
- nsCOMPtr stream;
- blobImpl->CreateInputStream(getter_AddRefs(stream), error);
- if (NS_WARN_IF(error.Failed())) {
- return error.StealNSResult();
- }
-
- nsAutoString contentType;
- blobImpl->GetType(contentType);
-
- nsCOMPtr channel;
- rv = NS_NewInputStreamChannelInternal(getter_AddRefs(channel),
- uri,
- stream.forget(),
- NS_ConvertUTF16toUTF8(contentType),
- EmptyCString(), // aContentCharset
- aLoadInfo);
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
- }
-
- if (blobImpl->IsFile()) {
- nsString filename;
- blobImpl->GetName(filename);
- channel->SetContentDispositionFilename(filename);
- }
-
- uint64_t size = blobImpl->GetSize(error);
- if (NS_WARN_IF(error.Failed())) {
- return error.StealNSResult();
+ return NS_OK;
}
- channel->SetOriginalURI(uri);
- channel->SetContentType(NS_ConvertUTF16toUTF8(contentType));
- channel->SetContentLength(size);
-
- channel.forget(result);
+ raii.release();
+ channel->Initialize(blobImpl);
+ channel.forget(aResult);
return NS_OK;
}
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/file/uri/moz.build firefox-trunk-62.0~a1~hg20180620r423058/dom/file/uri/moz.build
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/file/uri/moz.build 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/file/uri/moz.build 2018-06-20 17:29:04.000000000 +0000
@@ -15,12 +15,14 @@
UNIFIED_SOURCES += [
'BlobURL.cpp',
+ 'BlobURLChannel.cpp',
'BlobURLProtocolHandler.cpp',
'FontTableURIProtocolHandler.cpp',
]
LOCAL_INCLUDES += [
'/dom/file',
+ '/netwerk/base',
]
include('/ipc/chromium/chromium-config.mozbuild')
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/filesystem/FileSystemTaskBase.h firefox-trunk-62.0~a1~hg20180620r423058/dom/filesystem/FileSystemTaskBase.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/filesystem/FileSystemTaskBase.h 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/filesystem/FileSystemTaskBase.h 2018-06-20 17:29:06.000000000 +0000
@@ -188,6 +188,7 @@
public:
FileSystemTaskParentBase()
: Runnable("FileSystemTaskParentBase")
+ , mErrorValue(NS_ERROR_NOT_INITIALIZED)
{}
/*
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/html/HTMLFieldSetElement.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/html/HTMLFieldSetElement.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/html/HTMLFieldSetElement.cpp 2018-06-11 13:02:12.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/html/HTMLFieldSetElement.cpp 2018-06-20 17:29:06.000000000 +0000
@@ -171,64 +171,6 @@
return rv;
}
-nsresult
-HTMLFieldSetElement::InsertChildAt_Deprecated(nsIContent* aChild,
- uint32_t aIndex,
- bool aNotify)
-{
- bool firstLegendHasChanged = false;
-
- if (aChild->IsHTMLElement(nsGkAtoms::legend)) {
- if (!mFirstLegend) {
- mFirstLegend = aChild;
- // We do not want to notify the first time mFirstElement is set.
- } else {
- // If mFirstLegend is before aIndex, we do not change it.
- // Otherwise, mFirstLegend is now aChild.
- if (int32_t(aIndex) <= ComputeIndexOf(mFirstLegend)) {
- mFirstLegend = aChild;
- firstLegendHasChanged = true;
- }
- }
- }
-
- nsresult rv =
- nsGenericHTMLFormElement::InsertChildAt_Deprecated(aChild, aIndex, aNotify);
- NS_ENSURE_SUCCESS(rv, rv);
-
- if (firstLegendHasChanged) {
- NotifyElementsForFirstLegendChange(aNotify);
- }
-
- return rv;
-}
-
-void
-HTMLFieldSetElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
-{
- bool firstLegendHasChanged = false;
-
- if (mFirstLegend && (GetChildAt_Deprecated(aIndex) == mFirstLegend)) {
- // If we are removing the first legend we have to found another one.
- nsIContent* child = mFirstLegend->GetNextSibling();
- mFirstLegend = nullptr;
- firstLegendHasChanged = true;
-
- for (; child; child = child->GetNextSibling()) {
- if (child->IsHTMLElement(nsGkAtoms::legend)) {
- mFirstLegend = child;
- break;
- }
- }
- }
-
- nsGenericHTMLFormElement::RemoveChildAt_Deprecated(aIndex, aNotify);
-
- if (firstLegendHasChanged) {
- NotifyElementsForFirstLegendChange(aNotify);
- }
-}
-
void
HTMLFieldSetElement::RemoveChildNode(nsIContent* aKid, bool aNotify)
{
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/html/HTMLFieldSetElement.h firefox-trunk-62.0~a1~hg20180620r423058/dom/html/HTMLFieldSetElement.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/html/HTMLFieldSetElement.h 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/html/HTMLFieldSetElement.h 2018-06-20 17:29:06.000000000 +0000
@@ -42,9 +42,6 @@
virtual nsresult InsertChildBefore(nsIContent* aChild, nsIContent* aBeforeThis,
bool aNotify) override;
- virtual nsresult InsertChildAt_Deprecated(nsIContent* aChild, uint32_t aIndex,
- bool aNotify) override;
- virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
// nsIFormControl
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/html/HTMLOptGroupElement.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/html/HTMLOptGroupElement.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/html/HTMLOptGroupElement.cpp 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/html/HTMLOptGroupElement.cpp 2018-06-20 17:29:06.000000000 +0000
@@ -86,28 +86,6 @@
return rv;
}
-nsresult
-HTMLOptGroupElement::InsertChildAt_Deprecated(nsIContent* aKid,
- uint32_t aIndex,
- bool aNotify)
-{
- SafeOptionListMutation safeMutation(GetSelect(), this, aKid, aIndex, aNotify);
- nsresult rv = nsGenericHTMLElement::InsertChildAt_Deprecated(aKid, aIndex,
- aNotify);
- if (NS_FAILED(rv)) {
- safeMutation.MutationFailed();
- }
- return rv;
-}
-
-void
-HTMLOptGroupElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
-{
- SafeOptionListMutation safeMutation(GetSelect(), this, nullptr, aIndex,
- aNotify);
- nsGenericHTMLElement::RemoveChildAt_Deprecated(aIndex, aNotify);
-}
-
void
HTMLOptGroupElement::RemoveChildNode(nsIContent* aKid, bool aNotify)
{
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/html/HTMLOptGroupElement.h firefox-trunk-62.0~a1~hg20180620r423058/dom/html/HTMLOptGroupElement.h
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/html/HTMLOptGroupElement.h 2018-06-11 13:02:12.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/html/HTMLOptGroupElement.h 2018-06-20 17:29:06.000000000 +0000
@@ -28,9 +28,6 @@
// nsINode
virtual nsresult InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
bool aNotify) override;
- virtual nsresult InsertChildAt_Deprecated(nsIContent* aKid, uint32_t aIndex,
- bool aNotify) override;
- virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
// nsIContent
diff -Nru firefox-trunk-62.0~a1~hg20180611r422292/dom/html/HTMLPictureElement.cpp firefox-trunk-62.0~a1~hg20180620r423058/dom/html/HTMLPictureElement.cpp
--- firefox-trunk-62.0~a1~hg20180611r422292/dom/html/HTMLPictureElement.cpp 2018-06-11 13:02:11.000000000 +0000
+++ firefox-trunk-62.0~a1~hg20180620r423058/dom/html/HTMLPictureElement.cpp 2018-06-20 17:29:04.000000000 +0000
@@ -31,32 +31,6 @@
NS_IMPL_ELEMENT_CLONE(HTMLPictureElement)
void
-HTMLPictureElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
-{
- nsCOMPtr child = GetChildAt_Deprecated(aIndex);
-
- if (child && child->IsHTMLElement(nsGkAtoms::img)) {
- HTMLImageElement* img = HTMLImageElement::FromNode(child);
- if (img) {
- img->PictureSourceRemoved(child->AsContent());
- }
- } else if (child && child->IsHTMLElement(nsGkAtoms::source)) {
- // Find all img siblings after this