diff --git a/CLOBBER b/CLOBBER
index e68767896ce..26559302515 100644
--- a/CLOBBER
+++ b/CLOBBER
@@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
-Bug 609976 needs a CLOBBER on Windows again.
+Bug 1087560 needs a CLOBBER to stop it from looking in the wrong place for tests
diff --git a/b2g/chrome/content/devtools/adb.js b/b2g/chrome/content/devtools/adb.js
index d3b0bf0caa2..f43bbd0ee47 100644
--- a/b2g/chrome/content/devtools/adb.js
+++ b/b2g/chrome/content/devtools/adb.js
@@ -155,9 +155,10 @@ let AdbController = {
// If USB Mass Storage, USB tethering, or a debug session is active,
// then we don't want to disable adb in an automatic fashion (i.e.
// when the screen locks or due to timeout).
- let sysUsbConfig = libcutils.property_get("sys.usb.config");
- let rndisActive = (sysUsbConfig.split(",").indexOf("rndis") >= 0);
- let usbFuncActive = rndisActive || this.umsActive || isDebugging;
+ let sysUsbConfig = libcutils.property_get("sys.usb.config").split(",");
+ let usbFuncActive = this.umsActive || isDebugging;
+ usbFuncActive |= (sysUsbConfig.indexOf("rndis") >= 0);
+ usbFuncActive |= (sysUsbConfig.indexOf("mtp") >= 0);
let enableAdb = this.remoteDebuggerEnabled &&
(!(this.lockEnabled && this.locked) || usbFuncActive);
@@ -216,7 +217,6 @@ let AdbController = {
}
}
}
-
};
SettingsListener.observe("lockscreen.locked", false,
diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml
index b1c5f6bcb6c..43fff13a4e2 100644
--- a/b2g/config/dolphin/sources.xml
+++ b/b2g/config/dolphin/sources.xml
@@ -15,7 +15,7 @@
-
+
@@ -133,7 +133,7 @@
-
+
diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml
index fbb221b3946..5619181784d 100644
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -19,7 +19,7 @@
-
+
diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml
index 6409b792c4b..bce96cdabfc 100644
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml
index 48574e1cd67..f3fff32a80e 100644
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml
index fbb221b3946..5619181784d 100644
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -19,7 +19,7 @@
-
+
diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml
index d52148218b5..dd353b374ec 100644
--- a/b2g/config/flame-kk/sources.xml
+++ b/b2g/config/flame-kk/sources.xml
@@ -15,7 +15,7 @@
-
+
@@ -132,7 +132,7 @@
-
+
diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml
index e77490b69e2..3cc788dad7d 100644
--- a/b2g/config/flame/sources.xml
+++ b/b2g/config/flame/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json
index 2ab9570b344..879b6a53fb5 100644
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
- "revision": "e7679f24177bc939b159dd075085352229a4b709",
+ "revision": "b508914e27b34f26949fddbe8963fde897ae2268",
"repo_path": "/integration/gaia-central"
}
diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml
index 8bc23ca745d..9f44a367c15 100644
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml
index 86807bd9c04..6d2c30828aa 100644
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml
index add87dee493..ec1f4f83794 100644
--- a/b2g/config/nexus-4/sources.xml
+++ b/b2g/config/nexus-4/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/b2g/config/tooltool-manifests/linux32/releng.manifest b/b2g/config/tooltool-manifests/linux32/releng.manifest
index 16995c46ece..581ff393b15 100644
--- a/b2g/config/tooltool-manifests/linux32/releng.manifest
+++ b/b2g/config/tooltool-manifests/linux32/releng.manifest
@@ -6,8 +6,8 @@
"filename": "setup.sh"
},
{
-"size": 168202,
-"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
+"size": 168320,
+"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
"algorithm": "sha512",
"filename": "sccache.tar.bz2"
},
diff --git a/b2g/config/tooltool-manifests/linux64/releng.manifest b/b2g/config/tooltool-manifests/linux64/releng.manifest
index 16995c46ece..581ff393b15 100644
--- a/b2g/config/tooltool-manifests/linux64/releng.manifest
+++ b/b2g/config/tooltool-manifests/linux64/releng.manifest
@@ -6,8 +6,8 @@
"filename": "setup.sh"
},
{
-"size": 168202,
-"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
+"size": 168320,
+"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
"algorithm": "sha512",
"filename": "sccache.tar.bz2"
},
diff --git a/b2g/config/tooltool-manifests/macosx64/releng.manifest b/b2g/config/tooltool-manifests/macosx64/releng.manifest
index 674d3da4633..5cc55098bcc 100644
--- a/b2g/config/tooltool-manifests/macosx64/releng.manifest
+++ b/b2g/config/tooltool-manifests/macosx64/releng.manifest
@@ -15,8 +15,8 @@
"filename": "clang.tar.bz2"
},
{
-"size": 168202,
-"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
+"size": 168320,
+"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
"algorithm": "sha512",
"filename": "sccache.tar.bz2"
},
diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml
index 5f2657d7177..ea1c29e9b88 100644
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/browser/config/tooltool-manifests/linux32/releng.manifest b/browser/config/tooltool-manifests/linux32/releng.manifest
index be45dbf1e95..7aefc5a5152 100644
--- a/browser/config/tooltool-manifests/linux32/releng.manifest
+++ b/browser/config/tooltool-manifests/linux32/releng.manifest
@@ -12,8 +12,8 @@
"filename": "gcc.tar.xz"
},
{
-"size": 168202,
-"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
+"size": 168320,
+"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
"algorithm": "sha512",
"filename": "sccache.tar.bz2"
}
diff --git a/browser/config/tooltool-manifests/linux64/releng.manifest b/browser/config/tooltool-manifests/linux64/releng.manifest
index be45dbf1e95..7aefc5a5152 100644
--- a/browser/config/tooltool-manifests/linux64/releng.manifest
+++ b/browser/config/tooltool-manifests/linux64/releng.manifest
@@ -12,8 +12,8 @@
"filename": "gcc.tar.xz"
},
{
-"size": 168202,
-"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
+"size": 168320,
+"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
"algorithm": "sha512",
"filename": "sccache.tar.bz2"
}
diff --git a/browser/config/tooltool-manifests/macosx64/releng.manifest b/browser/config/tooltool-manifests/macosx64/releng.manifest
index 3f5cad2fa44..3832e00feb1 100644
--- a/browser/config/tooltool-manifests/macosx64/releng.manifest
+++ b/browser/config/tooltool-manifests/macosx64/releng.manifest
@@ -15,8 +15,8 @@
"filename": "clang.tar.bz2"
},
{
-"size": 168202,
-"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
+"size": 168320,
+"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
"algorithm": "sha512",
"filename": "sccache.tar.bz2"
}
diff --git a/browser/config/tooltool-manifests/win32/releng.manifest b/browser/config/tooltool-manifests/win32/releng.manifest
index e5fd1071803..26d34e0e4ea 100644
--- a/browser/config/tooltool-manifests/win32/releng.manifest
+++ b/browser/config/tooltool-manifests/win32/releng.manifest
@@ -12,8 +12,8 @@
"filename": "setup.sh"
},
{
-"size": 168202,
-"digest": "5520f53fc10fcb569f235aff5c78ea5b69c878a8439b95aa758de2b83fc9f09bd4758c5fd701d84c58776386e210f3f30e5c9da6fdd8358d7dd371c764179339",
+"size": 168320,
+"digest": "c0f4a2da0b07ca6fc69290fbc5ed68f56c6b1ba4d593b220fd49b14ac4885e6ec949e695fd9a7ac464e0e86b652e99f6bd4af849fec072264b29a8f9686d2fc4",
"algorithm": "sha512",
"filename": "sccache.tar.bz2"
}
diff --git a/browser/devtools/webconsole/test/browser_console_variables_view_dont_sort_non_sortable_classes_properties.js b/browser/devtools/webconsole/test/browser_console_variables_view_dont_sort_non_sortable_classes_properties.js
index a495f7bf1e9..ed80e16d768 100644
--- a/browser/devtools/webconsole/test/browser_console_variables_view_dont_sort_non_sortable_classes_properties.js
+++ b/browser/devtools/webconsole/test/browser_console_variables_view_dont_sort_non_sortable_classes_properties.js
@@ -57,7 +57,7 @@ function test() {
// Create an ArrayBuffer of 80 bytes to test TypedArrays. 80 bytes is
// enough to get 10 items in all different TypedArrays.
- jsterm.execute("let buf = ArrayBuffer(80);");
+ jsterm.execute("let buf = new ArrayBuffer(80);");
// Array
yield testNotSorted("Array(0,1,2,3,4,5,6,7,8,9,10)");
@@ -66,7 +66,7 @@ function test() {
// Typed arrays.
for (let type of typedArrayTypes) {
- yield testNotSorted(type + "(buf)");
+ yield testNotSorted("new " + type + "(buf)");
}
}
diff --git a/browser/metro/base/content/browser.js b/browser/metro/base/content/browser.js
index 0382d4e9707..cd4296d9ad8 100644
--- a/browser/metro/base/content/browser.js
+++ b/browser/metro/base/content/browser.js
@@ -1477,9 +1477,6 @@ Tab.prototype = {
// stop about:blank from loading
browser.stop();
- let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
- fl.renderMode = Ci.nsIFrameLoader.RENDER_MODE_ASYNC_SCROLL;
-
return browser;
},
diff --git a/config/external/nss/nss.def b/config/external/nss/nss.def
index 9480229e9f6..8d318d53af3 100644
--- a/config/external/nss/nss.def
+++ b/config/external/nss/nss.def
@@ -146,7 +146,6 @@ CERT_StartCertificateRequestAttributes
CERT_SubjectPublicKeyInfoTemplate DATA
CERT_TimeChoiceTemplate DATA
CERT_VerifyCertificate
-CERT_VerifyCertName
CERT_VerifySignedDataWithPublicKeyInfo
DER_AsciiToTime_Util
DER_DecodeTimeChoice_Util
diff --git a/content/base/public/Element.h b/content/base/public/Element.h
index 2367f3b012a..122274a8165 100644
--- a/content/base/public/Element.h
+++ b/content/base/public/Element.h
@@ -23,7 +23,6 @@
#include "nsAttrAndChildArray.h"
#include "mozFlushType.h"
#include "nsDOMAttributeMap.h"
-#include "nsIDOMXPathNSResolver.h"
#include "nsPresContext.h"
#include "mozilla/CORSMode.h"
#include "mozilla/Attributes.h"
diff --git a/content/base/public/FragmentOrElement.h b/content/base/public/FragmentOrElement.h
index 95c7299a697..503c05d0436 100644
--- a/content/base/public/FragmentOrElement.h
+++ b/content/base/public/FragmentOrElement.h
@@ -17,7 +17,6 @@
#include "nsAttrAndChildArray.h" // member
#include "nsCycleCollectionParticipant.h" // NS_DECL_CYCLE_*
#include "nsIContent.h" // base class
-#include "nsIDOMXPathNSResolver.h" // base class
#include "nsINodeList.h" // base class
#include "nsIWeakReference.h" // base class
#include "nsNodeUtils.h" // class member nsNodeUtils::CloneNodeImpl
@@ -83,29 +82,6 @@ private:
nsINode* mNode;
};
-/**
- * A tearoff class for FragmentOrElement to implement additional interfaces
- */
-class nsNode3Tearoff : public nsIDOMXPathNSResolver
-{
-public:
- NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-
- NS_DECL_CYCLE_COLLECTION_CLASS(nsNode3Tearoff)
-
- NS_DECL_NSIDOMXPATHNSRESOLVER
-
- explicit nsNode3Tearoff(nsINode *aNode) : mNode(aNode)
- {
- }
-
-protected:
- virtual ~nsNode3Tearoff() {}
-
-private:
- nsCOMPtr mNode;
-};
-
/**
* A class that implements nsIWeakReference
*/
diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h
index cf7820b5151..8cef1259ab4 100644
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -50,7 +50,6 @@ class nsIDOMDocumentType;
class nsIDOMElement;
class nsIDOMNodeFilter;
class nsIDOMNodeList;
-class nsIDOMXPathNSResolver;
class nsIHTMLCollection;
class nsILayoutHistoryState;
class nsILoadContext;
@@ -125,6 +124,7 @@ class TreeWalker;
class UndoManager;
class XPathEvaluator;
class XPathExpression;
+class XPathNSResolver;
class XPathResult;
template class OwningNonNull;
template class Sequence;
@@ -135,8 +135,8 @@ typedef CallbackObjectHolder NodeFilterHolder;
} // namespace mozilla
#define NS_IDOCUMENT_IID \
-{ 0x42a263db, 0x6ac6, 0x40ff, \
- { 0x89, 0xe2, 0x25, 0x12, 0xe4, 0xbc, 0x2d, 0x2d } }
+{ 0xbab5b447, 0x7e23, 0x4cdd, \
+ { 0xac, 0xe5, 0xaa, 0x04, 0x26, 0x87, 0x2b, 0x97 } }
// Enum for requesting a particular type of document when creating a doc
enum DocumentFlavor {
@@ -2318,13 +2318,12 @@ public:
void LoadBindingDocument(const nsAString& aURI, mozilla::ErrorResult& rv);
mozilla::dom::XPathExpression*
CreateExpression(const nsAString& aExpression,
- nsIDOMXPathNSResolver* aResolver,
+ mozilla::dom::XPathNSResolver* aResolver,
mozilla::ErrorResult& rv);
- already_AddRefed
- CreateNSResolver(nsINode* aNodeResolver, mozilla::ErrorResult& rv);
+ nsINode* CreateNSResolver(nsINode& aNodeResolver);
already_AddRefed
Evaluate(JSContext* aCx, const nsAString& aExpression, nsINode* aContextNode,
- nsIDOMXPathNSResolver* aResolver, uint16_t aType,
+ mozilla::dom::XPathNSResolver* aResolver, uint16_t aType,
JS::Handle aResult, mozilla::ErrorResult& rv);
// Touch event handlers already on nsINode
already_AddRefed
diff --git a/content/base/public/nsIFrameLoader.idl b/content/base/public/nsIFrameLoader.idl
index e3ed0363f3d..beff6e1e66c 100644
--- a/content/base/public/nsIFrameLoader.idl
+++ b/content/base/public/nsIFrameLoader.idl
@@ -16,7 +16,7 @@ interface nsIDOMElement;
interface nsITabParent;
interface nsILoadContext;
-[scriptable, builtinclass, uuid(55a772b8-855a-4c5f-b4a1-284b6b3bec28)]
+[scriptable, builtinclass, uuid(7600aa92-88dc-491c-896d-0564159b6a66)]
interface nsIFrameLoader : nsISupports
{
/**
@@ -116,24 +116,6 @@ interface nsIFrameLoader : nsISupports
*/
void requestNotifyAfterRemotePaint();
- /**
- * The default rendering mode is synchronous scrolling. In this
- * mode, it's an error to try to set a target viewport.
- */
- const unsigned long RENDER_MODE_DEFAULT = 0x00000000;
-
- /**
- * When asynchronous scrolling is enabled, a target viewport can be
- * set to transform content pixels wrt its CSS viewport.
- *
- * NB: when async scrolling is enabled, it's the *user's*
- * responsibility to update the target scroll offset. In effect,
- * the platform hands over control of scroll offset to the user.
- */
- const unsigned long RENDER_MODE_ASYNC_SCROLL = 0x00000001;
-
- attribute unsigned long renderMode;
-
/**
* The default event mode automatically forwards the events
* handled in EventStateManager::HandleCrossProcessEvent to
diff --git a/content/base/src/Attr.cpp b/content/base/src/Attr.cpp
index b1f92f06eef..f7ad7fef09d 100644
--- a/content/base/src/Attr.cpp
+++ b/content/base/src/Attr.cpp
@@ -106,8 +106,6 @@ NS_INTERFACE_TABLE_HEAD(Attr)
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(Attr)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
new nsNodeSupportsWeakRefTearoff(this))
- NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
- new nsNode3Tearoff(this))
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(Attr)
diff --git a/content/base/src/FragmentOrElement.cpp b/content/base/src/FragmentOrElement.cpp
index 28ea1d5e908..03ba04286e3 100644
--- a/content/base/src/FragmentOrElement.cpp
+++ b/content/base/src/FragmentOrElement.cpp
@@ -448,23 +448,6 @@ nsChildContentList::IndexOf(nsIContent* aContent)
//----------------------------------------------------------------------
-NS_IMPL_CYCLE_COLLECTION(nsNode3Tearoff, mNode)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsNode3Tearoff)
- NS_INTERFACE_MAP_ENTRY(nsIDOMXPathNSResolver)
-NS_INTERFACE_MAP_END_AGGREGATED(mNode)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsNode3Tearoff)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsNode3Tearoff)
-
-NS_IMETHODIMP
-nsNode3Tearoff::LookupNamespaceURI(const nsAString& aNamespacePrefix,
- nsAString& aNamespaceURI)
-{
- mNode->LookupNamespaceURI(aNamespacePrefix, aNamespaceURI);
- return NS_OK;
-}
-
nsIHTMLCollection*
FragmentOrElement::Children()
{
@@ -1962,8 +1945,6 @@ NS_INTERFACE_MAP_BEGIN(FragmentOrElement)
NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
new nsNodeSupportsWeakRefTearoff(this))
- NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
- new nsNode3Tearoff(this))
// DOM bindings depend on the identity pointer being the
// same as nsINode (which nsIContent inherits).
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp
index 57cc4b98128..444dc029832 100644
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -99,7 +99,6 @@
#include "nsBidiUtils.h"
-#include "nsIDOMXPathNSResolver.h"
#include "nsIParserService.h"
#include "nsContentCreatorFunctions.h"
@@ -210,6 +209,7 @@
#include "nsISecurityConsoleMessage.h"
#include "nsCharSeparatedTokenizer.h"
#include "mozilla/dom/XPathEvaluator.h"
+#include "mozilla/dom/XPathNSResolverBinding.h"
#include "mozilla/dom/XPathResult.h"
#include "nsIDocumentEncoder.h"
#include "nsIDocumentActivity.h"
@@ -1778,8 +1778,6 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMXPathEvaluator)
NS_INTERFACE_TABLE_END
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsDocument)
- NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
- new nsNode3Tearoff(this))
NS_INTERFACE_MAP_END
@@ -12314,22 +12312,21 @@ nsIDocument::Constructor(const GlobalObject& aGlobal,
XPathExpression*
nsIDocument::CreateExpression(const nsAString& aExpression,
- nsIDOMXPathNSResolver* aResolver,
+ XPathNSResolver* aResolver,
ErrorResult& rv)
{
return XPathEvaluator()->CreateExpression(aExpression, aResolver, rv);
}
-already_AddRefed
-nsIDocument::CreateNSResolver(nsINode* aNodeResolver,
- ErrorResult& rv)
+nsINode*
+nsIDocument::CreateNSResolver(nsINode& aNodeResolver)
{
- return XPathEvaluator()->CreateNSResolver(aNodeResolver, rv);
+ return XPathEvaluator()->CreateNSResolver(aNodeResolver);
}
already_AddRefed
nsIDocument::Evaluate(JSContext* aCx, const nsAString& aExpression,
- nsINode* aContextNode, nsIDOMXPathNSResolver* aResolver,
+ nsINode* aContextNode, XPathNSResolver* aResolver,
uint16_t aType, JS::Handle aResult,
ErrorResult& rv)
{
@@ -12337,16 +12334,9 @@ nsIDocument::Evaluate(JSContext* aCx, const nsAString& aExpression,
aType, aResult, rv);
}
-NS_IMETHODIMP
-nsDocument::CreateNSResolver(nsIDOMNode* aNodeResolver,
- nsIDOMXPathNSResolver** aResult)
-{
- return XPathEvaluator()->CreateNSResolver(aNodeResolver, aResult);
-}
-
NS_IMETHODIMP
nsDocument::Evaluate(const nsAString& aExpression, nsIDOMNode* aContextNode,
- nsIDOMXPathNSResolver* aResolver, uint16_t aType,
+ nsIDOMNode* aResolver, uint16_t aType,
nsISupports* aInResult, nsISupports** aResult)
{
return XPathEvaluator()->Evaluate(aExpression, aContextNode, aResolver, aType,
diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h
index 3a9f8a3deab..f94e3be55e4 100644
--- a/content/base/src/nsDocument.h
+++ b/content/base/src/nsDocument.h
@@ -50,7 +50,6 @@
#include "nsAttrAndChildArray.h"
#include "nsDOMAttributeMap.h"
#include "nsIContentViewer.h"
-#include "nsIDOMXPathNSResolver.h"
#include "nsIInterfaceRequestor.h"
#include "nsILoadContext.h"
#include "nsIProgressEventSink.h"
diff --git a/content/base/src/nsFrameLoader.cpp b/content/base/src/nsFrameLoader.cpp
index 6589f87a949..ec811a5341a 100644
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -171,7 +171,6 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, bool aNetworkCreated)
, mCurrentRemoteFrame(nullptr)
, mRemoteBrowser(nullptr)
, mChildID(0)
- , mRenderMode(RENDER_MODE_DEFAULT)
, mEventMode(EVENT_MODE_NORMAL_DISPATCH)
, mPendingFrameSent(false)
{
@@ -1952,24 +1951,6 @@ nsFrameLoader::UpdateBaseWindowPositionAndSize(nsSubDocumentFrame *aIFrame)
return NS_OK;
}
-NS_IMETHODIMP
-nsFrameLoader::GetRenderMode(uint32_t* aRenderMode)
-{
- *aRenderMode = mRenderMode;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsFrameLoader::SetRenderMode(uint32_t aRenderMode)
-{
- if (aRenderMode == mRenderMode) {
- return NS_OK;
- }
-
- mRenderMode = aRenderMode;
- return NS_OK;
-}
-
NS_IMETHODIMP
nsFrameLoader::GetEventMode(uint32_t* aEventMode)
{
diff --git a/content/base/src/nsFrameLoader.h b/content/base/src/nsFrameLoader.h
index f8a4fbe7e67..530b9af76d3 100644
--- a/content/base/src/nsFrameLoader.h
+++ b/content/base/src/nsFrameLoader.h
@@ -69,11 +69,6 @@ protected:
~nsFrameLoader();
public:
- bool AsyncScrollEnabled() const
- {
- return !!(mRenderMode & RENDER_MODE_ASYNC_SCROLL);
- }
-
static nsFrameLoader* Create(mozilla::dom::Element* aOwner,
bool aNetworkCreated);
@@ -367,11 +362,6 @@ private:
TabParent* mRemoteBrowser;
uint64_t mChildID;
- // See nsIFrameLoader.idl. Short story, if !(mRenderMode &
- // RENDER_MODE_ASYNC_SCROLL), all the fields below are ignored in
- // favor of what content tells.
- uint32_t mRenderMode;
-
// See nsIFrameLoader.idl. EVENT_MODE_NORMAL_DISPATCH automatically
// forwards some input events to out-of-process content.
uint32_t mEventMode;
diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp
index 1d5fd44e7d8..81a28839c3e 100644
--- a/content/base/src/nsGenericDOMDataNode.cpp
+++ b/content/base/src/nsGenericDOMDataNode.cpp
@@ -130,8 +130,6 @@ NS_INTERFACE_MAP_BEGIN(nsGenericDOMDataNode)
NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
new nsNodeSupportsWeakRefTearoff(this))
- NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMXPathNSResolver,
- new nsNode3Tearoff(this))
// DOM bindings depend on the identity pointer being the
// same as nsINode (which nsIContent inherits).
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
diff --git a/content/base/test/chrome/test_bug429785.xul b/content/base/test/chrome/test_bug429785.xul
index 2e28cae7f4f..5d8af4555b9 100644
--- a/content/base/test/chrome/test_bug429785.xul
+++ b/content/base/test/chrome/test_bug429785.xul
@@ -22,7 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429785
const serv = Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService);
var listener = {
- QueryInteface : function(iid) {
+ QueryInterface : function(iid) {
if (!iid.equals(Components.interfaces.nsISupports) &&
!iid.equals(Components.interfaces.nsIConsoleListener)) {
throw Components.results.NS_NOINTERFACE;
diff --git a/content/base/test/file_bug1008126_worker.js b/content/base/test/file_bug1008126_worker.js
index 0c650386c29..ded719bbef3 100644
--- a/content/base/test/file_bug1008126_worker.js
+++ b/content/base/test/file_bug1008126_worker.js
@@ -31,7 +31,7 @@ function checkData(xhr, data, mapped, cb) {
ok(ct.indexOf("mem-mapped") == -1, "Data is not memory-mapped");
}
ok(xhr.response, "Data is non-null");
- var str = String.fromCharCode.apply(null, Uint8Array(xhr.response));
+ var str = String.fromCharCode.apply(null, new Uint8Array(xhr.response));
ok(str == data, "Data is correct");
cb();
}
diff --git a/content/base/test/file_bug945152_worker.js b/content/base/test/file_bug945152_worker.js
index c0520bbd83a..84f87a9153f 100644
--- a/content/base/test/file_bug945152_worker.js
+++ b/content/base/test/file_bug945152_worker.js
@@ -18,7 +18,7 @@ function is(a, b, msg) {
function checkData(response, data_head, cb) {
ok(response, "Data is non-null");
- var str = String.fromCharCode.apply(null, Uint8Array(response));
+ var str = String.fromCharCode.apply(null, new Uint8Array(response));
ok(str.length == data_head.length + gPaddingSize, "Data size is correct");
ok(str.slice(0, data_head.length) == data_head, "Data head is correct");
ok(str.slice(data_head.length) == gPadding, "Data padding is correct");
diff --git a/content/media/gmp/GMPChild.cpp b/content/media/gmp/GMPChild.cpp
index 01010c44892..29f1d8d4585 100644
--- a/content/media/gmp/GMPChild.cpp
+++ b/content/media/gmp/GMPChild.cpp
@@ -228,7 +228,7 @@ GetAppPaths(nsCString &aAppPath, nsCString &aAppBinaryPath)
}
void
-GMPChild::OnChannelConnected(int32_t aPid)
+GMPChild::StartMacSandbox()
{
nsAutoCString pluginDirectoryPath, pluginFilePath;
if (!GetPluginPaths(mPluginPath, pluginDirectoryPath, pluginFilePath)) {
@@ -253,13 +253,6 @@ GMPChild::OnChannelConnected(int32_t aPid)
NS_WARNING(err.get());
MOZ_CRASH("sandbox_init() failed");
}
-
- if (!LoadPluginLibrary(mPluginPath)) {
- err.AppendPrintf("Failed to load GMP plugin \"%s\"",
- mPluginPath.c_str());
- NS_WARNING(err.get());
- MOZ_CRASH("Failed to load GMP plugin");
- }
}
#endif // XP_MACOSX && MOZ_GMP_SANDBOX
@@ -332,6 +325,8 @@ GMPChild::RecvStartPlugin()
#if defined(MOZ_SANDBOX) && defined(XP_WIN)
mozilla::SandboxTarget::Instance()->StartSandbox();
+#elif defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
+ StartMacSandbox();
#endif
return LoadPluginLibrary(mPluginPath);
diff --git a/content/media/gmp/GMPChild.h b/content/media/gmp/GMPChild.h
index f969d9764ea..e6e1da98902 100644
--- a/content/media/gmp/GMPChild.h
+++ b/content/media/gmp/GMPChild.h
@@ -25,10 +25,6 @@ public:
GMPChild();
virtual ~GMPChild();
-#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
- void OnChannelConnected(int32_t aPid);
-#endif
-
bool Init(const std::string& aPluginPath,
base::ProcessHandle aParentProcessHandle,
MessageLoop* aIOLoop,
@@ -51,6 +47,10 @@ public:
private:
+#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
+ void StartMacSandbox();
+#endif
+
virtual bool RecvSetNodeId(const nsCString& aNodeId) MOZ_OVERRIDE;
virtual bool RecvStartPlugin() MOZ_OVERRIDE;
diff --git a/content/media/gtest/TestMP4Reader.cpp b/content/media/gtest/TestMP4Reader.cpp
index 17c93cea7e9..7217194a85b 100644
--- a/content/media/gtest/TestMP4Reader.cpp
+++ b/content/media/gtest/TestMP4Reader.cpp
@@ -11,7 +11,6 @@
#include "MockMediaDecoderOwner.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/TimeRanges.h"
-#include "mtransport/runnable_utils.h"
using namespace mozilla;
using namespace mozilla::dom;
@@ -19,6 +18,8 @@ using namespace mozilla::dom;
class TestBinding
{
public:
+ NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TestBinding);
+
nsRefPtr decoder;
nsRefPtr resource;
nsRefPtr reader;
@@ -35,14 +36,17 @@ public:
decoder->SetResource(resource);
reader->Init(nullptr);
+ }
+ void Init() {
nsCOMPtr thread;
nsresult rv = NS_NewThread(getter_AddRefs(thread),
- WrapRunnable(this, &TestBinding::ReadMetadata));
+ NS_NewRunnableMethod(this, &TestBinding::ReadMetadata));
EXPECT_EQ(NS_OK, rv);
thread->Shutdown();
}
+private:
virtual ~TestBinding()
{
decoder = nullptr;
@@ -51,7 +55,6 @@ public:
SharedThreadPool::SpinUntilShutdown();
}
-private:
void ReadMetadata()
{
MediaInfo info;
@@ -62,13 +65,14 @@ private:
TEST(MP4Reader, BufferedRange)
{
- TestBinding b;
+ nsRefPtr b = new TestBinding();
+ b->Init();
// Video 3-4 sec, audio 2.986666-4.010666 sec
- b.resource->MockAddBufferedRange(248400, 327455);
+ b->resource->MockAddBufferedRange(248400, 327455);
nsRefPtr ranges = new TimeRanges();
- EXPECT_EQ(NS_OK, b.reader->GetBuffered(ranges, 0));
+ EXPECT_EQ(NS_OK, b->reader->GetBuffered(ranges, 0));
EXPECT_EQ(1U, ranges->Length());
double start = 0;
EXPECT_EQ(NS_OK, ranges->Start(0, &start));
@@ -80,15 +84,16 @@ TEST(MP4Reader, BufferedRange)
TEST(MP4Reader, BufferedRangeMissingLastByte)
{
- TestBinding b;
+ nsRefPtr b = new TestBinding();
+ b->Init();
// Dropping the last byte of the video
- b.resource->MockClearBufferedRanges();
- b.resource->MockAddBufferedRange(248400, 324912);
- b.resource->MockAddBufferedRange(324913, 327455);
+ b->resource->MockClearBufferedRanges();
+ b->resource->MockAddBufferedRange(248400, 324912);
+ b->resource->MockAddBufferedRange(324913, 327455);
nsRefPtr ranges = new TimeRanges();
- EXPECT_EQ(NS_OK, b.reader->GetBuffered(ranges, 0));
+ EXPECT_EQ(NS_OK, b->reader->GetBuffered(ranges, 0));
EXPECT_EQ(1U, ranges->Length());
double start = 0;
EXPECT_EQ(NS_OK, ranges->Start(0, &start));
@@ -100,15 +105,16 @@ TEST(MP4Reader, BufferedRangeMissingLastByte)
TEST(MP4Reader, BufferedRangeSyncFrame)
{
- TestBinding b;
+ nsRefPtr b = new TestBinding();
+ b->Init();
// Check that missing the first byte at 2 seconds skips right through to 3
// seconds because of a missing sync frame
- b.resource->MockClearBufferedRanges();
- b.resource->MockAddBufferedRange(146336, 327455);
+ b->resource->MockClearBufferedRanges();
+ b->resource->MockAddBufferedRange(146336, 327455);
nsRefPtr ranges = new TimeRanges();
- EXPECT_EQ(NS_OK, b.reader->GetBuffered(ranges, 0));
+ EXPECT_EQ(NS_OK, b->reader->GetBuffered(ranges, 0));
EXPECT_EQ(1U, ranges->Length());
double start = 0;
EXPECT_EQ(NS_OK, ranges->Start(0, &start));
@@ -120,7 +126,8 @@ TEST(MP4Reader, BufferedRangeSyncFrame)
TEST(MP4Reader, CompositionOrder)
{
- TestBinding b("mediasource_test.mp4");
+ nsRefPtr b = new TestBinding("mediasource_test.mp4");
+ b->Init();
// The first 5 video samples of this file are:
// Video timescale=2500
@@ -145,27 +152,27 @@ TEST(MP4Reader, CompositionOrder)
// 10 12616 580 9226 1015 Yes
// 11 13220 581 10241 1014 Yes
- b.resource->MockClearBufferedRanges();
+ b->resource->MockClearBufferedRanges();
// First two frames in decoding + first audio frame
- b.resource->MockAddBufferedRange(48, 5503); // Video 1
- b.resource->MockAddBufferedRange(5503, 5648); // Video 2
- b.resource->MockAddBufferedRange(6228, 6803); // Video 3
+ b->resource->MockAddBufferedRange(48, 5503); // Video 1
+ b->resource->MockAddBufferedRange(5503, 5648); // Video 2
+ b->resource->MockAddBufferedRange(6228, 6803); // Video 3
// Audio - 5 frames; 0 - 139206 us
- b.resource->MockAddBufferedRange(5648, 6228);
- b.resource->MockAddBufferedRange(6803, 7383);
- b.resource->MockAddBufferedRange(7618, 8199);
- b.resource->MockAddBufferedRange(8199, 8779);
- b.resource->MockAddBufferedRange(8962, 9563);
- b.resource->MockAddBufferedRange(9734, 10314);
- b.resource->MockAddBufferedRange(10314, 10895);
- b.resource->MockAddBufferedRange(11207, 11787);
- b.resource->MockAddBufferedRange(12035, 12616);
- b.resource->MockAddBufferedRange(12616, 13196);
- b.resource->MockAddBufferedRange(13220, 13901);
+ b->resource->MockAddBufferedRange(5648, 6228);
+ b->resource->MockAddBufferedRange(6803, 7383);
+ b->resource->MockAddBufferedRange(7618, 8199);
+ b->resource->MockAddBufferedRange(8199, 8779);
+ b->resource->MockAddBufferedRange(8962, 9563);
+ b->resource->MockAddBufferedRange(9734, 10314);
+ b->resource->MockAddBufferedRange(10314, 10895);
+ b->resource->MockAddBufferedRange(11207, 11787);
+ b->resource->MockAddBufferedRange(12035, 12616);
+ b->resource->MockAddBufferedRange(12616, 13196);
+ b->resource->MockAddBufferedRange(13220, 13901);
nsRefPtr ranges = new TimeRanges();
- EXPECT_EQ(NS_OK, b.reader->GetBuffered(ranges, 0));
+ EXPECT_EQ(NS_OK, b->reader->GetBuffered(ranges, 0));
EXPECT_EQ(2U, ranges->Length());
double start = 0;
@@ -185,7 +192,8 @@ TEST(MP4Reader, CompositionOrder)
TEST(MP4Reader, Normalised)
{
- TestBinding b("mediasource_test.mp4");
+ nsRefPtr b = new TestBinding("mediasource_test.mp4");
+ b->Init();
// The first 5 video samples of this file are:
// Video timescale=2500
@@ -210,11 +218,11 @@ TEST(MP4Reader, Normalised)
// 10 12616 580 9226 1015 Yes
// 11 13220 581 10241 1014 Yes
- b.resource->MockClearBufferedRanges();
- b.resource->MockAddBufferedRange(48, 13901);
+ b->resource->MockClearBufferedRanges();
+ b->resource->MockAddBufferedRange(48, 13901);
nsRefPtr ranges = new TimeRanges();
- EXPECT_EQ(NS_OK, b.reader->GetBuffered(ranges, 0));
+ EXPECT_EQ(NS_OK, b->reader->GetBuffered(ranges, 0));
EXPECT_EQ(1U, ranges->Length());
double start = 0;
diff --git a/content/media/test/test_encryptedMediaExtensions.html b/content/media/test/test_encryptedMediaExtensions.html
index deac125c86f..db51d655478 100644
--- a/content/media/test/test_encryptedMediaExtensions.html
+++ b/content/media/test/test_encryptedMediaExtensions.html
@@ -27,7 +27,7 @@ function bail(message)
function ArrayBufferToString(arr)
{
var str = '';
- var view = Uint8Array(arr);
+ var view = new Uint8Array(arr);
for (var i = 0; i < view.length; i++) {
str += String.fromCharCode(view[i]);
}
@@ -36,8 +36,8 @@ function ArrayBufferToString(arr)
function StringToArrayBuffer(str)
{
- var arr = ArrayBuffer(str.length);
- var view = Uint8Array(arr);
+ var arr = new ArrayBuffer(str.length);
+ var view = new Uint8Array(arr);
for (var i = 0; i < str.length; i++) {
view[i] = str.charCodeAt(i);
}
diff --git a/content/xul/templates/src/nsXULTemplateQueryProcessorXML.cpp b/content/xul/templates/src/nsXULTemplateQueryProcessorXML.cpp
index 0b3fc8fff77..ef5c2d4c9f8 100644
--- a/content/xul/templates/src/nsXULTemplateQueryProcessorXML.cpp
+++ b/content/xul/templates/src/nsXULTemplateQueryProcessorXML.cpp
@@ -9,7 +9,6 @@
#include "nsIDOMNode.h"
#include "nsIDOMElement.h"
#include "nsIDOMEvent.h"
-#include "nsIDOMXPathNSResolver.h"
#include "nsIDocument.h"
#include "nsIContent.h"
#include "nsComponentManagerUtils.h"
@@ -428,13 +427,7 @@ nsXULTemplateQueryProcessorXML::CreateExpression(const nsAString& aExpr,
nsINode* aNode,
ErrorResult& aRv)
{
- nsCOMPtr nsResolver =
- aNode->OwnerDoc()->CreateNSResolver(aNode, aRv);
- if (aRv.Failed()) {
- return nullptr;
- }
-
- return mEvaluator->CreateExpression(aExpr, nsResolver, aRv);
+ return mEvaluator->CreateExpression(aExpr, aNode, aRv);
}
NS_IMETHODIMP
diff --git a/dom/apps/AppsUtils.jsm b/dom/apps/AppsUtils.jsm
index c8726007852..42de1eba3ff 100644
--- a/dom/apps/AppsUtils.jsm
+++ b/dom/apps/AppsUtils.jsm
@@ -107,6 +107,7 @@ function _setAppProperties(aObj, aApp) {
aObj.redirects = aApp.redirects;
aObj.widgetPages = aApp.widgetPages || [];
aObj.kind = aApp.kind;
+ aObj.enabled = aApp.enabled !== undefined ? aApp.enabled : true;
}
this.AppsUtils = {
diff --git a/dom/apps/Webapps.js b/dom/apps/Webapps.js
index caff74e9ecf..7058dff3cbb 100644
--- a/dom/apps/Webapps.js
+++ b/dom/apps/Webapps.js
@@ -424,6 +424,10 @@ WebappsApplication.prototype = {
return new this._window.DOMError(this._proxy.downloadError);
},
+ get enabled() {
+ return this._proxy.enabled;
+ },
+
download: function() {
cpmm.sendAsyncMessage("Webapps:Download",
{ manifestURL: this.manifestURL });
@@ -613,7 +617,7 @@ WebappsApplication.prototype = {
case "Webapps:Launch:Return:KO":
this.removeMessageListeners(["Webapps:Launch:Return:OK",
"Webapps:Launch:Return:KO"]);
- Services.DOMRequest.fireError(req, "APP_INSTALL_PENDING");
+ Services.DOMRequest.fireError(req, msg.error);
break;
case "Webapps:Launch:Return:OK":
this.removeMessageListeners(["Webapps:Launch:Return:OK",
@@ -722,12 +726,14 @@ WebappsApplicationMgmt.prototype = {
"Webapps:Install:Return:OK",
"Webapps:GetNotInstalled:Return:OK",
"Webapps:Import:Return",
- "Webapps:ExtractManifest:Return"]);
+ "Webapps:ExtractManifest:Return",
+ "Webapps:SetEnabled:Return"]);
cpmm.sendAsyncMessage("Webapps:RegisterForMessages",
{
messages: ["Webapps:Install:Return:OK",
"Webapps:Uninstall:Return:OK",
- "Webapps:Uninstall:Broadcast:Return:OK"]
+ "Webapps:Uninstall:Broadcast:Return:OK",
+ "Webapps:SetEnabled:Return"]
}
);
},
@@ -736,7 +742,8 @@ WebappsApplicationMgmt.prototype = {
cpmm.sendAsyncMessage("Webapps:UnregisterForMessages",
["Webapps:Install:Return:OK",
"Webapps:Uninstall:Return:OK",
- "Webapps:Uninstall:Broadcast:Return:OK"]);
+ "Webapps:Uninstall:Broadcast:Return:OK",
+ "Webapps:SetEnabled:Return"]);
},
applyDownload: function(aApp) {
@@ -804,6 +811,12 @@ WebappsApplicationMgmt.prototype = {
});
},
+ setEnabled: function(aApp, aValue) {
+ cpmm.sendAsyncMessage("Webapps:SetEnabled",
+ { manifestURL: aApp.manifestURL,
+ enabled: aValue });
+ },
+
get oninstall() {
return this.__DOM_IMPL__.getEventHandler("oninstall");
},
@@ -812,6 +825,10 @@ WebappsApplicationMgmt.prototype = {
return this.__DOM_IMPL__.getEventHandler("onuninstall");
},
+ get onenabledstatechange() {
+ return this.__DOM_IMPL__.getEventHandler("onenabledstatechange");
+ },
+
set oninstall(aCallback) {
this.__DOM_IMPL__.setEventHandler("oninstall", aCallback);
},
@@ -820,9 +837,14 @@ WebappsApplicationMgmt.prototype = {
this.__DOM_IMPL__.setEventHandler("onuninstall", aCallback);
},
+ set onenabledstatechange(aCallback) {
+ this.__DOM_IMPL__.setEventHandler("onenabledstatechange", aCallback);
+ },
+
receiveMessage: function(aMessage) {
let msg = aMessage.data;
let req;
+
if (["Webapps:Import:Return",
"Webapps:ExtractManifest:Return"]
.indexOf(aMessage.name) != -1) {
@@ -831,11 +853,13 @@ WebappsApplicationMgmt.prototype = {
req = this.getRequest(msg.requestID);
}
- // We want Webapps:Install:Return:OK and Webapps:Uninstall:Broadcast:Return:OK
+ // We want Webapps:Install:Return:OK, Webapps:Uninstall:Broadcast:Return:OK
+ // and Webapps:SetEnabled:Return
// to be broadcasted to all instances of mozApps.mgmt.
if (!((msg.oid == this._id && req) ||
aMessage.name == "Webapps:Install:Return:OK" ||
- aMessage.name == "Webapps:Uninstall:Broadcast:Return:OK")) {
+ aMessage.name == "Webapps:Uninstall:Broadcast:Return:OK" ||
+ aMessage.name == "Webapps:SetEnabled:Return")) {
return;
}
@@ -879,6 +903,14 @@ WebappsApplicationMgmt.prototype = {
req.reject(new this._window.DOMError(msg.error || ""));
}
break;
+ case "Webapps:SetEnabled:Return":
+ {
+ let app = createContentApplicationObject(this._window, msg);
+ let event =
+ new this._window.MozApplicationEvent("enabledstatechange", { application : app });
+ this.__DOM_IMPL__.dispatchEvent(event);
+ }
+ break;
}
if (aMessage.name !== "Webapps:Uninstall:Broadcast:Return:OK") {
this.removeRequest(msg.requestID);
diff --git a/dom/apps/Webapps.jsm b/dom/apps/Webapps.jsm
index be649c2f0d3..48b544fd304 100755
--- a/dom/apps/Webapps.jsm
+++ b/dom/apps/Webapps.jsm
@@ -173,20 +173,30 @@ this.DOMApplicationRegistry = {
dirKey: DIRECTORY_NAME,
init: function() {
- this.messages = ["Webapps:Install", "Webapps:Uninstall",
- "Webapps:GetSelf", "Webapps:CheckInstalled",
- "Webapps:GetInstalled", "Webapps:GetNotInstalled",
+ this.messages = ["Webapps:Install",
+ "Webapps:Uninstall",
+ "Webapps:GetSelf",
+ "Webapps:CheckInstalled",
+ "Webapps:GetInstalled",
+ "Webapps:GetNotInstalled",
"Webapps:Launch",
"Webapps:InstallPackage",
- "Webapps:GetList", "Webapps:RegisterForMessages",
+ "Webapps:GetList",
+ "Webapps:RegisterForMessages",
"Webapps:UnregisterForMessages",
- "Webapps:CancelDownload", "Webapps:CheckForUpdate",
- "Webapps:Download", "Webapps:ApplyDownload",
- "Webapps:Install:Return:Ack", "Webapps:AddReceipt",
- "Webapps:RemoveReceipt", "Webapps:ReplaceReceipt",
+ "Webapps:CancelDownload",
+ "Webapps:CheckForUpdate",
+ "Webapps:Download",
+ "Webapps:ApplyDownload",
+ "Webapps:Install:Return:Ack",
+ "Webapps:AddReceipt",
+ "Webapps:RemoveReceipt",
+ "Webapps:ReplaceReceipt",
"Webapps:RegisterBEP",
- "Webapps:Export", "Webapps:Import",
+ "Webapps:Export",
+ "Webapps:Import",
"Webapps:ExtractManifest",
+ "Webapps:SetEnabled",
"child-process-shutdown"];
this.frameMessages = ["Webapps:ClearBrowserData"];
@@ -283,6 +293,10 @@ this.DOMApplicationRegistry = {
continue;
}
+ if (app.enabled === undefined) {
+ app.enabled = true;
+ }
+
// At startup we can't be downloading, and the $TMP directory
// will be empty so we can't just apply a staged update.
app.downloading = false;
@@ -1181,13 +1195,14 @@ this.DOMApplicationRegistry = {
Services.prefs.setBoolPref("dom.mozApps.used", true);
// We need to check permissions for calls coming from mozApps.mgmt.
- // These are: getNotInstalled(), applyDownload(), uninstall(), import() and
- // extractManifest().
+ // These are: getNotInstalled(), applyDownload(), uninstall(), import(),
+ // extractManifest(), setEnabled().
if (["Webapps:GetNotInstalled",
"Webapps:ApplyDownload",
"Webapps:Uninstall",
"Webapps:Import",
- "Webapps:ExtractManifest"].indexOf(aMessage.name) != -1) {
+ "Webapps:ExtractManifest",
+ "Webapps:SetEnabled"].indexOf(aMessage.name) != -1) {
if (!aMessage.target.assertPermission("webapps-manage")) {
debug("mozApps message " + aMessage.name +
" from a content process with no 'webapps-manage' privileges.");
@@ -1322,6 +1337,9 @@ this.DOMApplicationRegistry = {
case "Webapps:ExtractManifest":
this.doExtractManifest(msg, mm);
break;
+ case "Webapps:SetEnabled":
+ this.setEnabled(msg);
+ break;
}
});
},
@@ -1534,6 +1552,7 @@ this.DOMApplicationRegistry = {
aMm.sendAsyncMessage("Webapps:Launch:Return:OK", aData);
},
function onfailure(reason) {
+ aData.error = reason;
aMm.sendAsyncMessage("Webapps:Launch:Return:KO", aData);
}
);
@@ -4299,6 +4318,25 @@ this.DOMApplicationRegistry = {
});
},
+ setEnabled: function(aData) {
+ debug("setEnabled " + aData.manifestURL + " : " + aData.enabled);
+ let id = this._appIdForManifestURL(aData.manifestURL);
+ if (!id || !this.webapps[id]) {
+ return;
+ }
+
+ debug("Enabling " + id);
+ let app = this.webapps[id];
+ app.enabled = aData.enabled;
+ this._saveApps().then(() => {
+ DOMApplicationRegistry.broadcastMessage("Webapps:UpdateState", {
+ app: app,
+ id: app.id
+ });
+ this.broadcastMessage("Webapps:SetEnabled:Return", app);
+ });
+ },
+
getManifestFor: function(aManifestURL) {
let id = this._appIdForManifestURL(aManifestURL);
let app = this.webapps[id];
diff --git a/dom/apps/tests/file_bug_945152.html b/dom/apps/tests/file_bug_945152.html
index c8485bed4b2..842227b4746 100644
--- a/dom/apps/tests/file_bug_945152.html
+++ b/dom/apps/tests/file_bug_945152.html
@@ -47,7 +47,7 @@
}
var data = xhr.response;
ok(data, "Data is non-null");
- var str = String.fromCharCode.apply(null, Uint8Array(data));
+ var str = String.fromCharCode.apply(null, new Uint8Array(data));
is(str.length, data_head.length + gPaddingSize, "Data size is correct");
is(str.slice(0, data_head.length), data_head, "Data head is correct");
ok(str.slice(data_head.length) == gPadding, "Data padding is correct");
diff --git a/dom/apps/tests/mochitest.ini b/dom/apps/tests/mochitest.ini
index 99f9d90a59b..0d3e940d1be 100644
--- a/dom/apps/tests/mochitest.ini
+++ b/dom/apps/tests/mochitest.ini
@@ -22,6 +22,7 @@ support-files =
marketplace/*
pkg_install_iframe.html
+[test_app_enabled.html]
[test_app_update.html]
[test_bug_795164.html]
[test_import_export.html]
diff --git a/dom/apps/tests/test_app_enabled.html b/dom/apps/tests/test_app_enabled.html
new file mode 100644
index 00000000000..4ed48fc09cd
--- /dev/null
+++ b/dom/apps/tests/test_app_enabled.html
@@ -0,0 +1,129 @@
+
+
+
+
+ Test for Bug {1072090}
+
+
+
+
+
+
+Mozilla Bug {1072090}
+
+
+
+
+
+
+
+
+
diff --git a/dom/apps/tests/test_import_export.html b/dom/apps/tests/test_import_export.html
index 8b4f4edd9e8..524eda94620 100644
--- a/dom/apps/tests/test_import_export.html
+++ b/dom/apps/tests/test_import_export.html
@@ -77,7 +77,7 @@ function cbError(aEvent) {
SimpleTest.waitForExplicitFinish();
/**
- * Install 2 apps from the same origin and uninstall them.
+ * Test exporting and importing hosted and packaged apps.
*/
function runTest() {
SpecialPowers.setAllAppsLaunchable(true);
diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp
index 716abbb0550..d7930dafa53 100644
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -91,7 +91,6 @@
#include "nsITreeView.h"
#include "nsIXULTemplateBuilder.h"
#endif
-#include "nsIDOMXPathNSResolver.h"
#include "nsIEventListenerService.h"
#include "nsIMessageManager.h"
@@ -247,9 +246,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(CSSSupportsRule, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
- NS_DEFINE_CLASSINFO_DATA(XPathNSResolver, nsDOMGenericSH,
- DOM_DEFAULT_SCRIPTABLE_FLAGS)
-
NS_DEFINE_CLASSINFO_DATA(MozSmsMessage, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
@@ -694,10 +690,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMCSSSupportsRule)
DOM_CLASSINFO_MAP_END
- DOM_CLASSINFO_MAP_BEGIN(XPathNSResolver, nsIDOMXPathNSResolver)
- DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathNSResolver)
- DOM_CLASSINFO_MAP_END
-
DOM_CLASSINFO_MAP_BEGIN(MozSmsMessage, nsIDOMMozSmsMessage)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozSmsMessage)
DOM_CLASSINFO_MAP_END
diff --git a/dom/base/nsDOMClassInfoClasses.h b/dom/base/nsDOMClassInfoClasses.h
index f6e15ccf382..df6813333a0 100644
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -32,9 +32,6 @@ DOMCI_CLASS(XULTreeBuilder)
DOMCI_CLASS(CSSMozDocumentRule)
DOMCI_CLASS(CSSSupportsRule)
-// DOM Level 3 XPath objects
-DOMCI_CLASS(XPathNSResolver)
-
DOMCI_CLASS(MozSmsMessage)
DOMCI_CLASS(MozMmsMessage)
DOMCI_CLASS(MozMobileMessageThread)
diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf
index d1b6b79f8c8..d9274158a00 100644
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1863,5 +1863,4 @@ addExternalIface('StackFrame', nativeType='nsIStackFrame',
headerFile='nsIException.h', notflattened=True)
addExternalIface('URI', nativeType='nsIURI', headerFile='nsIURI.h',
notflattened=True)
-addExternalIface('XPathNSResolver')
addExternalIface('XULCommandDispatcher')
diff --git a/dom/canvas/DocumentRendererParent.cpp b/dom/canvas/DocumentRendererParent.cpp
index 7775e4bc2e6..d9578ac4ee3 100644
--- a/dom/canvas/DocumentRendererParent.cpp
+++ b/dom/canvas/DocumentRendererParent.cpp
@@ -2,10 +2,12 @@
* 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 "mozilla/gfx/2D.h"
#include "mozilla/ipc/DocumentRendererParent.h"
+
+#include "gfx2DGlue.h"
+#include "mozilla/gfx/2D.h"
+#include "mozilla/gfx/PathHelpers.h"
#include "mozilla/RefPtr.h"
-#include "gfxPattern.h"
#include "nsICanvasRenderingContextInternal.h"
using namespace mozilla;
@@ -31,23 +33,18 @@ void DocumentRendererParent::DrawToCanvas(const nsIntSize& aSize,
if (!mCanvas || !mCanvasContext)
return;
+ DrawTarget* drawTarget = mCanvasContext->GetDrawTarget();
+ Rect rect(0, 0, aSize.width, aSize.height);
+ MaybeSnapToDevicePixels(rect, *drawTarget, true);
RefPtr dataSurface =
Factory::CreateWrappingDataSourceSurface(reinterpret_cast(const_cast(aData).BeginWriting()),
aSize.width * 4,
IntSize(aSize.width, aSize.height),
SurfaceFormat::B8G8R8A8);
- nsRefPtr pat = new gfxPattern(dataSurface, Matrix());
+ SurfacePattern pattern(dataSurface, ExtendMode::CLAMP);
+ drawTarget->FillRect(rect, pattern);
- gfxRect rect(gfxPoint(0, 0), gfxSize(aSize.width, aSize.height));
- mCanvasContext->NewPath();
- mCanvasContext->PixelSnappedRectangleAndSetPattern(rect, pat);
- mCanvasContext->Fill();
-
- // get rid of the pattern surface ref, because aData is very
- // likely to go away shortly
- mCanvasContext->SetColor(gfxRGBA(1,1,1,1));
-
- gfxRect damageRect = mCanvasContext->UserToDevice(rect);
+ gfxRect damageRect = mCanvasContext->UserToDevice(ThebesRect(rect));
mCanvas->Redraw(damageRect);
}
diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp
index fd1bbb26f77..b810a75fae8 100644
--- a/dom/canvas/WebGLContext.cpp
+++ b/dom/canvas/WebGLContext.cpp
@@ -909,6 +909,11 @@ WebGLContext::SetDimensions(int32_t sWidth, int32_t sHeight)
mViewportWidth = mWidth;
mViewportHeight = mHeight;
+ // Update mOptions.
+ mOptions.depth = gl->Caps().depth;
+ mOptions.stencil = gl->Caps().stencil;
+ mOptions.antialias = gl->Caps().antialias;
+
// Make sure that we clear this out, otherwise
// we'll end up displaying random memory
gl->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, 0);
@@ -925,9 +930,9 @@ WebGLContext::SetDimensions(int32_t sWidth, int32_t sHeight)
MOZ_ASSERT(gl->Caps().color);
MOZ_ASSERT(gl->Caps().alpha == mOptions.alpha);
- MOZ_ASSERT(gl->Caps().depth == mOptions.depth || !gl->Caps().depth);
- MOZ_ASSERT(gl->Caps().stencil == mOptions.stencil || !gl->Caps().stencil);
- MOZ_ASSERT(gl->Caps().antialias == mOptions.antialias || !gl->Caps().antialias);
+ MOZ_ASSERT(gl->Caps().depth == mOptions.depth);
+ MOZ_ASSERT(gl->Caps().stencil == mOptions.stencil);
+ MOZ_ASSERT(gl->Caps().antialias == mOptions.antialias);
MOZ_ASSERT(gl->Caps().preserve == mOptions.preserveDrawingBuffer);
if (gl->WorkAroundDriverBugs() && gl->IsANGLE()) {
diff --git a/dom/canvas/WebGLContextValidate.cpp b/dom/canvas/WebGLContextValidate.cpp
index 265358a8a55..48c2a41220e 100644
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -4,31 +4,30 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WebGLContext.h"
-#include "WebGLBuffer.h"
-#include "WebGLVertexAttribData.h"
-#include "WebGLShader.h"
-#include "WebGLProgram.h"
-#include "WebGLUniformLocation.h"
-#include "WebGLFramebuffer.h"
-#include "WebGLRenderbuffer.h"
-#include "WebGLTexture.h"
-#include "WebGLVertexArray.h"
-#include "GLContext.h"
-#include "CanvasUtils.h"
-#include "WebGLContextUtils.h"
+#include
+#include "angle/ShaderLang.h"
+#include "CanvasUtils.h"
+#include "GLContext.h"
+#include "jsfriendapi.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/Preferences.h"
-#include "mozilla/Services.h"
-
-#include "jsfriendapi.h"
-
-#include "angle/ShaderLang.h"
-
-#include
-
#include "mozilla/Services.h"
#include "nsIObserverService.h"
+#include "WebGLBuffer.h"
+#include "WebGLContextUtils.h"
+#include "WebGLFramebuffer.h"
+#include "WebGLProgram.h"
+#include "WebGLRenderbuffer.h"
+#include "WebGLShader.h"
+#include "WebGLTexture.h"
+#include "WebGLUniformLocation.h"
+#include "WebGLVertexArray.h"
+#include "WebGLVertexAttribData.h"
+
+#if defined(MOZ_WIDGET_COCOA)
+#include "nsCocoaFeatures.h"
+#endif
using namespace mozilla;
@@ -1668,7 +1667,10 @@ WebGLContext::InitAndValidateGL()
#ifdef XP_MACOSX
if (gl->WorkAroundDriverBugs() &&
- gl->Vendor() == gl::GLVendor::ATI) {
+ gl->Vendor() == gl::GLVendor::ATI &&
+ nsCocoaFeatures::OSXVersionMajor() == 10 &&
+ nsCocoaFeatures::OSXVersionMinor() < 9)
+ {
// The Mac ATI driver, in all known OSX version up to and including 10.8,
// renders points sprites upside-down. Apple bug 11778921
gl->fPointParameterf(LOCAL_GL_POINT_SPRITE_COORD_ORIGIN, LOCAL_GL_LOWER_LEFT);
diff --git a/dom/devicestorage/test/test_fs_createFile.html b/dom/devicestorage/test/test_fs_createFile.html
index 2d40ec38b51..530d2e83f50 100644
--- a/dom/devicestorage/test/test_fs_createFile.html
+++ b/dom/devicestorage/test/test_fs_createFile.html
@@ -61,7 +61,7 @@ let gTestCases = [
// Create with array buffer view data.
{
text: "Kunming is in Yunnan province of China.",
- get data() { return Uint8Array(str2array(this.text)); },
+ get data() { return new Uint8Array(str2array(this.text)); },
shouldPass: true,
mode: "replace"
},
diff --git a/dom/inputmethod/forms.js b/dom/inputmethod/forms.js
index a2d666ef5e8..b9a33b32824 100644
--- a/dom/inputmethod/forms.js
+++ b/dom/inputmethod/forms.js
@@ -348,7 +348,7 @@ let FormAssistant = {
// Implements nsIEditorObserver get notification when the text content of
// current input field has changed.
EditAction: function fa_editAction() {
- if (this._editing) {
+ if (this._editing || !this.isHandlingFocus) {
return;
}
this.sendInputState(this.focusedElement);
diff --git a/dom/inputmethod/mochitest/mochitest.ini b/dom/inputmethod/mochitest/mochitest.ini
index 0d5b48a6be0..68efee01803 100644
--- a/dom/inputmethod/mochitest/mochitest.ini
+++ b/dom/inputmethod/mochitest/mochitest.ini
@@ -23,5 +23,6 @@ support-files =
[test_bug1066515.html]
[test_delete_focused_element.html]
[test_sendkey_cancel.html]
+[test_sync_edit.html]
[test_two_inputs.html]
[test_two_selects.html]
diff --git a/dom/inputmethod/mochitest/test_sync_edit.html b/dom/inputmethod/mochitest/test_sync_edit.html
new file mode 100644
index 00000000000..ac24b7d23f7
--- /dev/null
+++ b/dom/inputmethod/mochitest/test_sync_edit.html
@@ -0,0 +1,65 @@
+
+
+
+
+ Sync edit of an input
+
+
+
+
+
+Mozilla Bug 1079455
+
+
+
+
+
+
+
diff --git a/dom/interfaces/xpath/moz.build b/dom/interfaces/xpath/moz.build
index 07c6b7e8644..a8985ff6e50 100644
--- a/dom/interfaces/xpath/moz.build
+++ b/dom/interfaces/xpath/moz.build
@@ -6,7 +6,6 @@
XPIDL_SOURCES += [
'nsIDOMXPathEvaluator.idl',
- 'nsIDOMXPathNSResolver.idl',
'nsIDOMXPathResult.idl',
]
diff --git a/dom/interfaces/xpath/nsIDOMXPathEvaluator.idl b/dom/interfaces/xpath/nsIDOMXPathEvaluator.idl
index 2b4a55f3d1c..9a07b40af83 100644
--- a/dom/interfaces/xpath/nsIDOMXPathEvaluator.idl
+++ b/dom/interfaces/xpath/nsIDOMXPathEvaluator.idl
@@ -9,16 +9,14 @@
#include "domstubs.idl"
-interface nsIDOMXPathNSResolver;
interface XPathException;
-[uuid(89a0fe71-c1d9-46bd-b76b-47f51fd935ff)]
+[uuid(92584002-d0e2-4b88-9af9-fa6ff59ee002)]
interface nsIDOMXPathEvaluator : nsISupports
{
- nsIDOMXPathNSResolver createNSResolver(in nsIDOMNode nodeResolver);
nsISupports evaluate(in DOMString expression,
in nsIDOMNode contextNode,
- in nsIDOMXPathNSResolver resolver,
+ in nsIDOMNode resolver,
in unsigned short type,
in nsISupports result)
raises(XPathException,
diff --git a/dom/interfaces/xpath/nsIDOMXPathNSResolver.idl b/dom/interfaces/xpath/nsIDOMXPathNSResolver.idl
deleted file mode 100644
index 5708335778a..00000000000
--- a/dom/interfaces/xpath/nsIDOMXPathNSResolver.idl
+++ /dev/null
@@ -1,16 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-/**
- * Corresponds to http://www.w3.org/TR/2002/WD-DOM-Level-3-XPath-20020208
- */
-
-#include "domstubs.idl"
-
-[scriptable, function, uuid(75506f83-b504-11d5-a7f2-ca108ab8b6fc)]
-interface nsIDOMXPathNSResolver : nsISupports
-{
- DOMString lookupNamespaceURI(in DOMString prefix);
-};
diff --git a/dom/mobileconnection/Assertions.cpp b/dom/mobileconnection/Assertions.cpp
index 50e71d2d6b4..b544011334a 100644
--- a/dom/mobileconnection/Assertions.cpp
+++ b/dom/mobileconnection/Assertions.cpp
@@ -17,6 +17,16 @@ ASSERT_NETWORK_SELECTION_MODE_EQUALITY(Manual, NETWORK_SELECTION_MODE_MANUAL);
#undef ASSERT_NETWORK_SELECTION_MODE_EQUALITY
+#define ASSERT_MOBILE_RADIO_STATE_EQUALITY(webidlState, xpidlState) \
+ static_assert(static_cast(MobileRadioState::webidlState) == nsIMobileConnection::xpidlState, \
+ "MobileRadioState::" #webidlState " should equal to nsIMobileConnection::" #xpidlState)
+
+ASSERT_MOBILE_RADIO_STATE_EQUALITY(Enabling, MOBILE_RADIO_STATE_ENABLING);
+ASSERT_MOBILE_RADIO_STATE_EQUALITY(Enabled, MOBILE_RADIO_STATE_ENABLED);
+ASSERT_MOBILE_RADIO_STATE_EQUALITY(Disabling, MOBILE_RADIO_STATE_DISABLING);
+ASSERT_MOBILE_RADIO_STATE_EQUALITY(Disabled, MOBILE_RADIO_STATE_DISABLED);
+
+#undef ASSERT_MOBILE_RADIO_STATE_EQUALITY
+
} // namespace dom
} // namespace mozilla
-
diff --git a/dom/mobileconnection/MobileConnection.cpp b/dom/mobileconnection/MobileConnection.cpp
index 0032c96a639..7064614d689 100644
--- a/dom/mobileconnection/MobileConnection.cpp
+++ b/dom/mobileconnection/MobileConnection.cpp
@@ -368,9 +368,12 @@ MobileConnection::GetRadioState() const
return retVal;
}
- nsAutoString state;
- mMobileConnection->GetRadioState(state);
- CONVERT_STRING_TO_NULLABLE_ENUM(state, MobileRadioState, retVal);
+ int32_t state = nsIMobileConnection::MOBILE_RADIO_STATE_UNKNOWN;
+ if (NS_SUCCEEDED(mMobileConnection->GetRadioState(&state)) &&
+ state != nsIMobileConnection::MOBILE_RADIO_STATE_UNKNOWN) {
+ MOZ_ASSERT(state < static_cast(MobileRadioState::EndGuard_));
+ retVal.SetValue(static_cast(state));
+ }
return retVal;
}
diff --git a/dom/mobileconnection/gonk/MobileConnectionService.js b/dom/mobileconnection/gonk/MobileConnectionService.js
index 8b7a0bdae7e..714433e468f 100644
--- a/dom/mobileconnection/gonk/MobileConnectionService.js
+++ b/dom/mobileconnection/gonk/MobileConnectionService.js
@@ -379,7 +379,7 @@ MobileConnectionProvider.prototype = {
data: null,
iccId: null,
networkSelectionMode: Ci.nsIMobileConnection.NETWORK_SELECTION_MODE_UNKNOWN,
- radioState: null,
+ radioState: Ci.nsIMobileConnection.MOBILE_RADIO_STATE_UNKNOWN,
lastKnownNetwork: null,
lastKnownHomeNetwork: null,
supportedNetworkTypes: null,
@@ -743,7 +743,7 @@ MobileConnectionProvider.prototype = {
},
setPreferredNetworkType: function(aType, aCallback) {
- if (this.radioState !== RIL.GECKO_RADIOSTATE_ENABLED) {
+ if (this.radioState !== Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
return;
}
@@ -762,7 +762,7 @@ MobileConnectionProvider.prototype = {
},
getPreferredNetworkType: function(aCallback) {
- if (this.radioState !== RIL.GECKO_RADIOSTATE_ENABLED) {
+ if (this.radioState !== Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
return;
}
@@ -984,7 +984,7 @@ MobileConnectionProvider.prototype = {
return;
}
- if (this.radioState !== RIL.GECKO_RADIOSTATE_ENABLED) {
+ if (this.radioState !== Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
return;
}
@@ -1003,7 +1003,7 @@ MobileConnectionProvider.prototype = {
},
getCallingLineIdRestriction: function(aCallback) {
- if (this.radioState !== RIL.GECKO_RADIOSTATE_ENABLED) {
+ if (this.radioState !== Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
return;
}
diff --git a/dom/mobileconnection/gonk/nsIGonkMobileConnectionService.idl b/dom/mobileconnection/gonk/nsIGonkMobileConnectionService.idl
index 652ca4c6614..7070a0e1732 100644
--- a/dom/mobileconnection/gonk/nsIGonkMobileConnectionService.idl
+++ b/dom/mobileconnection/gonk/nsIGonkMobileConnectionService.idl
@@ -9,7 +9,7 @@
"@mozilla.org/mobileconnection/gonkmobileconnectionservice;1"
%}
-[scriptable, uuid(2d574f0e-4a02-11e4-b1b3-cbc14b7608ce)]
+[scriptable, uuid(7322619d-9abd-4410-99ce-207da80f9879)]
interface nsIGonkMobileConnectionService : nsIMobileConnectionService
{
void notifyNetworkInfoChanged(in unsigned long clientId, in jsval networkInfo);
@@ -27,7 +27,7 @@ interface nsIGonkMobileConnectionService : nsIMobileConnectionService
void notifyOtaStatusChanged(in unsigned long clientId, in DOMString status);
void notifyRadioStateChanged(in unsigned long clientId,
- in DOMString radioState);
+ in long radioState);
void notifyUssdReceived(in unsigned long clientId,
in DOMString message,
diff --git a/dom/mobileconnection/interfaces/nsIMobileConnectionService.idl b/dom/mobileconnection/interfaces/nsIMobileConnectionService.idl
index b963abd6c44..2449490fe21 100644
--- a/dom/mobileconnection/interfaces/nsIMobileConnectionService.idl
+++ b/dom/mobileconnection/interfaces/nsIMobileConnectionService.idl
@@ -236,7 +236,7 @@ already_AddRefed
NS_CreateMobileConnectionService();
%}
-[scriptable, uuid(cfc7d15b-d2c2-4f28-ad9f-b250030c3073)]
+[scriptable, uuid(99818dc7-e770-4249-87e2-2de0a928ed08)]
interface nsIMobileConnection : nsISupports
{
/*
@@ -304,6 +304,15 @@ interface nsIMobileConnection : nsISupports
const long NETWORK_SELECTION_MODE_AUTOMATIC = 0;
const long NETWORK_SELECTION_MODE_MANUAL = 1;
+ /**
+ * Mobile Radio State.
+ */
+ const long MOBILE_RADIO_STATE_UNKNOWN = -1;
+ const long MOBILE_RADIO_STATE_ENABLING = 0;
+ const long MOBILE_RADIO_STATE_ENABLED = 1;
+ const long MOBILE_RADIO_STATE_DISABLING = 2;
+ const long MOBILE_RADIO_STATE_DISABLED = 3;
+
readonly attribute unsigned long serviceId;
/**
@@ -347,10 +356,10 @@ interface nsIMobileConnection : nsISupports
readonly attribute long networkSelectionMode;
/**
- * Current radio state. Possible values are 'enabling', 'enabled',
- * 'disabling', 'disabled', null (unknown).
+ * Current radio state. One of the nsIMobileConnection.MOBILE_RADIO_STATE_*
+ * values.
*/
- readonly attribute DOMString radioState;
+ readonly attribute long radioState;
/**
* The network types supported by this radio.
diff --git a/dom/mobileconnection/ipc/MobileConnectionChild.cpp b/dom/mobileconnection/ipc/MobileConnectionChild.cpp
index 63301fdd00a..9f4b9f1f863 100644
--- a/dom/mobileconnection/ipc/MobileConnectionChild.cpp
+++ b/dom/mobileconnection/ipc/MobileConnectionChild.cpp
@@ -106,9 +106,9 @@ MobileConnectionChild::GetIccId(nsAString& aIccId)
}
NS_IMETHODIMP
-MobileConnectionChild::GetRadioState(nsAString& aRadioState)
+MobileConnectionChild::GetRadioState(int32_t* aRadioState)
{
- aRadioState = mRadioState;
+ *aRadioState = mRadioState;
return NS_OK;
}
@@ -488,9 +488,9 @@ MobileConnectionChild::RecvNotifyIccChanged(const nsString& aIccId)
}
bool
-MobileConnectionChild::RecvNotifyRadioStateChanged(const nsString& aRadioState)
+MobileConnectionChild::RecvNotifyRadioStateChanged(const int32_t& aRadioState)
{
- mRadioState.Assign(aRadioState);
+ mRadioState = aRadioState;
for (int32_t i = 0; i < mListeners.Count(); i++) {
mListeners[i]->NotifyRadioStateChanged();
diff --git a/dom/mobileconnection/ipc/MobileConnectionChild.h b/dom/mobileconnection/ipc/MobileConnectionChild.h
index 48bd1da40f9..42271444a3c 100644
--- a/dom/mobileconnection/ipc/MobileConnectionChild.h
+++ b/dom/mobileconnection/ipc/MobileConnectionChild.h
@@ -92,7 +92,7 @@ protected:
RecvNotifyIccChanged(const nsString& aIccId) MOZ_OVERRIDE;
virtual bool
- RecvNotifyRadioStateChanged(const nsString& aRadioState) MOZ_OVERRIDE;
+ RecvNotifyRadioStateChanged(const int32_t& aRadioState) MOZ_OVERRIDE;
virtual bool
RecvNotifyClirModeChanged(const uint32_t& aMode) MOZ_OVERRIDE;
@@ -113,7 +113,7 @@ private:
nsRefPtr mVoice;
nsRefPtr mData;
nsString mIccId;
- nsString mRadioState;
+ int32_t mRadioState;
nsString mLastNetwork;
nsString mLastHomeNetwork;
int32_t mNetworkSelectionMode;
diff --git a/dom/mobileconnection/ipc/MobileConnectionParent.cpp b/dom/mobileconnection/ipc/MobileConnectionParent.cpp
index b32ecb5846a..8ae3225b1b2 100644
--- a/dom/mobileconnection/ipc/MobileConnectionParent.cpp
+++ b/dom/mobileconnection/ipc/MobileConnectionParent.cpp
@@ -130,7 +130,7 @@ MobileConnectionParent::RecvInit(nsMobileConnectionInfo* aVoice,
nsString* aLastKnownHomeNetwork,
nsString* aIccId,
int32_t* aNetworkSelectionMode,
- nsString* aRadioState,
+ int32_t* aRadioState,
nsTArray* aSupportedNetworkTypes)
{
NS_ENSURE_TRUE(mMobileConnection, false);
@@ -141,7 +141,7 @@ MobileConnectionParent::RecvInit(nsMobileConnectionInfo* aVoice,
NS_ENSURE_SUCCESS(mMobileConnection->GetLastKnownHomeNetwork(*aLastKnownHomeNetwork), false);
NS_ENSURE_SUCCESS(mMobileConnection->GetIccId(*aIccId), false);
NS_ENSURE_SUCCESS(mMobileConnection->GetNetworkSelectionMode(aNetworkSelectionMode), false);
- NS_ENSURE_SUCCESS(mMobileConnection->GetRadioState(*aRadioState), false);
+ NS_ENSURE_SUCCESS(mMobileConnection->GetRadioState(aRadioState), false);
char16_t** types = nullptr;
uint32_t length = 0;
@@ -262,8 +262,8 @@ MobileConnectionParent::NotifyRadioStateChanged()
NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
nsresult rv;
- nsAutoString radioState;
- rv = mMobileConnection->GetRadioState(radioState);
+ int32_t radioState;
+ rv = mMobileConnection->GetRadioState(&radioState);
NS_ENSURE_SUCCESS(rv, rv);
return SendNotifyRadioStateChanged(radioState) ? NS_OK : NS_ERROR_FAILURE;
diff --git a/dom/mobileconnection/ipc/MobileConnectionParent.h b/dom/mobileconnection/ipc/MobileConnectionParent.h
index b4f72468bb4..f38d5e7c9f6 100644
--- a/dom/mobileconnection/ipc/MobileConnectionParent.h
+++ b/dom/mobileconnection/ipc/MobileConnectionParent.h
@@ -52,7 +52,7 @@ protected:
RecvInit(nsMobileConnectionInfo* aVoice, nsMobileConnectionInfo* aData,
nsString* aLastKnownNetwork, nsString* aLastKnownHomeNetwork,
nsString* aIccId, int32_t* aNetworkSelectionMode,
- nsString* aRadioState, nsTArray* aSupportedNetworkTypes) MOZ_OVERRIDE;
+ int32_t* aRadioState, nsTArray* aSupportedNetworkTypes) MOZ_OVERRIDE;
private:
nsCOMPtr mMobileConnection;
diff --git a/dom/mobileconnection/ipc/PMobileConnection.ipdl b/dom/mobileconnection/ipc/PMobileConnection.ipdl
index b51f6251bc0..e0e883c296c 100644
--- a/dom/mobileconnection/ipc/PMobileConnection.ipdl
+++ b/dom/mobileconnection/ipc/PMobileConnection.ipdl
@@ -28,7 +28,7 @@ child:
NotifyEmergencyCbModeChanged(bool aActive, uint32_t aTimeoutMs);
NotifyOtaStatusChanged(nsString aStatus);
NotifyIccChanged(nsString aIccId);
- NotifyRadioStateChanged(nsString aRadioState);
+ NotifyRadioStateChanged(int32_t aRadioState);
NotifyClirModeChanged(uint32_t aMode);
NotifyLastNetworkChanged(nsString aNetwork);
NotifyLastHomeNetworkChanged(nsString aNetwork);
@@ -52,7 +52,7 @@ parent:
returns (nsMobileConnectionInfo aVoice, nsMobileConnectionInfo aData,
nsString aLastKnownNetwork, nsString aLastKnownHomeNetwork,
nsString aIccId, int32_t aNetworkSelectionMode,
- nsString aRadioState, nsString[] aSupportedNetworkTypes);
+ int32_t aRadioState, nsString[] aSupportedNetworkTypes);
};
/**
diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js
index 74da8ecaaef..5109d340ead 100644
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -504,13 +504,15 @@ XPCOMUtils.defineLazyGetter(this, "gRadioEnabledController", function() {
},
_isValidStateForSetRadioEnabled: function(radioState) {
- return radioState == RIL.GECKO_RADIOSTATE_ENABLED ||
- radioState == RIL.GECKO_RADIOSTATE_DISABLED;
+ return radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED ||
+ radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED;
},
_isDummyForSetRadioEnabled: function(radioState, data) {
- return (radioState == RIL.GECKO_RADIOSTATE_ENABLED && data.enabled) ||
- (radioState == RIL.GECKO_RADIOSTATE_DISABLED && !data.enabled);
+ return (radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED &&
+ data.enabled) ||
+ (radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED &&
+ !data.enabled);
},
_handleMessage: function(message) {
@@ -573,15 +575,15 @@ XPCOMUtils.defineLazyGetter(this, "gRadioEnabledController", function() {
let radioInterface = _ril.getRadioInterface(clientId);
this.notifyRadioStateChanged(clientId,
- enabled ? RIL.GECKO_RADIOSTATE_ENABLING
- : RIL.GECKO_RADIOSTATE_DISABLING);
+ enabled ? Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLING
+ : Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLING);
radioInterface.workerMessenger.send("setRadioEnabled", message.data,
(function(response) {
if (response.errorMsg) {
// Request fails. Rollback to the original radioState.
this.notifyRadioStateChanged(clientId,
- enabled ? RIL.GECKO_RADIOSTATE_DISABLED
- : RIL.GECKO_RADIOSTATE_ENABLED);
+ enabled ? Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED
+ : Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED);
}
message.callback(response);
return false;
@@ -1197,7 +1199,7 @@ DataConnectionHandler.prototype = {
// This check avoids data call connection if the radio is not ready
// yet after toggling off airplane mode.
let radioState = connection && connection.radioState;
- if (radioState != RIL.GECKO_RADIOSTATE_ENABLED) {
+ if (radioState != Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
if (DEBUG) {
this.debug("RIL is not ready for data connection: radio's not ready");
}
@@ -3525,8 +3527,8 @@ RadioInterface.prototype = {
if (DEBUG) this.debug("Error! Address is invalid when sending SMS: " +
options.number);
errorCode = Ci.nsIMobileMessageCallback.INVALID_ADDRESS_ERROR;
- } else if (radioState == null ||
- radioState == RIL.GECKO_RADIOSTATE_DISABLED) {
+ } else if (radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_UNKNOWN ||
+ radioState == Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED) {
if (DEBUG) this.debug("Error! Radio is disabled when sending SMS.");
errorCode = Ci.nsIMobileMessageCallback.RADIO_DISABLED_ERROR;
} else if (this.rilContext.cardState != Ci.nsIIccProvider.CARD_STATE_READY) {
diff --git a/dom/system/gonk/ril_consts.js b/dom/system/gonk/ril_consts.js
index dd09e0f7ee4..b0408ff0c2f 100644
--- a/dom/system/gonk/ril_consts.js
+++ b/dom/system/gonk/ril_consts.js
@@ -2490,12 +2490,12 @@ this.CALL_FAIL_IMSI_UNKNOWN_IN_VLR = 242;
this.CALL_FAIL_IMEI_NOT_ACCEPTED = 243;
this.CALL_FAIL_ERROR_UNSPECIFIED = 0xffff;
-// Other Gecko-specific constants
-this.GECKO_RADIOSTATE_UNKNOWN = null;
-this.GECKO_RADIOSTATE_ENABLING = "enabling";
-this.GECKO_RADIOSTATE_ENABLED = "enabled";
-this.GECKO_RADIOSTATE_DISABLING = "disabling";
-this.GECKO_RADIOSTATE_DISABLED = "disabled";
+// See nsIMobileConnection::MOBILE_RADIO_STATE_*
+this.GECKO_RADIOSTATE_UNKNOWN = -1;
+this.GECKO_RADIOSTATE_ENABLING = 0;
+this.GECKO_RADIOSTATE_ENABLED = 1;
+this.GECKO_RADIOSTATE_DISABLING = 2;
+this.GECKO_RADIOSTATE_DISABLED = 3;
// Only used in ril_worker.js
this.GECKO_CARDSTATE_UNINITIALIZED = 4294967294; // UINT32_MAX - 1
diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html
index d994a6a60af..a6bc25cc9fd 100644
--- a/dom/tests/mochitest/general/test_interfaces.html
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -1301,8 +1301,6 @@ var interfaceNamesInGlobalScope =
"XPathEvaluator",
// IMPORTANT: Do not change this list without review from a DOM peer!
"XPathExpression",
-// IMPORTANT: Do not change this list without review from a DOM peer!
- "XPathNSResolver",
// IMPORTANT: Do not change this list without review from a DOM peer!
"XPathResult",
// IMPORTANT: Do not change this list without review from a DOM peer!
diff --git a/dom/tests/mochitest/webapps/test_list_api.xul b/dom/tests/mochitest/webapps/test_list_api.xul
index e4b86c13a6b..f5a4c9ee86a 100644
--- a/dom/tests/mochitest/webapps/test_list_api.xul
+++ b/dom/tests/mochitest/webapps/test_list_api.xul
@@ -44,11 +44,13 @@ var mgmtProps = {
uninstall: "function",
oninstall: "object",
onuninstall: "object",
+ onenabledstatechange: "object",
ownerGlobal: "object",
removeEventListener: "function",
setEventHandler: "function",
extractManifest: "function",
- import: "function"
+ import: "function",
+ setEnabled: "function"
};
isDeeply([p for (p in navigator.mozApps.mgmt)].sort(),
diff --git a/dom/webidl/Apps.webidl b/dom/webidl/Apps.webidl
index c6e3e65817d..212ac8a415e 100644
--- a/dom/webidl/Apps.webidl
+++ b/dom/webidl/Apps.webidl
@@ -32,6 +32,7 @@ interface DOMApplication : EventTarget {
readonly attribute DOMString installOrigin;
readonly attribute DOMTimeStamp installTime;
readonly attribute boolean removable;
+ readonly attribute boolean enabled;
[Cached, Pure]
readonly attribute sequence receipts;
@@ -96,6 +97,9 @@ interface DOMApplicationsManager : EventTarget {
Promise import(Blob blob);
Promise extractManifest(Blob blob);
+ void setEnabled(DOMApplication app, boolean state);
+
attribute EventHandler oninstall;
attribute EventHandler onuninstall;
+ attribute EventHandler onenabledstatechange;
};
diff --git a/dom/webidl/XPathEvaluator.webidl b/dom/webidl/XPathEvaluator.webidl
index f5b81bdedd0..c60c34da877 100644
--- a/dom/webidl/XPathEvaluator.webidl
+++ b/dom/webidl/XPathEvaluator.webidl
@@ -4,16 +4,14 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-interface XPathNSResolver;
-
[Constructor]
interface XPathEvaluator {
// Based on nsIDOMXPathEvaluator
[NewObject, Throws]
XPathExpression createExpression(DOMString expression,
XPathNSResolver? resolver);
- [NewObject, Throws]
- XPathNSResolver createNSResolver(Node? nodeResolver);
+ [Pure]
+ Node createNSResolver(Node nodeResolver);
[Throws]
XPathResult evaluate(DOMString expression, Node? contextNode,
XPathNSResolver? resolver, unsigned short type,
diff --git a/dom/webidl/XPathNSResolver.webidl b/dom/webidl/XPathNSResolver.webidl
new file mode 100644
index 00000000000..6309ff38c1c
--- /dev/null
+++ b/dom/webidl/XPathNSResolver.webidl
@@ -0,0 +1,10 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* 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/.
+ */
+
+callback interface XPathNSResolver
+{
+ DOMString? lookupNamespaceURI(DOMString? prefix);
+};
diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build
index 9853fba92a5..ace011e79b0 100644
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -537,6 +537,7 @@ WEBIDL_FILES = [
'XMLStylesheetProcessingInstruction.webidl',
'XPathEvaluator.webidl',
'XPathExpression.webidl',
+ 'XPathNSResolver.webidl',
'XPathResult.webidl',
'XSLTProcessor.webidl',
'XULCommandEvent.webidl',
diff --git a/dom/xslt/xpath/XPathEvaluator.cpp b/dom/xslt/xpath/XPathEvaluator.cpp
index 895ae37cb7e..150a4bd2b61 100644
--- a/dom/xslt/xpath/XPathEvaluator.cpp
+++ b/dom/xslt/xpath/XPathEvaluator.cpp
@@ -8,7 +8,6 @@
#include "nsCOMPtr.h"
#include "nsIAtom.h"
#include "mozilla/dom/XPathExpression.h"
-#include "nsXPathNSResolver.h"
#include "XPathResult.h"
#include "nsContentCID.h"
#include "txExpr.h"
@@ -23,6 +22,7 @@
#include "txIXPathContext.h"
#include "mozilla/dom/XPathEvaluatorBinding.h"
#include "mozilla/dom/BindingUtils.h"
+#include "mozilla/dom/XPathNSResolverBinding.h"
extern nsresult
TX_ResolveFunctionCallXPCOM(const nsCString &aContractID, int32_t aNamespaceID,
@@ -36,9 +36,18 @@ namespace dom {
class XPathEvaluatorParseContext : public txIParseContext
{
public:
- XPathEvaluatorParseContext(nsIDOMXPathNSResolver* aResolver,
+ XPathEvaluatorParseContext(XPathNSResolver* aResolver,
bool aIsCaseSensitive)
: mResolver(aResolver),
+ mResolverNode(nullptr),
+ mLastError(NS_OK),
+ mIsCaseSensitive(aIsCaseSensitive)
+ {
+ }
+ XPathEvaluatorParseContext(nsINode* aResolver,
+ bool aIsCaseSensitive)
+ : mResolver(nullptr),
+ mResolverNode(aResolver),
mLastError(NS_OK),
mIsCaseSensitive(aIsCaseSensitive)
{
@@ -56,7 +65,8 @@ public:
void SetErrorOffset(uint32_t aOffset);
private:
- nsIDOMXPathNSResolver* mResolver;
+ XPathNSResolver* mResolver;
+ nsINode* mResolverNode;
nsresult mLastError;
bool mIsCaseSensitive;
};
@@ -72,32 +82,18 @@ XPathEvaluator::~XPathEvaluator()
{
}
-NS_IMETHODIMP
-XPathEvaluator::CreateNSResolver(nsIDOMNode *aNodeResolver,
- nsIDOMXPathNSResolver **aResult)
-{
- NS_ENSURE_ARG(aNodeResolver);
- if (!nsContentUtils::CanCallerAccess(aNodeResolver))
- return NS_ERROR_DOM_SECURITY_ERR;
-
- *aResult = new nsXPathNSResolver(aNodeResolver);
- NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
-
- NS_ADDREF(*aResult);
- return NS_OK;
-}
-
NS_IMETHODIMP
XPathEvaluator::Evaluate(const nsAString & aExpression,
nsIDOMNode *aContextNode,
- nsIDOMXPathNSResolver *aResolver,
+ nsIDOMNode *aResolver,
uint16_t aType,
nsISupports *aInResult,
nsISupports **aResult)
{
+ nsCOMPtr resolver = do_QueryInterface(aResolver);
ErrorResult rv;
nsAutoPtr expression(CreateExpression(aExpression,
- aResolver, rv));
+ resolver, rv));
if (rv.Failed()) {
return rv.ErrorCode();
}
@@ -120,21 +116,36 @@ XPathEvaluator::Evaluate(const nsAString & aExpression,
return NS_OK;
}
+XPathExpression*
+XPathEvaluator::CreateExpression(const nsAString& aExpression,
+ XPathNSResolver* aResolver, ErrorResult& aRv)
+{
+ nsCOMPtr doc = do_QueryReferent(mDocument);
+ XPathEvaluatorParseContext pContext(aResolver, !(doc && doc->IsHTML()));
+ return CreateExpression(aExpression, &pContext, doc, aRv);
+}
+
+XPathExpression*
+XPathEvaluator::CreateExpression(const nsAString& aExpression,
+ nsINode* aResolver, ErrorResult& aRv)
+{
+ nsCOMPtr doc = do_QueryReferent(mDocument);
+ XPathEvaluatorParseContext pContext(aResolver, !(doc && doc->IsHTML()));
+ return CreateExpression(aExpression, &pContext, doc, aRv);
+}
XPathExpression*
XPathEvaluator::CreateExpression(const nsAString & aExpression,
- nsIDOMXPathNSResolver *aResolver,
+ txIParseContext* aContext,
+ nsIDocument* aDocument,
ErrorResult& aRv)
{
if (!mRecycler) {
mRecycler = new txResultRecycler;
}
- nsCOMPtr doc = do_QueryReferent(mDocument);
- XPathEvaluatorParseContext pContext(aResolver, !(doc && doc->IsHTML()));
-
nsAutoPtr expression;
- aRv = txExprParser::createExpr(PromiseFlatString(aExpression), &pContext,
+ aRv = txExprParser::createExpr(PromiseFlatString(aExpression), aContext,
getter_Transfers(expression));
if (aRv.Failed()) {
if (aRv.ErrorCode() != NS_ERROR_DOM_NAMESPACE_ERR) {
@@ -144,7 +155,7 @@ XPathEvaluator::CreateExpression(const nsAString & aExpression,
return nullptr;
}
- return new XPathExpression(Move(expression), mRecycler, doc);
+ return new XPathExpression(Move(expression), mRecycler, aDocument);
}
JSObject*
@@ -162,34 +173,24 @@ XPathEvaluator::Constructor(const GlobalObject& aGlobal,
return newObj.forget();
}
-already_AddRefed
-XPathEvaluator::CreateNSResolver(nsINode* aNodeResolver,
- ErrorResult& rv)
-{
- nsCOMPtr nodeResolver = do_QueryInterface(aNodeResolver);
- nsCOMPtr res;
- rv = CreateNSResolver(nodeResolver, getter_AddRefs(res));
- return res.forget();
-}
-
already_AddRefed
XPathEvaluator::Evaluate(JSContext* aCx, const nsAString& aExpression,
nsINode* aContextNode,
- nsIDOMXPathNSResolver* aResolver, uint16_t aType,
+ XPathNSResolver* aResolver, uint16_t aType,
JS::Handle aResult, ErrorResult& rv)
{
- nsCOMPtr contextNode = do_QueryInterface(aContextNode);
- nsCOMPtr res;
- rv = Evaluate(aExpression, contextNode, aResolver, aType,
- aResult ? UnwrapDOMObjectToISupports(aResult) : nullptr,
- getter_AddRefs(res));
- return res.forget().downcast().downcast();
+ nsAutoPtr expression(CreateExpression(aExpression,
+ aResolver, rv));
+ if (rv.Failed()) {
+ return nullptr;
+ }
+ return expression->Evaluate(aCx, *aContextNode, aType, aResult, rv);
}
/*
* Implementation of txIParseContext private to XPathEvaluator, based on a
- * nsIDOMXPathNSResolver
+ * XPathNSResolver
*/
nsresult XPathEvaluatorParseContext::resolveNamespacePrefix
@@ -197,7 +198,7 @@ nsresult XPathEvaluatorParseContext::resolveNamespacePrefix
{
aID = kNameSpaceID_Unknown;
- if (!mResolver) {
+ if (!mResolver && !mResolverNode) {
return NS_ERROR_DOM_NAMESPACE_ERR;
}
@@ -207,8 +208,19 @@ nsresult XPathEvaluatorParseContext::resolveNamespacePrefix
}
nsVoidableString ns;
- nsresult rv = mResolver->LookupNamespaceURI(prefix, ns);
- NS_ENSURE_SUCCESS(rv, rv);
+ if (mResolver) {
+ ErrorResult rv;
+ mResolver->LookupNamespaceURI(prefix, ns, rv);
+ if (rv.Failed()) {
+ return rv.ErrorCode();
+ }
+ } else {
+ if (aPrefix == nsGkAtoms::xml) {
+ ns.AssignLiteral("http://www.w3.org/XML/1998/namespace");
+ } else {
+ mResolverNode->LookupNamespaceURI(prefix, ns);
+ }
+ }
if (DOMStringIsNull(ns)) {
return NS_ERROR_DOM_NAMESPACE_ERR;
diff --git a/dom/xslt/xpath/XPathEvaluator.h b/dom/xslt/xpath/XPathEvaluator.h
index b1dc8cf03c6..ec1431d5f22 100644
--- a/dom/xslt/xpath/XPathEvaluator.h
+++ b/dom/xslt/xpath/XPathEvaluator.h
@@ -15,6 +15,7 @@
#include "nsIDocument.h"
class nsINode;
+class txIParseContext;
class txResultRecycler;
namespace mozilla {
@@ -22,6 +23,7 @@ namespace dom {
class GlobalObject;
class XPathExpression;
+class XPathNSResolver;
class XPathResult;
/**
@@ -50,16 +52,28 @@ public:
Constructor(const GlobalObject& aGlobal, ErrorResult& rv);
XPathExpression*
CreateExpression(const nsAString& aExpression,
- nsIDOMXPathNSResolver* aResolver,
+ XPathNSResolver* aResolver,
ErrorResult& rv);
- already_AddRefed
- CreateNSResolver(nsINode* aNodeResolver, ErrorResult& rv);
+ XPathExpression*
+ CreateExpression(const nsAString& aExpression,
+ nsINode* aResolver,
+ ErrorResult& aRv);
+ nsINode* CreateNSResolver(nsINode& aNodeResolver)
+ {
+ return &aNodeResolver;
+ }
already_AddRefed
Evaluate(JSContext* aCx, const nsAString& aExpression,
- nsINode* aContextNode, nsIDOMXPathNSResolver* aResolver,
+ nsINode* aContextNode, XPathNSResolver* aResolver,
uint16_t aType, JS::Handle aResult,
ErrorResult& rv);
private:
+ XPathExpression*
+ CreateExpression(const nsAString& aExpression,
+ txIParseContext* aContext,
+ nsIDocument* aDocument,
+ ErrorResult& aRv);
+
nsWeakPtr mDocument;
nsRefPtr mRecycler;
};
diff --git a/dom/xslt/xpath/moz.build b/dom/xslt/xpath/moz.build
index 4cc2d58ab19..a2be2db60cd 100644
--- a/dom/xslt/xpath/moz.build
+++ b/dom/xslt/xpath/moz.build
@@ -11,7 +11,6 @@ EXPORTS.mozilla.dom += [
]
UNIFIED_SOURCES += [
- 'nsXPathNSResolver.cpp',
'txBooleanExpr.cpp',
'txBooleanResult.cpp',
'txCoreFunctionCall.cpp',
diff --git a/dom/xslt/xpath/nsXPathNSResolver.cpp b/dom/xslt/xpath/nsXPathNSResolver.cpp
deleted file mode 100644
index 1eb01a507c0..00000000000
--- a/dom/xslt/xpath/nsXPathNSResolver.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* 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 "nsXPathNSResolver.h"
-#include "nsDOMClassInfoID.h"
-#include "nsDOMString.h"
-
-NS_IMPL_CYCLE_COLLECTION(nsXPathNSResolver, mNode)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXPathNSResolver)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXPathNSResolver)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXPathNSResolver)
- NS_INTERFACE_MAP_ENTRY(nsIDOMXPathNSResolver)
- NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMXPathNSResolver)
- NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XPathNSResolver)
-NS_INTERFACE_MAP_END
-
-nsXPathNSResolver::nsXPathNSResolver(nsIDOMNode* aNode)
- : mNode(aNode)
-{
- NS_ASSERTION(mNode, "Need a node to resolve namespaces.");
-}
-
-NS_IMETHODIMP
-nsXPathNSResolver::LookupNamespaceURI(const nsAString & aPrefix,
- nsAString & aResult)
-{
- if (aPrefix.EqualsLiteral("xml")) {
- aResult.AssignLiteral("http://www.w3.org/XML/1998/namespace");
-
- return NS_OK;
- }
-
- if (!mNode) {
- SetDOMStringToNull(aResult);
-
- return NS_OK;
- }
-
- return mNode->LookupNamespaceURI(aPrefix, aResult);
-}
diff --git a/dom/xslt/xpath/nsXPathNSResolver.h b/dom/xslt/xpath/nsXPathNSResolver.h
deleted file mode 100644
index a38b0e8e881..00000000000
--- a/dom/xslt/xpath/nsXPathNSResolver.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* 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 nsXPathNSResolver_h__
-#define nsXPathNSResolver_h__
-
-#include "nsIDOMXPathNSResolver.h"
-#include "nsIDOMNode.h"
-#include "nsCOMPtr.h"
-#include "nsCycleCollectionParticipant.h"
-#include "mozilla/Attributes.h"
-
-/**
- * A class for evaluating an XPath expression string
- */
-class nsXPathNSResolver MOZ_FINAL : public nsIDOMXPathNSResolver
-{
- ~nsXPathNSResolver() {}
-
-public:
- explicit nsXPathNSResolver(nsIDOMNode* aNode);
-
- // nsISupports interface
- NS_DECL_CYCLE_COLLECTING_ISUPPORTS
- NS_DECL_CYCLE_COLLECTION_CLASS(nsXPathNSResolver)
-
- // nsIDOMXPathNSResolver interface
- NS_DECL_NSIDOMXPATHNSRESOLVER
-
-private:
- nsCOMPtr mNode;
-};
-
-#endif
diff --git a/gfx/2d/PathHelpers.h b/gfx/2d/PathHelpers.h
index 494557ac9b7..1fa9f8e95f0 100644
--- a/gfx/2d/PathHelpers.h
+++ b/gfx/2d/PathHelpers.h
@@ -146,6 +146,16 @@ GFX2D_API void AppendRoundedRectToPath(PathBuilder* aPathBuilder,
const Size(& aCornerRadii)[4],
bool aDrawClockwise = true);
+inline TemporaryRef MakePathForRoundedRect(const DrawTarget& aDrawTarget,
+ const Rect& aRect,
+ const Size(& aCornerRadii)[4],
+ bool aDrawClockwise = true)
+{
+ RefPtr builder = aDrawTarget.CreatePathBuilder();
+ AppendRoundedRectToPath(builder, aRect, aCornerRadii, aDrawClockwise);
+ return builder->Finish();
+}
+
/**
* Appends a path represending an ellipse to the path being built by
* aPathBuilder.
@@ -157,6 +167,15 @@ GFX2D_API void AppendEllipseToPath(PathBuilder* aPathBuilder,
const Point& aCenter,
const Size& aDimensions);
+inline TemporaryRef MakePathForEllipse(const DrawTarget& aDrawTarget,
+ const Point& aCenter,
+ const Size& aDimensions)
+{
+ RefPtr builder = aDrawTarget.CreatePathBuilder();
+ AppendEllipseToPath(builder, aCenter, aDimensions);
+ return builder->Finish();
+}
+
/**
* If aDrawTarget's transform only contains a translation, and if this line is
* a horizontal or vertical line, this function will snap the line's vertices
diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h
index 709ddab1252..90a53955b86 100644
--- a/gfx/layers/ipc/CompositorParent.h
+++ b/gfx/layers/ipc/CompositorParent.h
@@ -97,7 +97,6 @@ private:
class CompositorVsyncObserver MOZ_FINAL : public VsyncObserver
{
- NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(CompositorVsyncObserver)
friend class CompositorParent;
public:
diff --git a/gfx/src/nsRenderingContext.cpp b/gfx/src/nsRenderingContext.cpp
index 92327869bf6..c3c8bcdb05f 100644
--- a/gfx/src/nsRenderingContext.cpp
+++ b/gfx/src/nsRenderingContext.cpp
@@ -24,7 +24,8 @@
// size the cluster buffer array in FindSafeLength
#define MAX_GFX_TEXT_BUF_SIZE 8000
-static int32_t FindSafeLength(const char16_t *aString, uint32_t aLength,
+/*static*/ int32_t
+nsRenderingContext::FindSafeLength(const char16_t *aString, uint32_t aLength,
uint32_t aMaxChunkLength)
{
if (aLength <= aMaxChunkLength)
@@ -47,13 +48,6 @@ static int32_t FindSafeLength(const char16_t *aString, uint32_t aLength,
return len;
}
-static int32_t FindSafeLength(const char *aString, uint32_t aLength,
- uint32_t aMaxChunkLength)
-{
- // Since it's ASCII, we don't need to worry about clusters or RTL
- return std::min(aLength, aMaxChunkLength);
-}
-
//////////////////////////////////////////////////////////////////////
//// nsRenderingContext
@@ -90,21 +84,9 @@ nsRenderingContext::SetFont(nsFontMetrics *aFontMetrics)
int32_t
nsRenderingContext::GetMaxChunkLength()
{
- if (!mFontMetrics)
- return 1;
return std::min(mFontMetrics->GetMaxStringLength(), MAX_GFX_TEXT_BUF_SIZE);
}
-nscoord
-nsRenderingContext::GetWidth(char aC)
-{
- if (aC == ' ' && mFontMetrics) {
- return mFontMetrics->SpaceWidth();
- }
-
- return GetWidth(&aC, 1);
-}
-
nscoord
nsRenderingContext::GetWidth(char16_t aC)
{
@@ -117,26 +99,6 @@ nsRenderingContext::GetWidth(const nsString& aString)
return GetWidth(aString.get(), aString.Length());
}
-nscoord
-nsRenderingContext::GetWidth(const char* aString)
-{
- return GetWidth(aString, strlen(aString));
-}
-
-nscoord
-nsRenderingContext::GetWidth(const char* aString, uint32_t aLength)
-{
- uint32_t maxChunkLength = GetMaxChunkLength();
- nscoord width = 0;
- while (aLength > 0) {
- int32_t len = FindSafeLength(aString, aLength, maxChunkLength);
- width += mFontMetrics->GetWidth(aString, len, this);
- aLength -= len;
- aString += len;
- }
- return width;
-}
-
nscoord
nsRenderingContext::GetWidth(const char16_t *aString, uint32_t aLength)
{
@@ -175,59 +137,3 @@ nsRenderingContext::GetBoundingMetrics(const char16_t* aString,
}
return totalMetrics;
}
-
-void
-nsRenderingContext::DrawString(const char *aString, uint32_t aLength,
- nscoord aX, nscoord aY)
-{
- uint32_t maxChunkLength = GetMaxChunkLength();
- while (aLength > 0) {
- int32_t len = FindSafeLength(aString, aLength, maxChunkLength);
- mFontMetrics->DrawString(aString, len, aX, aY, this);
- aLength -= len;
-
- if (aLength > 0) {
- nscoord width = mFontMetrics->GetWidth(aString, len, this);
- aX += width;
- aString += len;
- }
- }
-}
-
-void
-nsRenderingContext::DrawString(const nsString& aString, nscoord aX, nscoord aY)
-{
- DrawString(aString.get(), aString.Length(), aX, aY);
-}
-
-void
-nsRenderingContext::DrawString(const char16_t *aString, uint32_t aLength,
- nscoord aX, nscoord aY)
-{
- uint32_t maxChunkLength = GetMaxChunkLength();
- if (aLength <= maxChunkLength) {
- mFontMetrics->DrawString(aString, aLength, aX, aY, this, this);
- return;
- }
-
- bool isRTL = mFontMetrics->GetTextRunRTL();
-
- // If we're drawing right to left, we must start at the end.
- if (isRTL) {
- aX += GetWidth(aString, aLength);
- }
-
- while (aLength > 0) {
- int32_t len = FindSafeLength(aString, aLength, maxChunkLength);
- nscoord width = mFontMetrics->GetWidth(aString, len, this);
- if (isRTL) {
- aX -= width;
- }
- mFontMetrics->DrawString(aString, len, aX, aY, this, this);
- if (!isRTL) {
- aX += width;
- }
- aLength -= len;
- aString += len;
- }
-}
diff --git a/gfx/src/nsRenderingContext.h b/gfx/src/nsRenderingContext.h
index e3e3bda59f7..0a36f5e3557 100644
--- a/gfx/src/nsRenderingContext.h
+++ b/gfx/src/nsRenderingContext.h
@@ -47,30 +47,22 @@ public:
void SetTextRunRTL(bool aIsRTL);
- nscoord GetWidth(char aC);
nscoord GetWidth(char16_t aC);
nscoord GetWidth(const nsString& aString);
- nscoord GetWidth(const char* aString);
- nscoord GetWidth(const char* aString, uint32_t aLength);
nscoord GetWidth(const char16_t *aString, uint32_t aLength);
nsBoundingMetrics GetBoundingMetrics(const char16_t *aString,
uint32_t aLength);
- void DrawString(const nsString& aString, nscoord aX, nscoord aY);
- void DrawString(const char *aString, uint32_t aLength,
- nscoord aX, nscoord aY);
- void DrawString(const char16_t *aString, uint32_t aLength,
- nscoord aX, nscoord aY);
-
+ int32_t GetMaxChunkLength();
+ static int32_t FindSafeLength(const char16_t *aString, uint32_t aLength,
+ uint32_t aMaxChunkLength);
private:
// Private destructor, to discourage deletion outside of Release():
~nsRenderingContext()
{
}
- int32_t GetMaxChunkLength();
-
nsRefPtr mThebes;
nsRefPtr mFontMetrics;
};
diff --git a/gfx/thebes/gfxContext.cpp b/gfx/thebes/gfxContext.cpp
index 67cc2934fc4..d229edb6b34 100644
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -549,28 +549,6 @@ gfxContext::UserToDevicePixelSnapped(gfxPoint& pt, bool ignoreScale) const
return true;
}
-void
-gfxContext::PixelSnappedRectangleAndSetPattern(const gfxRect& rect,
- gfxPattern *pattern)
-{
- gfxRect r(rect);
-
- // Bob attempts to pixel-snap the rectangle, and returns true if
- // the snapping succeeds. If it does, we need to set up an
- // identity matrix, because the rectangle given back is in device
- // coordinates.
- //
- // We then have to call a translate to dr.pos afterwards, to make
- // sure the image lines up in the right place with our pixel
- // snapped rectangle.
- //
- // If snapping wasn't successful, we just translate to where the
- // pattern would normally start (in app coordinates) and do the
- // same thing.
- Rectangle(r, true);
- SetPattern(pattern);
-}
-
void
gfxContext::SetAntialiasMode(AntialiasMode mode)
{
diff --git a/gfx/thebes/gfxContext.h b/gfx/thebes/gfxContext.h
index 5f95d1d3e28..d72be7958ec 100644
--- a/gfx/thebes/gfxContext.h
+++ b/gfx/thebes/gfxContext.h
@@ -308,15 +308,6 @@ public:
*/
bool UserToDevicePixelSnapped(gfxPoint& pt, bool ignoreScale = false) const;
- /**
- * Attempts to pixel snap the rectangle, add it to the current
- * path, and to set pattern as the current painting source. This
- * should be used for drawing filled pixel-snapped rectangles (like
- * images), because the CTM at the time of the SetPattern call needs
- * to have a snapped translation, or you get smeared images.
- */
- void PixelSnappedRectangleAndSetPattern(const gfxRect& rect, gfxPattern *pattern);
-
/**
** Painting sources
**/
diff --git a/gfx/thebes/gfxQuartzNativeDrawing.cpp b/gfx/thebes/gfxQuartzNativeDrawing.cpp
index 0e88ad8bf95..ec05a6bda1e 100644
--- a/gfx/thebes/gfxQuartzNativeDrawing.cpp
+++ b/gfx/thebes/gfxQuartzNativeDrawing.cpp
@@ -4,18 +4,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "gfxQuartzNativeDrawing.h"
-#include "gfxQuartzSurface.h"
#include "gfxPlatform.h"
-#include "cairo-quartz.h"
-#include "gfx2DGlue.h"
+#include "mozilla/gfx/Helpers.h"
using namespace mozilla::gfx;
using namespace mozilla;
-gfxQuartzNativeDrawing::gfxQuartzNativeDrawing(gfxContext* ctx,
- const gfxRect& nativeRect)
- : mContext(ctx)
- , mNativeRect(ToRect(nativeRect))
+gfxQuartzNativeDrawing::gfxQuartzNativeDrawing(DrawTarget& aDrawTarget,
+ const Rect& nativeRect)
+ : mDrawTarget(&aDrawTarget)
+ , mNativeRect(nativeRect)
, mCGContext(nullptr)
{
}
@@ -25,32 +23,32 @@ gfxQuartzNativeDrawing::BeginNativeDrawing()
{
NS_ASSERTION(!mCGContext, "BeginNativeDrawing called when drawing already in progress");
- DrawTarget *dt = mContext->GetDrawTarget();
+ DrawTarget *dt = mDrawTarget;
if (dt->GetBackendType() != BackendType::COREGRAPHICS ||
dt->IsDualDrawTarget() ||
dt->IsTiledDrawTarget()) {
+ // We need a DrawTarget that we can get a CGContextRef from:
Matrix transform = dt->GetTransform();
+
mNativeRect = transform.TransformBounds(mNativeRect);
mNativeRect.RoundOut();
-
// Quartz theme drawing often adjusts drawing rects, so make
// sure our surface is big enough for that.
mNativeRect.Inflate(5);
-
if (mNativeRect.IsEmpty()) {
return nullptr;
}
- mDrawTarget = Factory::CreateDrawTarget(BackendType::COREGRAPHICS,
- IntSize(mNativeRect.width, mNativeRect.height),
- SurfaceFormat::B8G8R8A8);
+ mTempDrawTarget =
+ Factory::CreateDrawTarget(BackendType::COREGRAPHICS,
+ IntSize(mNativeRect.width, mNativeRect.height),
+ SurfaceFormat::B8G8R8A8);
transform.PostTranslate(-mNativeRect.x, -mNativeRect.y);
+ mTempDrawTarget->SetTransform(transform);
- mDrawTarget->SetTransform(transform);
- dt = mDrawTarget;
+ dt = mTempDrawTarget;
}
-
mCGContext = mBorrowedContext.Init(dt);
MOZ_ASSERT(mCGContext);
return mCGContext;
@@ -62,18 +60,12 @@ gfxQuartzNativeDrawing::EndNativeDrawing()
NS_ASSERTION(mCGContext, "EndNativeDrawing called without BeginNativeDrawing");
mBorrowedContext.Finish();
- if (mDrawTarget) {
- DrawTarget *dest = mContext->GetDrawTarget();
- RefPtr source = mDrawTarget->Snapshot();
+ if (mTempDrawTarget) {
+ RefPtr source = mTempDrawTarget->Snapshot();
- Matrix oldTransform = dest->GetTransform();
- dest->SetTransform(Matrix());
-
- dest->DrawSurface(source,
- mNativeRect,
- gfx::Rect(0, 0, mNativeRect.width, mNativeRect.height));
-
-
- dest->SetTransform(oldTransform);
+ AutoRestoreTransform autoRestore(mDrawTarget);
+ mDrawTarget->SetTransform(Matrix());
+ mDrawTarget->DrawSurface(source, mNativeRect,
+ Rect(0, 0, mNativeRect.width, mNativeRect.height));
}
}
diff --git a/gfx/thebes/gfxQuartzNativeDrawing.h b/gfx/thebes/gfxQuartzNativeDrawing.h
index d4b90732ceb..ba1430c64fc 100644
--- a/gfx/thebes/gfxQuartzNativeDrawing.h
+++ b/gfx/thebes/gfxQuartzNativeDrawing.h
@@ -8,12 +8,13 @@
#include "mozilla/Attributes.h"
-#include "gfxContext.h"
-#include "gfxQuartzSurface.h"
+#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/BorrowedContext.h"
-#include "nsAutoPtr.h"
+#include "mozilla/RefPtr.h"
class gfxQuartzNativeDrawing {
+ typedef mozilla::gfx::DrawTarget DrawTarget;
+ typedef mozilla::gfx::Rect Rect;
public:
/* Create native Quartz drawing for a rectangle bounded by
@@ -33,16 +34,16 @@ public:
* aNativeRect is the size of the surface (in Quartz/Cocoa points) that
* will be created _if_ the gfxQuartzNativeDrawing decides to create a new
* surface and CGContext for its drawing operations, which it then
- * composites into the target gfxContext.
+ * composites into the target DrawTarget.
*
* (Note that aNativeRect will be ignored if the gfxQuartzNativeDrawing
- * uses the target gfxContext directly.)
+ * uses the target DrawTarget directly.)
*
* The optional aBackingScale parameter is a scaling factor that will be
* applied when creating and rendering into such a temporary surface.
*/
- gfxQuartzNativeDrawing(gfxContext *ctx,
- const gfxRect& aNativeRect);
+ gfxQuartzNativeDrawing(DrawTarget& aDrawTarget,
+ const Rect& aNativeRect);
/* Returns a CGContextRef which may be used for native drawing. This
* CGContextRef is valid until EndNativeDrawing is called; if it is used
@@ -58,8 +59,8 @@ private:
const gfxQuartzNativeDrawing& operator=(const gfxQuartzNativeDrawing&) MOZ_DELETE;
// Final destination context
- nsRefPtr mContext;
- mozilla::RefPtr mDrawTarget;
+ mozilla::RefPtr mDrawTarget;
+ mozilla::RefPtr mTempDrawTarget;
mozilla::gfx::BorrowedCGContext mBorrowedContext;
mozilla::gfx::Rect mNativeRect;
diff --git a/ipc/glue/BackgroundImpl.cpp b/ipc/glue/BackgroundImpl.cpp
index df361894d78..006c29c3f56 100644
--- a/ipc/glue/BackgroundImpl.cpp
+++ b/ipc/glue/BackgroundImpl.cpp
@@ -1347,6 +1347,7 @@ ParentImpl::CloneToplevel(const InfallibleTArray& aFds,
{
AssertIsInMainProcess();
AssertIsOnMainThread();
+ MOZ_ASSERT(aCtx->GetContentParent());
const ProtocolId protocolId = GetProtocolId();
@@ -1363,7 +1364,7 @@ ParentImpl::CloneToplevel(const InfallibleTArray& aFds,
}
PBackgroundParent* clonedActor =
- Alloc(mContent, transport, base::GetProcId(aPeerProcess));
+ Alloc(aCtx->GetContentParent(), transport, base::GetProcId(aPeerProcess));
MOZ_ASSERT(clonedActor);
clonedActor->CloneManagees(this, aCtx);
diff --git a/js/src/Makefile.in b/js/src/Makefile.in
index ada06a5ab41..0ad2a170d55 100644
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -134,7 +134,9 @@ check-style::
check-jit-test::
$(JITTEST_ASAN_ENV) $(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/jit-test/jit_test.py \
- --no-slow --no-progress --tinderbox --tbpl $(JITTEST_VALGRIND_FLAG) \
+ --no-slow --no-progress --tinderbox --tbpl \
+ $(JITTEST_VALGRIND_FLAG) \
+ $(JITTEST_EXTRA_ARGS) \
$(DIST)/bin/$(JS_SHELL_NAME)$(BIN_SUFFIX)
check:: check-style
diff --git a/js/src/devtools/automation/autospider.sh b/js/src/devtools/automation/autospider.sh
index c86148a98cb..7ee6bae463a 100755
--- a/js/src/devtools/automation/autospider.sh
+++ b/js/src/devtools/automation/autospider.sh
@@ -116,6 +116,9 @@ elif [[ "$VARIANT" = "generational" ]]; then
# Generational is currently being used for compacting GC
export JS_GC_ZEAL=14
+ # Ignore timeouts from tests that are known to take too long with this zeal mode
+ export JITTEST_EXTRA_ARGS=--ignore-timeouts=$ABSDIR/cgc-jittest-timeouts.txt
+
# rootanalysis builds are currently only done on Linux, which should have
# setarch, but just in case we enable them on another platform:
if type setarch >/dev/null 2>&1; then
@@ -125,5 +128,7 @@ fi
$COMMAND_PREFIX $MAKE check || exit 1
$COMMAND_PREFIX $MAKE check-jit-test || exit 1
-$COMMAND_PREFIX $MAKE check-jstests || exit 1
+if [[ "$VARIANT" != "generational" ]]; then
+ $COMMAND_PREFIX $MAKE check-jstests || exit 1
+fi
$COMMAND_PREFIX $OBJDIR/dist/bin/jsapi-tests || exit 1
diff --git a/js/src/devtools/automation/cgc-jittest-timeouts.txt b/js/src/devtools/automation/cgc-jittest-timeouts.txt
new file mode 100644
index 00000000000..6ec6679806d
--- /dev/null
+++ b/js/src/devtools/automation/cgc-jittest-timeouts.txt
@@ -0,0 +1,15 @@
+auto-regress/bug653395.js
+auto-regress/bug675251.js
+basic/bug632964-regexp.js
+basic/testBug614653.js
+basic/testBug686274.js
+basic/testTypedArrayInit.js
+gc/bug-1014972.js
+gc/bug-906236.js
+gc/bug-906241.js
+parallel/alloc-many-objs.js
+parallel/alloc-too-many-objs.js
+self-test/assertDeepEq.js
+v8-v5/check-splay.js
+baseline/bug847446.js
+baseline/bug852175.js
diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h
index 4304c3e8400..8251b182e54 100644
--- a/js/src/gc/Barrier.h
+++ b/js/src/gc/Barrier.h
@@ -161,7 +161,7 @@ class Symbol;
namespace js {
-class NativeObject;
+class AccessorShape;
class ArrayObject;
class ArgumentsObject;
class ArrayBufferObjectMaybeShared;
@@ -173,6 +173,7 @@ class BaseShape;
class DebugScopeObject;
class GlobalObject;
class LazyScript;
+class NativeObject;
class NestedScopeObject;
class Nursery;
class PropertyName;
@@ -226,6 +227,7 @@ template <> struct MapTypeToTraceKind { static const JSGCTrace
template <> struct MapTypeToTraceKind { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
template <> struct MapTypeToTraceKind { static const JSGCTraceKind kind = JSTRACE_OBJECT; };
template <> struct MapTypeToTraceKind { static const JSGCTraceKind kind = JSTRACE_SHAPE; };
+template <> struct MapTypeToTraceKind { static const JSGCTraceKind kind = JSTRACE_SHAPE; };
template <> struct MapTypeToTraceKind{ static const JSGCTraceKind kind = JSTRACE_OBJECT; };
template <> struct MapTypeToTraceKind{ static const JSGCTraceKind kind = JSTRACE_OBJECT; };
template <> struct MapTypeToTraceKind { static const JSGCTraceKind kind = JSTRACE_BASE_SHAPE; };
diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h
index 7de9ef8ea80..e33451d276e 100644
--- a/js/src/gc/GCRuntime.h
+++ b/js/src/gc/GCRuntime.h
@@ -512,6 +512,7 @@ class GCRuntime
void assertBackgroundSweepingFinished();
bool shouldCompact();
#ifdef JSGC_COMPACTING
+ void sweepTypesAfterCompacting(Zone *zone);
void sweepZoneAfterCompacting(Zone *zone);
void compactPhase();
ArenaHeader *relocateArenas();
diff --git a/js/src/gc/Heap.h b/js/src/gc/Heap.h
index bad1d6aa282..d3913f9a0ed 100644
--- a/js/src/gc/Heap.h
+++ b/js/src/gc/Heap.h
@@ -628,6 +628,11 @@ struct ArenaHeader : public JS::shadow::ArenaHeader
inline void unsetAllocDuringSweep();
void unmarkAll();
+
+#ifdef JSGC_COMPACTING
+ size_t countUsedCells();
+ size_t countFreeCells();
+#endif
};
struct Arena
diff --git a/js/src/jit-test/tests/TypedObject/bug976697.js b/js/src/jit-test/tests/TypedObject/bug976697.js
index bd77a6a9194..fa1a5de5517 100644
--- a/js/src/jit-test/tests/TypedObject/bug976697.js
+++ b/js/src/jit-test/tests/TypedObject/bug976697.js
@@ -4,12 +4,12 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/
-x = ArrayBuffer();
+x = new ArrayBuffer();
neuter(x, "same-data");
-Uint32Array(x);
+new Uint32Array(x);
gc();
-x = ArrayBuffer();
+x = new ArrayBuffer();
neuter(x, "change-data");
-Uint32Array(x);
+new Uint32Array(x);
gc();
diff --git a/js/src/jit-test/tests/auto-regress/bug609287.js b/js/src/jit-test/tests/auto-regress/bug609287.js
index f8c7a48f1c0..0e40fad1a60 100644
--- a/js/src/jit-test/tests/auto-regress/bug609287.js
+++ b/js/src/jit-test/tests/auto-regress/bug609287.js
@@ -9,7 +9,7 @@ f = eval("\
Proxy.createFunction((\
function() {\
return {\
- has: ArrayBuffer,\
+ has: new ArrayBuffer,\
}\
})\
(\"\"), \
diff --git a/js/src/jit-test/tests/auto-regress/bug743000.js b/js/src/jit-test/tests/auto-regress/bug743000.js
index 3b2326dfc72..ffc56771f3d 100644
--- a/js/src/jit-test/tests/auto-regress/bug743000.js
+++ b/js/src/jit-test/tests/auto-regress/bug743000.js
@@ -1,4 +1,4 @@
// Binary: cache/js-dbg-64-1da11a2bc5db-linux
// Flags:
//
-Int32Array(wrap(new Uint8ClampedArray))
+new Int32Array(wrap(new Uint8ClampedArray))
diff --git a/js/src/jit-test/tests/basic/bug578041.js b/js/src/jit-test/tests/basic/bug578041.js
index 0ab8878d074..59a1f2910d8 100644
--- a/js/src/jit-test/tests/basic/bug578041.js
+++ b/js/src/jit-test/tests/basic/bug578041.js
@@ -1,3 +1,3 @@
-this.__defineGetter__('x', Float32Array);
+this.__defineGetter__('x', () => new Float32Array());
with(this)
x;
diff --git a/js/src/jit-test/tests/basic/bug710947.js b/js/src/jit-test/tests/basic/bug710947.js
index 8db7691548d..2782880206c 100644
--- a/js/src/jit-test/tests/basic/bug710947.js
+++ b/js/src/jit-test/tests/basic/bug710947.js
@@ -5,4 +5,4 @@ function startTest() {
};
gczeal(4);
startTest();
-ArrayBuffer( 8192 );
+new ArrayBuffer( 8192 );
diff --git a/js/src/jit-test/tests/basic/bug836601.js b/js/src/jit-test/tests/basic/bug836601.js
index 0dbf8c92a9e..1080e7ea24c 100644
--- a/js/src/jit-test/tests/basic/bug836601.js
+++ b/js/src/jit-test/tests/basic/bug836601.js
@@ -2,7 +2,7 @@
let k
Proxy.createFunction(function() {
return {
- get: Uint32Array
+ get: (n) => new Uint32Array(n)
}
}(), decodeURIComponent) & k
diff --git a/js/src/jit-test/tests/basic/bug984766.js b/js/src/jit-test/tests/basic/bug984766.js
index e667e35d3f0..9636282dbb6 100644
--- a/js/src/jit-test/tests/basic/bug984766.js
+++ b/js/src/jit-test/tests/basic/bug984766.js
@@ -1,7 +1,7 @@
for (var i = 0; i < 10; i++) {
- x = ArrayBuffer(4)
+ x = new ArrayBuffer(4)
x.f = (function() {})
- Uint16Array(x).set(JSON.parse)
+ new Uint16Array(x).set(JSON.parse)
gcslice()
}
diff --git a/js/src/jit-test/tests/basic/testBug606138.js b/js/src/jit-test/tests/basic/testBug606138.js
index 155a19f5b45..141bf253450 100644
--- a/js/src/jit-test/tests/basic/testBug606138.js
+++ b/js/src/jit-test/tests/basic/testBug606138.js
@@ -1,3 +1,3 @@
// The proxy is going to mutate thisv in place. InvokeSessionGuard should be
// cool with that
-with(evalcx(''))[7, 8].map(Int16Array, [])
+with(evalcx(''))[7, 8].map((n) => new Int16Array(n), [])
diff --git a/js/src/jit-test/tests/basic/testSlowNativeWithNullThis.js b/js/src/jit-test/tests/basic/testSlowNativeWithNullThis.js
index 0d300f212f8..b90b4f10d74 100644
--- a/js/src/jit-test/tests/basic/testSlowNativeWithNullThis.js
+++ b/js/src/jit-test/tests/basic/testSlowNativeWithNullThis.js
@@ -1,6 +1,6 @@
x = 0
for (a = 0; a < 3; a++) {
- (function () {
+ new ((function () {
return Float64Array
- })()(x, 1)
+ })())(x, 1)
}
diff --git a/js/src/jit-test/tests/basic/testTypedArrayInit.js b/js/src/jit-test/tests/basic/testTypedArrayInit.js
index 98a017de99d..1d85017d1ce 100644
--- a/js/src/jit-test/tests/basic/testTypedArrayInit.js
+++ b/js/src/jit-test/tests/basic/testTypedArrayInit.js
@@ -12,7 +12,7 @@ function f() {
Float64Array ])
{
for (var len of [ 3, 30, 300, 3000, 30000 ]) {
- var arr = ctor(len);
+ var arr = new ctor(len);
for (var i = 0; i < arr.length; i++)
assertEq(arr[i], 0, "index " + i + " of " + ctor.name + " len " + len);
}
diff --git a/js/src/jit-test/tests/for-of/typedarrays-6.js b/js/src/jit-test/tests/for-of/typedarrays-6.js
index d91d8f3026d..90853f30fe7 100644
--- a/js/src/jit-test/tests/for-of/typedarrays-6.js
+++ b/js/src/jit-test/tests/for-of/typedarrays-6.js
@@ -3,7 +3,7 @@
var values = [Infinity, -Infinity, -0, NaN];
for (var C of [Float32Array, Float64Array]) {
var i = 0;
- for (var v of C(values))
+ for (var v of new C(values))
assertEq(v, values[i++]);
assertEq(i, values.length);
}
diff --git a/js/src/jit-test/tests/ion/bug1054753.js b/js/src/jit-test/tests/ion/bug1054753.js
index 8880efcff4a..1c09352bba4 100644
--- a/js/src/jit-test/tests/ion/bug1054753.js
+++ b/js/src/jit-test/tests/ion/bug1054753.js
@@ -1,7 +1,7 @@
// |jit-test| error: TypeError
if (typeof Symbol === "function") {
g = (function() {
- var Int32ArrayView = Int32Array();
+ var Int32ArrayView = new Int32Array();
function f() {
Int32ArrayView[Symbol() >> 2]
}
diff --git a/js/src/jit-test/tests/ion/bug858586.js b/js/src/jit-test/tests/ion/bug858586.js
index 5f8a46c0e4b..ce4de29b149 100644
--- a/js/src/jit-test/tests/ion/bug858586.js
+++ b/js/src/jit-test/tests/ion/bug858586.js
@@ -14,7 +14,7 @@ function makeArray(n) {
function runner(arr, resultArray, len) {
for (var i = 0; i < len; i++) {
var obj = arr[i];
- resultArray[0] += obj.foo(i);
+ resultArray[0] += new obj.foo(i);
}
}
var resultArray = [0];
diff --git a/js/src/jit-test/tests/jaeger/bug585341.js b/js/src/jit-test/tests/jaeger/bug585341.js
index 1a4933c6d5b..7c192029b8b 100644
--- a/js/src/jit-test/tests/jaeger/bug585341.js
+++ b/js/src/jit-test/tests/jaeger/bug585341.js
@@ -1,4 +1,4 @@
-this.__defineGetter__("x", Float64Array)
+this.__defineGetter__("x", () => new Float64Array())
Function("\
with(this) {\
eval(\"x\")\
diff --git a/js/src/jit-test/tests/parallel/bug1033115-2.js b/js/src/jit-test/tests/parallel/bug1033115-2.js
index fb02a2f5cbf..3db0417c7d4 100644
--- a/js/src/jit-test/tests/parallel/bug1033115-2.js
+++ b/js/src/jit-test/tests/parallel/bug1033115-2.js
@@ -9,13 +9,13 @@ y = x.mapPar(function() {});
Object.defineProperty(y, 3, {
get: (function( ... $8) {
try {
- Int8Array(y);
+ new Int8Array(y);
x.reducePar(function() function q() 1);
} catch (e) {}
})
});
var x = [1,2,3];
-function rsh() {
- return y.toSource() >> 2.0;
+function rsh() {
+ return y.toSource() >> 2.0;
}
rsh();
diff --git a/js/src/jit-test/tests/parallel/bug983558.js b/js/src/jit-test/tests/parallel/bug983558.js
index 727ae4f8251..8900b6b1a3d 100644
--- a/js/src/jit-test/tests/parallel/bug983558.js
+++ b/js/src/jit-test/tests/parallel/bug983558.js
@@ -7,7 +7,7 @@ y = x.mapPar(function() {});
Object.defineProperty(y, 3, {
get: (function() {
try {
- Int8Array(y);
+ new Int8Array(y);
x.reducePar(function() {});
} catch (e) { print(e); }
})
diff --git a/js/src/jit-test/tests/saved-stacks/asm-frames.js b/js/src/jit-test/tests/saved-stacks/asm-frames.js
index 363e449127a..ca69f4564e4 100644
--- a/js/src/jit-test/tests/saved-stacks/asm-frames.js
+++ b/js/src/jit-test/tests/saved-stacks/asm-frames.js
@@ -19,7 +19,7 @@ function tester() {
stack = saveStack();
}
-const buf = ArrayBuffer(1024*8);
+const buf = new ArrayBuffer(1024*8);
const module = AsmModule(this, { t: tester }, buf);
module.test();
diff --git a/js/src/jit-test/tests/xdr/lazy.js b/js/src/jit-test/tests/xdr/lazy.js
index 4f1681f14cf..a9e52d079b5 100644
--- a/js/src/jit-test/tests/xdr/lazy.js
+++ b/js/src/jit-test/tests/xdr/lazy.js
@@ -102,6 +102,10 @@ test = (function () {
})();
evalWithCache(test, { assertEqBytecode: true });
+// Extra zeal GCs can cause isRelazifiableFunction() to become true after we
+// record its value by throwing away JIT code for the function.
+gczeal(0);
+
// Ensure that decoded functions can be relazified.
test = "function f() { }; f();"
+ "assertEq(isLazyFunction(f), false);"
diff --git a/js/src/jit/IonCode.h b/js/src/jit/IonCode.h
index dcc18fc28b1..eb5240e16d2 100644
--- a/js/src/jit/IonCode.h
+++ b/js/src/jit/IonCode.h
@@ -102,6 +102,7 @@ class JitCode : public gc::TenuredCell
}
void trace(JSTracer *trc);
void finalize(FreeOp *fop);
+ void fixupAfterMovingGC() {}
void setInvalidated() {
invalidated_ = true;
}
diff --git a/js/src/jit/shared/BaseAssembler-x86-shared.h b/js/src/jit/shared/BaseAssembler-x86-shared.h
index 39ad4316ef7..dacb8abd022 100644
--- a/js/src/jit/shared/BaseAssembler-x86-shared.h
+++ b/js/src/jit/shared/BaseAssembler-x86-shared.h
@@ -528,16 +528,14 @@ public:
void push_i32(int imm)
{
- spew("push %s$0x%x",
- PRETTY_PRINT_OFFSET(imm));
+ spew("push %s$0x%x", PRETTY_PRINT_OFFSET(imm));
m_formatter.oneByteOp(OP_PUSH_Iz);
m_formatter.immediate32(imm);
}
void push_m(int offset, RegisterID base)
{
- spew("push %s0x%x(%s)",
- PRETTY_PRINT_OFFSET(offset), nameIReg(base));
+ spew("push %s0x%x(%s)", PRETTY_PRINT_OFFSET(offset), nameIReg(base));
m_formatter.oneByteOp(OP_GROUP5_Ev, GROUP5_OP_PUSH, base, offset);
}
@@ -577,8 +575,7 @@ public:
void addl_rr(RegisterID src, RegisterID dst)
{
- spew("addl %s, %s",
- nameIReg(4,src), nameIReg(4,dst));
+ spew("addl %s, %s", nameIReg(4,src), nameIReg(4,dst));
m_formatter.oneByteOp(OP_ADD_EvGv, src, dst);
}
@@ -624,8 +621,7 @@ public:
#ifdef JS_CODEGEN_X64
void addq_rr(RegisterID src, RegisterID dst)
{
- spew("addq %s, %s",
- nameIReg(8,src), nameIReg(8,dst));
+ spew("addq %s, %s", nameIReg(8,src), nameIReg(8,dst));
m_formatter.oneByteOp64(OP_ADD_EvGv, src, dst);
}
@@ -638,8 +634,7 @@ public:
void addq_mr(const void* addr, RegisterID dst)
{
- spew("addq %p, %s",
- addr, nameIReg(8, dst));
+ spew("addq %p, %s", addr, nameIReg(8, dst));
m_formatter.oneByteOp64(OP_ADD_GvEv, dst, addr);
}
@@ -741,8 +736,7 @@ public:
}
void paddd_mr(const void* address, XMMRegisterID dst)
{
- spew("paddd %p, %s",
- address, nameFPReg(dst));
+ spew("paddd %p, %s", address, nameFPReg(dst));
m_formatter.prefix(PRE_SSE_66);
m_formatter.twoByteOp(OP2_PADDD_VdqWdq, (RegisterID)dst, address);
}
@@ -762,16 +756,14 @@ public:
}
void psubd_mr(const void* address, XMMRegisterID dst)
{
- spew("psubd %p, %s",
- address, nameFPReg(dst));
+ spew("psubd %p, %s", address, nameFPReg(dst));
m_formatter.prefix(PRE_SSE_66);
m_formatter.twoByteOp(OP2_PSUBD_VdqWdq, (RegisterID)dst, address);
}
void addps_rr(XMMRegisterID src, XMMRegisterID dst)
{
- spew("addps %s, %s",
- nameFPReg(src), nameFPReg(dst));
+ spew("addps %s, %s", nameFPReg(src), nameFPReg(dst));
m_formatter.twoByteOp(OP2_ADDPS_VpsWps, (RegisterID)dst, (RegisterID)src);
}
void addps_mr(int offset, RegisterID base, XMMRegisterID dst)
@@ -782,15 +774,13 @@ public:
}
void addps_mr(const void* address, XMMRegisterID dst)
{
- spew("addps %p, %s",
- address, nameFPReg(dst));
+ spew("addps %p, %s", address, nameFPReg(dst));
m_formatter.twoByteOp(OP2_ADDPS_VpsWps, (RegisterID)dst, address);
}
void subps_rr(XMMRegisterID src, XMMRegisterID dst)
{
- spew("subps %s, %s",
- nameFPReg(src), nameFPReg(dst));
+ spew("subps %s, %s", nameFPReg(src), nameFPReg(dst));
m_formatter.twoByteOp(OP2_SUBPS_VpsWps, (RegisterID)dst, (RegisterID)src);
}
void subps_mr(int offset, RegisterID base, XMMRegisterID dst)
@@ -801,15 +791,13 @@ public:
}
void subps_mr(const void* address, XMMRegisterID dst)
{
- spew("subps %p, %s",
- address, nameFPReg(dst));
+ spew("subps %p, %s", address, nameFPReg(dst));
m_formatter.twoByteOp(OP2_SUBPS_VpsWps, (RegisterID)dst, address);
}
void mulps_rr(XMMRegisterID src, XMMRegisterID dst)
{
- spew("mulps %s, %s",
- nameFPReg(src), nameFPReg(dst));
+ spew("mulps %s, %s", nameFPReg(src), nameFPReg(dst));
m_formatter.twoByteOp(OP2_MULPS_VpsWps, (RegisterID)dst, (RegisterID)src);
}
void mulps_mr(int offset, RegisterID base, XMMRegisterID dst)
@@ -820,15 +808,13 @@ public:
}
void mulps_mr(const void* address, XMMRegisterID dst)
{
- spew("mulps %p, %s",
- address, nameFPReg(dst));
+ spew("mulps %p, %s", address, nameFPReg(dst));
m_formatter.twoByteOp(OP2_MULPS_VpsWps, (RegisterID)dst, address);
}
void divps_rr(XMMRegisterID src, XMMRegisterID dst)
{
- spew("divps %s, %s",
- nameFPReg(src), nameFPReg(dst));
+ spew("divps %s, %s", nameFPReg(src), nameFPReg(dst));
m_formatter.twoByteOp(OP2_DIVPS_VpsWps, (RegisterID)dst, (RegisterID)src);
}
void divps_mr(int offset, RegisterID base, XMMRegisterID dst)
@@ -839,15 +825,13 @@ public:
}
void divps_mr(const void* address, XMMRegisterID dst)
{
- spew("divps %p, %s",
- address, nameFPReg(dst));
+ spew("divps %p, %s", address, nameFPReg(dst));
m_formatter.twoByteOp(OP2_DIVPS_VpsWps, (RegisterID)dst, address);
}
void maxps_rr(XMMRegisterID src, XMMRegisterID dst)
{
- spew("maxps %s, %s",
- nameFPReg(src), nameFPReg(dst));
+ spew("maxps %s, %s", nameFPReg(src), nameFPReg(dst));
m_formatter.twoByteOp(OP2_MAXPS_VpsWps, (RegisterID)dst, (RegisterID)src);
}
void maxps_mr(int offset, RegisterID base, XMMRegisterID dst)
@@ -858,15 +842,13 @@ public:
}
void maxps_mr(const void* address, XMMRegisterID dst)
{
- spew("maxps %p, %s",
- address, nameFPReg(dst));
+ spew("maxps %p, %s", address, nameFPReg(dst));
m_formatter.twoByteOp(OP2_MAXPS_VpsWps, (RegisterID)dst, address);
}
void minps_rr(XMMRegisterID src, XMMRegisterID dst)
{
- spew("minps %s, %s",
- nameFPReg(src), nameFPReg(dst));
+ spew("minps %s, %s", nameFPReg(src), nameFPReg(dst));
m_formatter.twoByteOp(OP2_MINPS_VpsWps, (RegisterID)dst, (RegisterID)src);
}
void minps_mr(int offset, RegisterID base, XMMRegisterID dst)
@@ -877,15 +859,13 @@ public:
}
void minps_mr(const void* address, XMMRegisterID dst)
{
- spew("minps %p, %s",
- address, nameFPReg(dst));
+ spew("minps %p, %s", address, nameFPReg(dst));
m_formatter.twoByteOp(OP2_MINPS_VpsWps, (RegisterID)dst, address);
}
void andl_rr(RegisterID src, RegisterID dst)
{
- spew("andl %s, %s",
- nameIReg(4,src), nameIReg(4,dst));
+ spew("andl %s, %s", nameIReg(4,src), nameIReg(4,dst));
m_formatter.oneByteOp(OP_AND_EvGv, src, dst);
}
@@ -931,8 +911,7 @@ public:
#ifdef JS_CODEGEN_X64
void andq_rr(RegisterID src, RegisterID dst)
{
- spew("andq %s, %s",
- nameIReg(8,src), nameIReg(8,dst));
+ spew("andq %s, %s", nameIReg(8,src), nameIReg(8,dst));
m_formatter.oneByteOp64(OP_AND_EvGv, src, dst);
}
@@ -953,8 +932,7 @@ public:
void andq_mr(const void *addr, RegisterID dst)
{
- spew("andq %p, %s",
- addr, nameIReg(8,dst));
+ spew("andq %p, %s", addr, nameIReg(8,dst));
m_formatter.oneByteOp64(OP_AND_GvEv, dst, addr);
}
@@ -967,8 +945,7 @@ public:
void orq_mr(const void* addr, RegisterID dst)
{
- spew("orq %p, %s",
- addr, nameIReg(8, dst));
+ spew("orq %p, %s", addr, nameIReg(8, dst));
m_formatter.oneByteOp64(OP_OR_GvEv, dst, addr);
}
@@ -1049,8 +1026,7 @@ public:
void orl_rr(RegisterID src, RegisterID dst)
{
- spew("orl %s, %s",
- nameIReg(4,src), nameIReg(4,dst));
+ spew("orl %s, %s", nameIReg(4,src), nameIReg(4,dst));
m_formatter.oneByteOp(OP_OR_EvGv, src, dst);
}
@@ -1102,8 +1078,7 @@ public:
void orq_rr(RegisterID src, RegisterID dst)
{
- spew("orq %s, %s",
- nameIReg(8,src), nameIReg(8,dst));
+ spew("orq %s, %s", nameIReg(8,src), nameIReg(8,dst));
m_formatter.oneByteOp64(OP_OR_EvGv, src, dst);
}
@@ -1140,8 +1115,7 @@ public:
void subl_rr(RegisterID src, RegisterID dst)
{
- spew("subl %s, %s",
- nameIReg(4,src), nameIReg(4,dst));
+ spew("subl %s, %s", nameIReg(4,src), nameIReg(4,dst));
m_formatter.oneByteOp(OP_SUB_EvGv, src, dst);
}
@@ -1187,8 +1161,7 @@ public:
#ifdef JS_CODEGEN_X64
void subq_rr(RegisterID src, RegisterID dst)
{
- spew("subq %s, %s",
- nameIReg(8,src), nameIReg(8,dst));
+ spew("subq %s, %s", nameIReg(8,src), nameIReg(8,dst));
m_formatter.oneByteOp64(OP_SUB_EvGv, src, dst);
}
@@ -1208,8 +1181,7 @@ public:
void subq_mr(const void* addr, RegisterID dst)
{
- spew("subq %p, %s",
- addr, nameIReg(8, dst));
+ spew("subq %p, %s", addr, nameIReg(8, dst));
m_formatter.oneByteOp64(OP_SUB_GvEv, dst, addr);
}
@@ -1240,8 +1212,7 @@ public:
void xorl_rr(RegisterID src, RegisterID dst)
{
- spew("xorl %s, %s",
- nameIReg(4,src), nameIReg(4,dst));
+ spew("xorl %s, %s", nameIReg(4,src), nameIReg(4,dst));
m_formatter.oneByteOp(OP_XOR_EvGv, src, dst);
}
@@ -1274,8 +1245,7 @@ public:
void xorl_ir(int imm, RegisterID dst)
{
- spew("xorl $%d, %s",
- imm, nameIReg(4,dst));
+ spew("xorl $%d, %s", imm, nameIReg(4,dst));
if (CAN_SIGN_EXTEND_8_32(imm)) {
m_formatter.oneByteOp(OP_GROUP1_EvIb, GROUP1_OP_XOR, dst);
m_formatter.immediate8(imm);
@@ -1288,15 +1258,13 @@ public:
#ifdef JS_CODEGEN_X64
void xorq_rr(RegisterID src, RegisterID dst)
{
- spew("xorq %s, %s",
- nameIReg(8,src), nameIReg(8, dst));
+ spew("xorq %s, %s", nameIReg(8,src), nameIReg(8, dst));
m_formatter.oneByteOp64(OP_XOR_EvGv, src, dst);
}
void xorq_ir(int imm, RegisterID dst)
{
- spew("xorq $%d, %s",
- imm, nameIReg(8,dst));
+ spew("xorq $%d, %s", imm, nameIReg(8,dst));
if (CAN_SIGN_EXTEND_8_32(imm)) {
m_formatter.oneByteOp64(OP_GROUP1_EvIb, GROUP1_OP_XOR, dst);
m_formatter.immediate8(imm);
@@ -1413,8 +1381,7 @@ public:
void imull_r(RegisterID multiplier)
{
- spew("imull %s",
- nameIReg(4, multiplier));
+ spew("imull %s", nameIReg(4, multiplier));
m_formatter.oneByteOp(OP_GROUP3_Ev, GROUP3_OP_IMUL, multiplier);
}
@@ -1427,23 +1394,20 @@ public:
void imull_i32r(RegisterID src, int32_t value, RegisterID dst)
{
- spew("imull $%d, %s, %s",
- value, nameIReg(4, src), nameIReg(4, dst));
+ spew("imull $%d, %s, %s", value, nameIReg(4, src), nameIReg(4, dst));
m_formatter.oneByteOp(OP_IMUL_GvEvIz, dst, src);
m_formatter.immediate32(value);
}
void idivl_r(RegisterID divisor)
{
- spew("idivl %s",
- nameIReg(4, divisor));
+ spew("idivl %s", nameIReg(4, divisor));
m_formatter.oneByteOp(OP_GROUP3_Ev, GROUP3_OP_IDIV, divisor);
}
void divl_r(RegisterID divisor)
{
- spew("div %s",
- nameIReg(4, divisor));
+ spew("div %s", nameIReg(4, divisor));
m_formatter.oneByteOp(OP_GROUP3_Ev, GROUP3_OP_DIV, divisor);
}
@@ -1477,39 +1441,39 @@ public:
void cmpxchg8(RegisterID src, int offset, RegisterID base)
{
- spew("cmpxchg8 %s, %s0x%x(%s)",
+ spew("cmpxchg8 %s, %s0x%x(%s)",
nameIReg(src), PRETTY_PRINT_OFFSET(offset), nameIReg(base));
m_formatter.twoByteOp(OP2_CMPXCHG_GvEb, src, base, offset);
}
void cmpxchg8(RegisterID src, int offset, RegisterID base, RegisterID index, int scale)
{
- spew("cmpxchg8 %s, %s0x%x(%s,%s,%d)",
+ spew("cmpxchg8 %s, %s0x%x(%s,%s,%d)",
nameIReg(src), PRETTY_PRINT_OFFSET(offset), nameIReg(base), nameIReg(index), 1<> 8, X86Registers::getSubregH(dst));
return;
}
- spew("testl $0x%x, %s",
- imm, nameIReg(dst));
+ spew("testl $0x%x, %s", imm, nameIReg(dst));
m_formatter.oneByteOp(OP_GROUP3_EvIz, GROUP3_OP_TEST, dst);
m_formatter.immediate32(imm);
}
@@ -1788,8 +1741,7 @@ public:
void testl_i32m(int imm, const void *addr)
{
- spew("testl $0x%x, %p",
- imm, addr);
+ spew("testl $0x%x, %p", imm, addr);
m_formatter.oneByteOp(OP_GROUP3_EvIz, GROUP3_OP_TEST, addr);
m_formatter.immediate32(imm);
}
@@ -1818,8 +1770,7 @@ public:
#ifdef JS_CODEGEN_X64
void testq_rr(RegisterID src, RegisterID dst)
{
- spew("testq %s, %s",
- nameIReg(8,src), nameIReg(8,dst));
+ spew("testq %s, %s", nameIReg(8,src), nameIReg(8,dst));
m_formatter.oneByteOp64(OP_TEST_EvGv, src, dst);
}
@@ -1831,8 +1782,7 @@ public:
testl_i32r(imm, dst);
return;
}
- spew("testq $0x%x, %s",
- imm, nameIReg(dst));
+ spew("testq $0x%x, %s", imm, nameIReg(dst));
m_formatter.oneByteOp64(OP_GROUP3_EvIz, GROUP3_OP_TEST, dst);
m_formatter.immediate32(imm);
}
@@ -1862,8 +1812,7 @@ public:
void testb_i8r(int imm, RegisterID dst)
{
- spew("testb $0x%x, %s",
- imm, nameIReg(1,dst));
+ spew("testb $0x%x, %s", imm, nameIReg(1,dst));
m_formatter.oneByteOp8(OP_GROUP3_EbIb, GROUP3_OP_TEST, dst);
m_formatter.immediate8(imm);
}
@@ -1872,16 +1821,14 @@ public:
// reference ah..bh.
void testb_i8r_norex(int imm, RegisterID dst)
{
- spew("testb $0x%x, %s",
- imm, nameIReg(1,dst));
+ spew("testb $0x%x, %s", imm, nameIReg(1,dst));
m_formatter.oneByteOp8_norex(OP_GROUP3_EbIb, GROUP3_OP_TEST, dst);
m_formatter.immediate8(imm);
}
void setCC_r(Condition cond, RegisterID dst)
{
- spew("set%s %s",
- nameCC(cond), nameIReg(1,dst));
+ spew("set%s %s", nameCC(cond), nameIReg(1,dst));
m_formatter.twoByteOp8(setccOpcode(cond), (GroupOpcodeID)0, dst);
}
@@ -1915,24 +1862,21 @@ public:
void xchgl_rr(RegisterID src, RegisterID dst)
{
- spew("xchgl %s, %s",
- nameIReg(4,src), nameIReg(4,dst));
+ spew("xchgl %s, %s", nameIReg(4,src), nameIReg(4,dst));
m_formatter.oneByteOp(OP_XCHG_EvGv, src, dst);
}
#ifdef JS_CODEGEN_X64
void xchgq_rr(RegisterID src, RegisterID dst)
{
- spew("xchgq %s, %s",
- nameIReg(8,src), nameIReg(8,dst));
+ spew("xchgq %s, %s", nameIReg(8,src), nameIReg(8,dst));
m_formatter.oneByteOp64(OP_XCHG_EvGv, src, dst);
}
#endif
void movl_rr(RegisterID src, RegisterID dst)
{
- spew("movl %s, %s",
- nameIReg(4,src), nameIReg(4,dst));
+ spew("movl %s, %s", nameIReg(4,src), nameIReg(4,dst));
m_formatter.oneByteOp(OP_MOV_EvGv, src, dst);
}
@@ -1962,8 +1906,7 @@ public:
void movw_rm(RegisterID src, const void* addr)
{
- spew("movw %s, %p",
- nameIReg(2, src), addr);
+ spew("movw %s, %p", nameIReg(2, src), addr);
m_formatter.prefix(PRE_OPERAND_SIZE);
m_formatter.oneByteOp_disp32(OP_MOV_EvGv, src, addr);
}
@@ -2018,8 +1961,7 @@ public:
{
int32_t disp = addressImmediate(base);
- spew("movl %d(,%s,%d), %s",
- disp, nameIReg(index), 1<(m_formatter.data());
setRel32(code + from.m_offset, code + to.m_offset);
}
@@ -4129,8 +3938,7 @@ public:
{
MOZ_ASSERT(from.m_offset != -1);
- staticSpew("##link ((%d)) jumps to ((%p))",
- from.m_offset, to);
+ staticSpew("##link ((%d)) jumps to ((%p))", from.m_offset, to);
setRel32(reinterpret_cast(code) + from.m_offset, to);
}
@@ -4152,8 +3960,7 @@ public:
static void relinkJump(void* from, void* to)
{
- staticSpew("##relinkJump ((from=%p)) ((to=%p))",
- from, to);
+ staticSpew("##relinkJump ((from=%p)) ((to=%p))", from, to);
setRel32(from, to);
}
@@ -4165,29 +3972,25 @@ public:
static void relinkCall(void* from, void* to)
{
- staticSpew("##relinkCall ((from=%p)) ((to=%p))",
- from, to);
+ staticSpew("##relinkCall ((from=%p)) ((to=%p))", from, to);
setRel32(from, to);
}
static void repatchInt32(void* where, int32_t value)
{
- staticSpew("##relinkInt32 ((where=%p)) ((value=%d))",
- where, value);
+ staticSpew("##relinkInt32 ((where=%p)) ((value=%d))", where, value);
setInt32(where, value);
}
static void repatchPointer(void* where, const void* value)
{
- staticSpew("##repatchPtr ((where=%p)) ((value=%p))",
- where, value);
+ staticSpew("##repatchPtr ((where=%p)) ((value=%p))", where, value);
setPointer(where, value);
}
static void repatchLoadPtrToLEA(void* where)
{
- staticSpew("##repatchLoadPtrToLEA ((where=%p))",
- where);
+ staticSpew("##repatchLoadPtrToLEA ((where=%p))", where);
#ifdef JS_CODEGEN_X64
// On x86-64 pointer memory accesses require a 64-bit operand, and as
@@ -4199,8 +4002,7 @@ public:
static void repatchLEAToLoadPtr(void* where)
{
- staticSpew("##repatchLEAToLoadPtr ((where=%p))",
- where);
+ staticSpew("##repatchLEAToLoadPtr ((where=%p))", where);
#ifdef JS_CODEGEN_X64
// On x86-64 pointer memory accesses require a 64-bit operand, and as
// such a REX prefix. Skip over the prefix byte.
diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp
index 3ba9f854098..7eaaef53564 100644
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -2091,59 +2091,114 @@ CanRelocateZone(JSRuntime *rt, Zone *zone)
}
static bool
-CanRelocateArena(ArenaHeader *arena)
+CanRelocateAllocKind(AllocKind kind)
{
- return arena->getAllocKind() <= FINALIZE_OBJECT_LAST;
+ return kind <= FINALIZE_OBJECT_LAST;
}
-static bool
-ShouldRelocateArena(ArenaHeader *arena)
-{
-#ifdef JS_GC_ZEAL
- if (arena->zone->runtimeFromMainThread()->gc.zeal() == ZealCompactValue)
- return true;
-#endif
- /*
- * Eventually, this will be based on brilliant heuristics that look at fill
- * percentage and fragmentation and... stuff.
- */
- return arena->hasFreeThings();
+size_t ArenaHeader::countFreeCells()
+{
+ size_t count = 0;
+ size_t thingSize = getThingSize();
+ FreeSpan firstSpan(getFirstFreeSpan());
+ for (const FreeSpan *span = &firstSpan; !span->isEmpty(); span = span->nextSpan())
+ count += span->length(thingSize);
+ return count;
+}
+
+size_t ArenaHeader::countUsedCells()
+{
+ return Arena::thingsPerArena(getThingSize()) - countFreeCells();
}
/*
- * Choose some arenas to relocate all cells out of and remove them from the
- * arena list. Return the head of the list of arenas to relocate.
+ * Iterate throught the list and count the number of cells used.
+ *
+ * We may be able to precalculate this while sweeping and store the result
+ * somewhere.
+ */
+size_t ArenaList::countUsedCells()
+{
+ size_t count = 0;
+ for (ArenaHeader *arena = head_; arena; arena = arena->next)
+ count += arena->countUsedCells();
+ return count;
+}
+
+ArenaHeader *
+ArenaList::removeRemainingArenas(ArenaHeader **arenap)
+{
+ // This is only ever called to remove arenas that are after the cursor, so
+ // we don't need to update it.
+#ifdef DEBUG
+ for (ArenaHeader *arena = *arenap; arena; arena = arena->next)
+ MOZ_ASSERT(cursorp_ != &arena->next);
+#endif
+ ArenaHeader *remainingArenas = *arenap;
+ *arenap = nullptr;
+ check();
+ return remainingArenas;
+}
+
+/*
+ * Choose which arenas to relocate all cells out of and remove them from the
+ * arena list. Return the head of a list of arenas to relocate.
*/
ArenaHeader *
ArenaList::pickArenasToRelocate()
{
check();
- ArenaHeader *head = nullptr;
- ArenaHeader **tailp = &head;
+ if (isEmpty())
+ return nullptr;
+
+ // In zeal mode and in debug builds on 64 bit architectures, we relocate all
+ // arenas. The purpose of this is to balance test coverage of object moving
+ // with test coverage of the arena selection routine below.
+ bool relocateAll = head()->zone->runtimeFromMainThread()->gc.zeal() == ZealCompactValue;
+#if defined(DEBUG) && defined(JS_PUNBOX64)
+ relocateAll = true;
+#endif
+ if (relocateAll) {
+ ArenaHeader *allArenas = head();
+ clear();
+ return allArenas;
+ }
+
+ // Otherwise we relocate the greatest number of arenas such that the number
+ // of used cells in relocated arenas is less than or equal to the number of
+ // free cells in unrelocated arenas. In other words we only relocate cells
+ // we can move into existing arenas, and we choose the least full areans to
+ // relocate.
+ //
+ // This is made easier by the fact that the arena list has been sorted in
+ // descending order of number of used cells, so we will always relocate a
+ // tail of the arena list. All we need to do is find the point at which to
+ // start relocating.
+
+ ArenaHeader **arenap = cursorp_; // Next arena to consider
+ size_t previousFreeCells = 0; // Count of free cells before
+ size_t followingUsedCells = countUsedCells(); // Count of used cells after
+ mozilla::DebugOnly lastFreeCells(0);
+ size_t cellsPerArena = Arena::thingsPerArena((*arenap)->getThingSize());
- // TODO: Only scan through the arenas with space available.
- ArenaHeader **arenap = &head_;
while (*arenap) {
ArenaHeader *arena = *arenap;
- MOZ_ASSERT(arena);
- if (CanRelocateArena(arena) && ShouldRelocateArena(arena)) {
- // Remove from arena list
- if (cursorp_ == &arena->next)
- cursorp_ = arenap;
- *arenap = arena->next;
- arena->next = nullptr;
-
- // Append to relocation list
- *tailp = arena;
- tailp = &arena->next;
- } else {
- arenap = &arena->next;
- }
+ if (followingUsedCells <= previousFreeCells)
+ return removeRemainingArenas(arenap);
+ size_t freeCells = arena->countFreeCells();
+ size_t usedCells = cellsPerArena - freeCells;
+ followingUsedCells -= usedCells;
+#ifdef DEBUG
+ MOZ_ASSERT(freeCells >= lastFreeCells);
+ lastFreeCells = freeCells;
+#endif
+ previousFreeCells += freeCells;
+ arenap = &arena->next;
}
check();
- return head;
+ return nullptr;
}
#ifdef DEBUG
@@ -2196,7 +2251,7 @@ RelocateCell(Zone *zone, TenuredCell *src, AllocKind thingKind, size_t thingSize
return true;
}
-static bool
+static void
RelocateArena(ArenaHeader *aheader)
{
MOZ_ASSERT(aheader->allocated());
@@ -2211,22 +2266,17 @@ RelocateArena(ArenaHeader *aheader)
for (ArenaCellIterUnderFinalize i(aheader); !i.done(); i.next()) {
if (!RelocateCell(zone, i.getCell(), thingKind, thingSize)) {
- MOZ_CRASH(); // TODO: Handle failure here.
- return false;
+ // This can only happen in zeal mode or debug builds as we don't
+ // otherwise relocate more cells than we have existing free space
+ // for.
+ CrashAtUnhandlableOOM("Could not allocate new arena while compacting");
}
}
-
- return true;
}
/*
* Relocate all arenas identified by pickArenasToRelocate: for each arena,
- * relocate each cell within it, then tack it onto a list of relocated arenas.
- * Currently, we allow the relocation to fail, in which case the arena will be
- * moved back onto the list of arenas with space available. (I did this
- * originally to test my list manipulation before implementing the actual
- * moving, with half a thought to allowing pinning (moving only a portion of
- * the cells in an arena), but now it's probably just dead weight. FIXME)
+ * relocate each cell within it, then add it to a list of relocated arenas.
*/
ArenaHeader *
ArenaList::relocateArenas(ArenaHeader *toRelocate, ArenaHeader *relocated)
@@ -2235,19 +2285,10 @@ ArenaList::relocateArenas(ArenaHeader *toRelocate, ArenaHeader *relocated)
while (ArenaHeader *arena = toRelocate) {
toRelocate = arena->next;
-
- if (RelocateArena(arena)) {
- // Prepend to list of relocated arenas
- arena->next = relocated;
- relocated = arena;
- } else {
- // For some reason, the arena did not end up empty. Prepend it to
- // the portion of the list that the cursor is pointing to (the
- // arenas with space available) so that it will be used for future
- // allocations.
- MOZ_ASSERT(arena->hasFreeThings());
- insertAtCursor(arena);
- }
+ RelocateArena(arena);
+ // Prepend to list of relocated arenas
+ arena->next = relocated;
+ relocated = arena;
}
check();
@@ -2263,10 +2304,12 @@ ArenaLists::relocateArenas(ArenaHeader *relocatedList)
checkEmptyFreeLists();
for (size_t i = 0; i < FINALIZE_LIMIT; i++) {
- ArenaList &al = arenaLists[i];
- ArenaHeader *toRelocate = al.pickArenasToRelocate();
- if (toRelocate)
- relocatedList = al.relocateArenas(toRelocate, relocatedList);
+ if (CanRelocateAllocKind(AllocKind(i))) {
+ ArenaList &al = arenaLists[i];
+ ArenaHeader *toRelocate = al.pickArenasToRelocate();
+ if (toRelocate)
+ relocatedList = al.relocateArenas(toRelocate, relocatedList);
+ }
}
/*
@@ -2317,13 +2360,34 @@ MovingTracer::Visit(JSTracer *jstrc, void **thingp, JSGCTraceKind kind)
}
}
+void
+GCRuntime::sweepTypesAfterCompacting(Zone *zone)
+{
+ FreeOp *fop = rt->defaultFreeOp();
+ zone->beginSweepTypes(fop, rt->gc.releaseObservedTypes && !zone->isPreservingCode());
+
+ types::AutoClearTypeInferenceStateOnOOM oom(zone);
+
+ for (ZoneCellIterUnderGC i(zone, FINALIZE_SCRIPT); !i.done(); i.next()) {
+ JSScript *script = i.get();
+ script->maybeSweepTypes(&oom);
+ }
+
+ for (ZoneCellIterUnderGC i(zone, FINALIZE_TYPE_OBJECT); !i.done(); i.next()) {
+ types::TypeObject *object = i.get();
+ object->maybeSweep(&oom);
+ }
+
+ zone->types.endSweep(rt);
+}
+
void
GCRuntime::sweepZoneAfterCompacting(Zone *zone)
{
MOZ_ASSERT(zone->isCollecting());
FreeOp *fop = rt->defaultFreeOp();
zone->discardJitCode(fop);
- zone->sweepAnalysis(fop, rt->gc.releaseObservedTypes && !zone->isPreservingCode());
+ sweepTypesAfterCompacting(zone);
zone->sweepBreakpoints(fop);
for (CompartmentsInZoneIter c(zone); !c.done(); c.next()) {
@@ -2345,25 +2409,20 @@ GCRuntime::sweepZoneAfterCompacting(Zone *zone)
}
/*
- * Update the interal pointers in a single cell.
+ * Update the interal pointers for all cells of the specified kind in a zone.
*/
+template
static void
-UpdateCellPointers(MovingTracer *trc, Cell *cell, JSGCTraceKind traceKind) {
- if (traceKind == JSTRACE_OBJECT) {
- JSObject *obj = static_cast(cell);
- obj->fixupAfterMovingGC();
- } else if (traceKind == JSTRACE_SHAPE) {
- Shape *shape = static_cast(cell);
- shape->fixupAfterMovingGC();
- } else if (traceKind == JSTRACE_BASE_SHAPE) {
- BaseShape *base = static_cast(cell);
- base->fixupAfterMovingGC();
- } else if (traceKind == JSTRACE_TYPE_OBJECT) {
- types::TypeObject *type = static_cast(cell);
- type->fixupAfterMovingGC();
+UpdateCellPointersByKind(MovingTracer *trc, ArenaLists &al, AllocKind thingKind) {
+ JSGCTraceKind traceKind = MapAllocToTraceKind(thingKind);
+ MOZ_ASSERT(MapTypeToTraceKind::kind == traceKind);
+ for (ArenaHeader *arena = al.getFirstArena(thingKind); arena; arena = arena->next) {
+ for (ArenaCellIterUnderGC i(arena); !i.done(); i.next()) {
+ T *cell = reinterpret_cast(i.getCell());
+ cell->fixupAfterMovingGC();
+ TraceChildren(trc, cell, traceKind);
+ }
}
-
- TraceChildren(trc, cell, traceKind);
}
/*
@@ -2380,8 +2439,6 @@ GCRuntime::updatePointersToRelocatedCells()
gcstats::AutoPhase ap(stats, gcstats::PHASE_COMPACT_UPDATE);
MovingTracer trc(rt);
- // TODO: We may need to fix up other weak pointers here.
-
// Fixup compartment global pointers as these get accessed during marking.
for (GCCompartmentsIter comp(rt); !comp.done(); comp.next())
comp->fixupAfterMovingGC();
@@ -2390,18 +2447,18 @@ GCRuntime::updatePointersToRelocatedCells()
for (CompartmentsIter comp(rt, SkipAtoms); !comp.done(); comp.next())
comp->sweepCrossCompartmentWrappers();
- // Iterate through all allocated cells to update internal pointers.
+ // Iterate through all cells that can contain JSObject pointers to update them.
for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
ArenaLists &al = zone->allocator.arenas;
- for (unsigned i = 0; i < FINALIZE_LIMIT; ++i) {
- AllocKind thingKind = static_cast(i);
- JSGCTraceKind traceKind = MapAllocToTraceKind(thingKind);
- for (ArenaHeader *arena = al.getFirstArena(thingKind); arena; arena = arena->next) {
- for (ArenaCellIterUnderGC i(arena); !i.done(); i.next()) {
- UpdateCellPointers(&trc, i.getCell(), traceKind);
- }
- }
- }
+ for (unsigned i = 0; i < FINALIZE_OBJECT_LIMIT; ++i)
+ UpdateCellPointersByKind(&trc, al, AllocKind(i));
+ UpdateCellPointersByKind(&trc, al, FINALIZE_SCRIPT);
+ UpdateCellPointersByKind(&trc, al, FINALIZE_LAZY_SCRIPT);
+ UpdateCellPointersByKind(&trc, al, FINALIZE_SHAPE);
+ UpdateCellPointersByKind(&trc, al, FINALIZE_ACCESSOR_SHAPE);
+ UpdateCellPointersByKind(&trc, al, FINALIZE_BASE_SHAPE);
+ UpdateCellPointersByKind(&trc, al, FINALIZE_TYPE_OBJECT);
+ UpdateCellPointersByKind(&trc, al, FINALIZE_JITCODE);
}
// Mark roots to update them.
diff --git a/js/src/jsgc.h b/js/src/jsgc.h
index 1b5660730b8..21180217785 100644
--- a/js/src/jsgc.h
+++ b/js/src/jsgc.h
@@ -497,6 +497,8 @@ class ArenaList {
}
#ifdef JSGC_COMPACTING
+ size_t countUsedCells();
+ ArenaHeader *removeRemainingArenas(ArenaHeader **arenap);
ArenaHeader *pickArenasToRelocate();
ArenaHeader *relocateArenas(ArenaHeader *toRelocate, ArenaHeader *relocated);
#endif
diff --git a/js/src/jsscript.h b/js/src/jsscript.h
index aec12c94de6..8a1175f97a7 100644
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -1661,6 +1661,7 @@ class JSScript : public js::gc::TenuredCell
#endif
void finalize(js::FreeOp *fop);
+ void fixupAfterMovingGC() {}
static inline js::ThingRootKind rootKind() { return js::THING_ROOT_SCRIPT; }
@@ -1984,6 +1985,7 @@ class LazyScript : public gc::TenuredCell
void markChildren(JSTracer *trc);
void finalize(js::FreeOp *fop);
+ void fixupAfterMovingGC() {}
static inline js::ThingRootKind rootKind() { return js::THING_ROOT_LAZY_SCRIPT; }
diff --git a/js/src/vm/ArrayBufferObject.cpp b/js/src/vm/ArrayBufferObject.cpp
index 00b554f1237..0fb902b9a7f 100644
--- a/js/src/vm/ArrayBufferObject.cpp
+++ b/js/src/vm/ArrayBufferObject.cpp
@@ -52,6 +52,7 @@
#include "vm/Shape-inl.h"
using mozilla::DebugOnly;
+using mozilla::UniquePtr;
using namespace js;
using namespace js::gc;
@@ -396,11 +397,10 @@ ArrayBufferObject::fun_transfer(JSContext *cx, unsigned argc, Value *vp)
newByteLength = size_t(i32);
}
- uint8_t *newData;
+ UniquePtr newData;
if (!newByteLength) {
if (!ArrayBufferObject::neuter(cx, oldBuffer, oldBuffer->contents()))
return false;
- newData = nullptr;
} else {
# ifdef JS_CPU_X64
// With a 4gb mapped asm.js buffer, we can simply enable/disable access
@@ -412,31 +412,43 @@ ArrayBufferObject::fun_transfer(JSContext *cx, unsigned argc, Value *vp)
// Since we try to realloc below, only allow stealing malloc'd buffers.
// If !hasMallocedContents, stealContents will malloc a copy which we
// can then realloc.
- ArrayBufferObject::BufferContents stolen =
- ArrayBufferObject::stealContents(cx, oldBuffer, oldBuffer->hasMallocedContents());
- if (!stolen)
+ bool steal = oldBuffer->hasMallocedContents();
+ auto stolenContents = ArrayBufferObject::stealContents(cx, oldBuffer, steal);
+ if (!stolenContents)
return false;
- if (newByteLength != oldByteLength) {
- newData = cx->runtime()->pod_reallocCanGC(stolen.data(), oldByteLength, newByteLength);
- if (!newData) {
- js_free(stolen.data());
- js_ReportOutOfMemory(cx);
- return false;
+ UniquePtr oldData(stolenContents.data());
+ if (newByteLength > oldByteLength) {
+ // In theory, realloc+memset(0) can be optimized to avoid touching
+ // any pages (by using OS page mapping tricks). However, in
+ // practice, we don't seem to get this optimization in Firefox with
+ // jemalloc so calloc+memcpy are faster.
+ newData.reset(cx->runtime()->pod_callocCanGC(newByteLength));
+ if (newData) {
+ memcpy(newData.get(), oldData.get(), oldByteLength);
+ } else {
+ // Try malloc before giving up since it might be able to succed
+ // by resizing oldData in-place.
+ newData.reset(cx->pod_realloc(oldData.get(), oldByteLength, newByteLength));
+ if (!newData)
+ return false;
+ oldData.release();
+ memset(newData.get() + oldByteLength, 0, newByteLength - oldByteLength);
}
-
- if (newByteLength > oldByteLength)
- memset(newData + oldByteLength, 0, newByteLength - oldByteLength);
+ } else if (newByteLength < oldByteLength) {
+ newData.reset(cx->pod_realloc(oldData.get(), oldByteLength, newByteLength));
+ if (!newData)
+ return false;
+ oldData.release();
} else {
- newData = stolen.data();
+ newData = Move(oldData);
}
}
- RootedObject newBuffer(cx, JS_NewArrayBufferWithContents(cx, newByteLength, newData));
- if (!newBuffer) {
- js_free(newData);
+ RootedObject newBuffer(cx, JS_NewArrayBufferWithContents(cx, newByteLength, newData.get()));
+ if (!newBuffer)
return false;
- }
+ newData.release();
args.rval().setObject(*newBuffer);
return true;
diff --git a/layout/base/ScrollbarStyles.h b/layout/base/ScrollbarStyles.h
index 84c14c5cdc6..ffb6db62498 100644
--- a/layout/base/ScrollbarStyles.h
+++ b/layout/base/ScrollbarStyles.h
@@ -18,8 +18,7 @@ struct ScrollbarStyles
// or NS_STYLE_OVERFLOW_AUTO.
uint8_t mHorizontal;
uint8_t mVertical;
- // Always one of NS_STYLE_SCROLL_BEHAVIOR_AUTO,
- // NS_STYLE_SCROLL_BEHAVIOR_INSTANT, or
+ // Always one of NS_STYLE_SCROLL_BEHAVIOR_AUTO or
// NS_STYLE_SCROLL_BEHAVIOR_SMOOTH
uint8_t mScrollBehavior;
ScrollbarStyles(uint8_t aH, uint8_t aV, uint8_t aB) : mHorizontal(aH),
diff --git a/layout/base/nsCSSRenderingBorders.cpp b/layout/base/nsCSSRenderingBorders.cpp
index 1b43a0d6077..43e955925e1 100644
--- a/layout/base/nsCSSRenderingBorders.cpp
+++ b/layout/base/nsCSSRenderingBorders.cpp
@@ -1041,46 +1041,6 @@ bool IsVisible(int aStyle)
return false;
}
-already_AddRefed
-nsCSSBorderRenderer::CreateCornerGradient(mozilla::css::Corner aCorner,
- const gfxRGBA &aFirstColor,
- const gfxRGBA &aSecondColor)
-{
- typedef struct { gfxFloat a, b; } twoFloats;
-
- const twoFloats gradientCoeff[4] = { { -1, +1 },
- { -1, -1 },
- { +1, -1 },
- { +1, +1 } };
-
- // Sides which form the 'width' and 'height' for the calculation of the angle
- // for our gradient.
- const int cornerWidth[4] = { 3, 1, 1, 3 };
- const int cornerHeight[4] = { 0, 0, 2, 2 };
-
- gfxPoint cornerOrigin = mOuterRect.AtCorner(aCorner);
-
- gfxPoint pat1, pat2;
- pat1.x = cornerOrigin.x +
- mBorderWidths[cornerHeight[aCorner]] * gradientCoeff[aCorner].a;
- pat1.y = cornerOrigin.y +
- mBorderWidths[cornerWidth[aCorner]] * gradientCoeff[aCorner].b;
- pat2.x = cornerOrigin.x -
- mBorderWidths[cornerHeight[aCorner]] * gradientCoeff[aCorner].a;
- pat2.y = cornerOrigin.y -
- mBorderWidths[cornerWidth[aCorner]] * gradientCoeff[aCorner].b;
-
- float gradientOffset =
- 0.25 / sqrt(pow(mBorderWidths[cornerHeight[aCorner]], 2) +
- pow(mBorderWidths[cornerHeight[aCorner]], 2));
-
- nsRefPtr pattern = new gfxPattern(pat1.x, pat1.y, pat2.x, pat2.y);
- pattern->AddColorStop(0.5 - gradientOffset, gfxRGBA(aFirstColor));
- pattern->AddColorStop(0.5 + gradientOffset, gfxRGBA(aSecondColor));
-
- return pattern.forget();
-}
-
TemporaryRef
nsCSSBorderRenderer::CreateCornerGradient(mozilla::css::Corner aCorner,
const gfxRGBA &aFirstColor,
diff --git a/layout/base/nsCSSRenderingBorders.h b/layout/base/nsCSSRenderingBorders.h
index dd3544f83bc..0cea52811e4 100644
--- a/layout/base/nsCSSRenderingBorders.h
+++ b/layout/base/nsCSSRenderingBorders.h
@@ -15,7 +15,6 @@
#include "nsStyleConsts.h"
class gfxContext;
-class gfxPattern;
struct gfxRGBA;
struct nsBorderColors;
@@ -191,12 +190,6 @@ struct nsCSSBorderRenderer {
// with no color effect.
bool AllBordersSolid(bool *aHasCompositeColors);
- // Create a gradient pattern that will handle the color transition for a
- // corner.
- already_AddRefed CreateCornerGradient(mozilla::css::Corner aCorner,
- const gfxRGBA &aFirstColor,
- const gfxRGBA &aSecondColor);
-
// Azure variant of CreateCornerGradient.
mozilla::TemporaryRef
CreateCornerGradient(mozilla::css::Corner aCorner, const gfxRGBA &aFirstColor,
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index 58d40940816..59716956aa6 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -4649,7 +4649,46 @@ nsLayoutUtils::DrawString(const nsIFrame* aFrame,
if (NS_FAILED(rv))
{
aContext->SetTextRunRTL(false);
- aContext->DrawString(aString, aLength, aPoint.x, aPoint.y);
+ DrawUniDirString(aString, aLength, aPoint, *aContext);
+ }
+}
+
+void
+nsLayoutUtils::DrawUniDirString(const char16_t* aString,
+ uint32_t aLength,
+ nsPoint aPoint,
+ nsRenderingContext& aContext)
+{
+ nscoord x = aPoint.x;
+ nscoord y = aPoint.y;
+
+ nsFontMetrics* fm = aContext.FontMetrics();
+
+ uint32_t maxChunkLength = aContext.GetMaxChunkLength();
+ if (aLength <= maxChunkLength) {
+ fm->DrawString(aString, aLength, x, y, &aContext, &aContext);
+ return;
+ }
+
+ bool isRTL = fm->GetTextRunRTL();
+
+ // If we're drawing right to left, we must start at the end.
+ if (isRTL) {
+ x += aContext.GetWidth(aString, aLength);
+ }
+
+ while (aLength > 0) {
+ int32_t len = nsRenderingContext::FindSafeLength(aString, aLength, maxChunkLength);
+ nscoord width = fm->GetWidth(aString, len, &aContext);
+ if (isRTL) {
+ x -= width;
+ }
+ fm->DrawString(aString, len, x, y, &aContext, &aContext);
+ if (!isRTL) {
+ x += width;
+ }
+ aLength -= len;
+ aString += len;
}
}
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 4fa91b14f14..41d98d9e681 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -1324,6 +1324,14 @@ public:
nsPoint aPoint,
nsStyleContext* aStyleContext = nullptr);
+ /**
+ * Supports only LTR or RTL. Bidi (mixed direction) is not supported.
+ */
+ static void DrawUniDirString(const char16_t* aString,
+ uint32_t aLength,
+ nsPoint aPoint,
+ nsRenderingContext& aContext);
+
static nscoord GetStringWidth(const nsIFrame* aFrame,
nsRenderingContext* aContext,
const char16_t* aString,
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp
index 36972b6859e..a8339b93be1 100644
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -10162,13 +10162,12 @@ void ReflowCountMgr::PaintCount(const char* aName,
aPresContext->GetTextPerfMetrics(),
*getter_AddRefs(fm));
- aRenderingContext->SetFont(fm);
char buf[16];
- sprintf(buf, "%d", counter->mCount);
+ int len = sprintf(buf, "%d", counter->mCount);
nscoord x = 0, y = fm->MaxAscent();
nscoord width, height = fm->MaxHeight();
- aRenderingContext->SetTextRunRTL(false);
- width = aRenderingContext->GetWidth(buf);
+ fm->SetTextRunRTL(false);
+ width = fm->GetWidth(buf, len, aRenderingContext);;
uint32_t color;
uint32_t color2;
@@ -10196,9 +10195,9 @@ void ReflowCountMgr::PaintCount(const char* aName,
drawTarget->FillRect(devPxRect, black);
aRenderingContext->ThebesContext()->SetColor(color2);
- aRenderingContext->DrawString(buf, strlen(buf), x+15,y+15);
+ fm->DrawString(buf, len, x+15, y+15, aRenderingContext);
aRenderingContext->ThebesContext()->SetColor(color);
- aRenderingContext->DrawString(buf, strlen(buf), x,y);
+ fm->DrawString(buf, len, x, y, aRenderingContext);
aRenderingContext->ThebesContext()->Restore();
}
diff --git a/layout/generic/nsCanvasFrame.cpp b/layout/generic/nsCanvasFrame.cpp
index 8d3ebfef4ac..b6501b2d5ef 100644
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -76,11 +76,6 @@ nsCanvasFrame::CreateAnonymousContent(nsTArray& aElements)
NS_ENSURE_SUCCESS(rv, rv);
aElements.AppendElement(mTouchCaretElement);
- // Add a _moz_anonclass attribute as touch caret selector.
- mTouchCaretElement->SetAttribute(NS_LITERAL_STRING("_moz_anonclass"),
- NS_LITERAL_STRING("mozTouchCaret"), er);
- NS_ENSURE_SUCCESS(er.ErrorCode(), er.ErrorCode());
-
// Set touch caret to visibility: hidden by default.
nsAutoString classValue;
classValue.AppendLiteral("moz-touchcaret hidden");
@@ -97,15 +92,11 @@ nsCanvasFrame::CreateAnonymousContent(nsTArray& aElements)
mSelectionCaretsEndElement = doc->CreateHTMLElement(nsGkAtoms::div);
aElements.AppendElement(mSelectionCaretsEndElement);
- mSelectionCaretsStartElement->SetAttribute(NS_LITERAL_STRING("_moz_anonclass"),
- NS_LITERAL_STRING("mozTouchCaret"), er);
rv = mSelectionCaretsStartElement->SetAttr(kNameSpaceID_None, nsGkAtoms::_class,
NS_LITERAL_STRING("moz-selectioncaret-left hidden"),
true);
NS_ENSURE_SUCCESS(rv, rv);
- mSelectionCaretsEndElement->SetAttribute(NS_LITERAL_STRING("_moz_anonclass"),
- NS_LITERAL_STRING("mozTouchCaret"), er);
rv = mSelectionCaretsEndElement->SetAttr(kNameSpaceID_None, nsGkAtoms::_class,
NS_LITERAL_STRING("moz-selectioncaret-right hidden"),
true);
diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp
index 186fc4e8aa2..22f1aa97910 100644
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -1789,15 +1789,7 @@ ScrollFrameHelper::AsyncScroll::InitTimingFunction(nsSMILKeySpline& aTimingFunct
bool
ScrollFrameHelper::IsSmoothScrollingEnabled()
{
- if (!Preferences::GetBool(SMOOTH_SCROLL_PREF_NAME, false)) {
- return false;
- }
- if (gfxPrefs::ScrollBehaviorEnabled()) {
- ScrollbarStyles styles = GetScrollbarStylesFromFrame();
- return styles.mScrollBehavior != NS_STYLE_SCROLL_BEHAVIOR_INSTANT;
- } else {
- return true;
- }
+ return Preferences::GetBool(SMOOTH_SCROLL_PREF_NAME, false);
}
class ScrollFrameActivityTracker MOZ_FINAL : public nsExpirationTracker {
diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp
index a72b14ee925..b0221302960 100644
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1015,8 +1015,8 @@ nsImageFrame::MeasureString(const char16_t* aString,
nsRenderingContext& aContext)
{
nscoord totalWidth = 0;
- aContext.SetTextRunRTL(false);
- nscoord spaceWidth = aContext.GetWidth(' ');
+ aContext.FontMetrics()->SetTextRunRTL(false);
+ nscoord spaceWidth = aContext.FontMetrics()->SpaceWidth();
aMaxFit = 0;
while (aLength > 0) {
@@ -1123,8 +1123,11 @@ nsImageFrame::DisplayAltText(nsPresContext* aPresContext,
aRenderingContext,
aRect.x, y + maxAscent);
}
- if (NS_FAILED(rv))
- aRenderingContext.DrawString(str, maxFit, aRect.x, y + maxAscent);
+ if (NS_FAILED(rv)) {
+ nsLayoutUtils::DrawUniDirString(str, maxFit,
+ nsPoint(aRect.x, y + maxAscent),
+ aRenderingContext);
+ }
// Move to the next line
str += maxFit;
diff --git a/layout/generic/nsPluginFrame.cpp b/layout/generic/nsPluginFrame.cpp
index de07fd37895..c6b6e9153d8 100644
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -10,6 +10,7 @@
#include "gfx2DGlue.h"
#include "gfxMatrix.h"
+#include "mozilla/gfx/2D.h"
#include "mozilla/BasicEvents.h"
#ifdef XP_WIN
// This is needed for DoublePassRenderingEvent.
@@ -1252,6 +1253,8 @@ nsPluginFrame::PrintPlugin(nsRenderingContext& aRenderingContext,
// platform specific printing code
#if defined(XP_MACOSX) && !defined(__LP64__)
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ DrawTarget& aDrawTarget = *aRenderingContext.GetDrawTarget();
+
// Don't use this code if any of the QuickDraw APIs it currently requires
// are missing (as they probably will be on OS X 10.8 and up).
if (!&::SetRect || !&::NewGWorldFromPtr || !&::DisposeGWorld) {
@@ -1272,12 +1275,12 @@ nsPluginFrame::PrintPlugin(nsRenderingContext& aRenderingContext,
ctx->NewPath();
- gfxRect rect(window.x, window.y, window.width, window.height);
+ gfx::Rect rect(window.x, window.y, window.width, window.height);
- ctx->Rectangle(rect);
+ ctx->Rectangle(ThebesRect(rect));
ctx->Clip();
- gfxQuartzNativeDrawing nativeDraw(ctx, rect);
+ gfxQuartzNativeDrawing nativeDraw(aDrawTarget, rect);
CGContextRef cgContext = nativeDraw.BeginNativeDrawing();
if (!cgContext) {
nativeDraw.EndNativeDrawing();
@@ -1598,6 +1601,10 @@ nsPluginFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aPluginRect)
{
+#if defined(XP_MACOSX)
+ DrawTarget& aDrawTarget = *aRenderingContext.GetDrawTarget();
+#endif
+
#if defined(MOZ_WIDGET_ANDROID)
if (mInstanceOwner) {
gfxRect frameGfxRect =
@@ -1644,7 +1651,8 @@ nsPluginFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
ctx->SetMatrix(
ctx->CurrentMatrix().Translate(offset));
- gfxQuartzNativeDrawing nativeDrawing(ctx, nativeClipRect - offset);
+ gfxQuartzNativeDrawing nativeDrawing(aDrawTarget,
+ ToRect(nativeClipRect - offset));
CGContextRef cgContext = nativeDrawing.BeginNativeDrawing();
if (!cgContext) {
diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp
index a97c0644244..870273110df 100644
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -110,8 +110,10 @@ void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
aCtx->ThebesContext()->SetColor(NS_RGB(255,255,255));
nscoord ascent = aCtx->FontMetrics()->MaxAscent();
NS_NAMED_LITERAL_STRING(errorMsg, "invalid-markup");
- aCtx->DrawString(errorMsg.get(), uint32_t(errorMsg.Length()),
- pt.x, pt.y+ascent);
+ nsLayoutUtils::DrawUniDirString(errorMsg.get(),
+ uint32_t(errorMsg.Length()),
+ nsPoint(pt.x, pt.y + ascent),
+ *aCtx);
}
/* /////////////
diff --git a/layout/mathml/nsMathMLmencloseFrame.cpp b/layout/mathml/nsMathMLmencloseFrame.cpp
index 0ef4edc377d..0f1cf6f0985 100644
--- a/layout/mathml/nsMathMLmencloseFrame.cpp
+++ b/layout/mathml/nsMathMLmencloseFrame.cpp
@@ -767,101 +767,87 @@ private:
void nsDisplayNotation::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
{
- // get the gfxRect
+ DrawTarget& aDrawTarget = *aCtx->GetDrawTarget();
nsPresContext* presContext = mFrame->PresContext();
- gfxRect rect = presContext->AppUnitsToGfxUnits(mRect + ToReferenceFrame());
- // paint the frame with the current text color
+ Float strokeWidth = presContext->AppUnitsToGfxUnits(mThickness);
+
+ Rect rect = NSRectToRect(mRect + ToReferenceFrame(),
+ presContext->AppUnitsPerDevPixel());
+ rect.Deflate(strokeWidth / 2.f);
+
ColorPattern color(ToDeviceColor(
mFrame->GetVisitedDependentColor(eCSSProperty_color)));
- aCtx->ThebesContext()->SetColor(
- mFrame->GetVisitedDependentColor(eCSSProperty_color));
- DrawTarget* drawTarget = aCtx->GetDrawTarget();
-
- // change line width to mThickness
- gfxContext *gfxCtx = aCtx->ThebesContext();
- gfxFloat e = presContext->AppUnitsToGfxUnits(mThickness);
- gfxCtx->Save();
- gfxCtx->SetLineWidth(e);
-
- rect.Deflate(e / 2.0);
+ StrokeOptions strokeOptions(strokeWidth);
switch(mType)
{
case NOTATION_CIRCLE: {
- RefPtr builder = drawTarget->CreatePathBuilder();
- AppendEllipseToPath(builder, ToPoint(rect.Center()), ToSize(rect.Size()));
- RefPtr ellipse = builder->Finish();
- drawTarget->Stroke(ellipse, color);
- break;
+ RefPtr ellipse =
+ MakePathForEllipse(aDrawTarget, rect.Center(), rect.Size());
+ aDrawTarget.Stroke(ellipse, color, strokeOptions);
+ return;
+ }
+ case NOTATION_ROUNDEDBOX: {
+ Float radius = 3 * strokeWidth;
+ Size cornerRadii(radius, radius);
+ Size radii[] = { cornerRadii, cornerRadii, cornerRadii, cornerRadii };
+ RefPtr roundedRect =
+ MakePathForRoundedRect(aDrawTarget, rect, radii, true);
+ aDrawTarget.Stroke(roundedRect, color, strokeOptions);
+ return;
+ }
+ case NOTATION_UPDIAGONALSTRIKE: {
+ aDrawTarget.StrokeLine(rect.BottomLeft(), rect.TopRight(),
+ color, strokeOptions);
+ return;
+ }
+ case NOTATION_DOWNDIAGONALSTRIKE: {
+ aDrawTarget.StrokeLine(rect.TopLeft(), rect.BottomRight(),
+ color, strokeOptions);
+ return;
}
-
- case NOTATION_ROUNDEDBOX:
- gfxCtx->NewPath();
- gfxCtx->RoundedRectangle(rect, gfxCornerSizes(3 * e), true);
- gfxCtx->Stroke();
- break;
-
- case NOTATION_UPDIAGONALSTRIKE:
- gfxCtx->NewPath();
- gfxCtx->Line(rect.BottomLeft(), rect.TopRight());
- gfxCtx->Stroke();
- break;
-
- case NOTATION_DOWNDIAGONALSTRIKE:
- gfxCtx->NewPath();
- gfxCtx->Line(rect.TopLeft(), rect.BottomRight());
- gfxCtx->Stroke();
- break;
-
case NOTATION_UPDIAGONALARROW: {
// Compute some parameters to draw the updiagonalarrow. The values below
// are taken from MathJax's HTML-CSS output.
- gfxFloat W = rect.Width(); gfxFloat H = rect.Height();
- gfxFloat l = sqrt(W*W + H*H);
- gfxFloat f = gfxFloat(kArrowHeadSize) * e / l;
- gfxFloat w = W * f; gfxFloat h = H * f;
+ Float W = rect.Width(); gfxFloat H = rect.Height();
+ Float l = sqrt(W*W + H*H);
+ Float f = Float(kArrowHeadSize) * strokeWidth / l;
+ Float w = W * f; gfxFloat h = H * f;
// Draw the arrow shaft
- gfxCtx->NewPath();
- gfxCtx->Line(rect.BottomLeft(), rect.TopRight() + gfxPoint(-.7*w, .7*h));
- gfxCtx->Stroke();
+ aDrawTarget.StrokeLine(rect.BottomLeft(),
+ rect.TopRight() + Point(-.7*w, .7*h),
+ color, strokeOptions);
// Draw the arrow head
- gfxCtx->NewPath();
- gfxPoint p[] = {
- rect.TopRight(),
- rect.TopRight() + gfxPoint(-w -.4*h, std::max(-e / 2.0, h - .4*w)),
- rect.TopRight() + gfxPoint(-.7*w, .7*h),
- rect.TopRight() + gfxPoint(std::min(e / 2.0, -w + .4*h), h + .4*w),
- rect.TopRight()
- };
- gfxCtx->Polygon(p, MOZ_ARRAY_LENGTH(p));
- gfxCtx->Fill();
+ RefPtr builder = aDrawTarget.CreatePathBuilder();
+ builder->MoveTo(rect.TopRight());
+ builder->LineTo(rect.TopRight() + Point(-w -.4*h, std::max(-strokeWidth / 2.0, h - .4*w)));
+ builder->LineTo(rect.TopRight() + Point(-.7*w, .7*h));
+ builder->LineTo(rect.TopRight() + Point(std::min(strokeWidth / 2.0, -w + .4*h), h + .4*w));
+ builder->Close();
+ RefPtr path = builder->Finish();
+ aDrawTarget.Fill(path, color);
+ return;
}
- break;
-
case NOTATION_PHASORANGLE: {
// Compute some parameters to draw the angled line,
// that uses a slope of 2 (angle = tan^-1(2)).
// H = w * tan(angle) = w * 2
- gfxFloat w = gfxFloat(kPhasorangleWidth) * e;
- gfxFloat H = 2 * w;
+ Float w = Float(kPhasorangleWidth) * strokeWidth;
+ Float H = 2 * w;
// Draw the angled line
- gfxCtx->NewPath();
- gfxCtx->Line(rect.BottomLeft(), rect.BottomLeft() + gfxPoint(w, -H));
- gfxCtx->Stroke();
- break;
+ aDrawTarget.StrokeLine(rect.BottomLeft(),
+ rect.BottomLeft() + Point(w, -H),
+ color, strokeOptions);
+ return;
}
-
default:
NS_NOTREACHED("This notation can not be drawn using nsDisplayNotation");
- break;
}
-
- gfxCtx->Restore();
}
void
diff --git a/layout/mathml/nsMathMLmtableFrame.cpp b/layout/mathml/nsMathMLmtableFrame.cpp
index 29694d3a17f..3ee6fff4d6c 100644
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -275,6 +275,7 @@ public:
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) MOZ_OVERRIDE
{
+ *aSnap = true;
nsStyleBorder styleBorder = *mFrame->StyleBorder();
nsMathMLmtdFrame* frame = static_cast(mFrame);
ApplyBorderToStyle(frame, styleBorder);
diff --git a/layout/reftests/mathml/reftest.list b/layout/reftests/mathml/reftest.list
index 5ae6269a70f..907d6bacfd6 100644
--- a/layout/reftests/mathml/reftest.list
+++ b/layout/reftests/mathml/reftest.list
@@ -241,7 +241,7 @@ fails-if(B2G||Android||OSX==10.6) == menclose-3-radical.html menclose-3-radical-
== menclose-5-bottom.html menclose-5-bottom-ref.html
== menclose-5-box.html menclose-5-box-ref.html
fuzzy-if(OSX,1,100) == menclose-5-circle.html menclose-5-circle-ref.html
-== menclose-5-downdiagonalstrike.html menclose-5-downdiagonalstrike-ref.html
+fuzzy-if(d2d&&!contentSameGfxBackendAsCanvas,7,1) == menclose-5-downdiagonalstrike.html menclose-5-downdiagonalstrike-ref.html
== menclose-5-horizontalstrike.html menclose-5-horizontalstrike-ref.html
== menclose-5-left.html menclose-5-left-ref.html
== menclose-5-longdiv.html menclose-5-longdiv-ref.html
@@ -251,14 +251,14 @@ fuzzy-if(OSX,1,100) == menclose-5-circle.html menclose-5-circle-ref.html
== menclose-5-roundedbox.html menclose-5-roundedbox-ref.html
== menclose-5-top.html menclose-5-top-ref.html
== menclose-5-updiagonalarrow.html menclose-5-updiagonalarrow-ref.html
-== menclose-5-updiagonalstrike.html menclose-5-updiagonalstrike-ref.html
+fuzzy-if(d2d&&!contentSameGfxBackendAsCanvas,7,1) == menclose-5-updiagonalstrike.html menclose-5-updiagonalstrike-ref.html
== menclose-5-verticalstrike.html menclose-5-verticalstrike-ref.html
== menclose-5-phasorangle.html menclose-5-phasorangle-ref.html
== menclose-6-actuarial.html menclose-6-ref.html
== menclose-6-bottom.html menclose-6-ref.html
== menclose-6-box.html menclose-6-ref.html
== menclose-6-circle.html menclose-6-ref.html
-== menclose-6-downdiagonalstrike.html menclose-6-ref.html
+fuzzy-if(d2d&&!contentSameGfxBackendAsCanvas,7,1) == menclose-6-downdiagonalstrike.html menclose-6-ref.html
== menclose-6-horizontalstrike.html menclose-6-ref.html
== menclose-6-left.html menclose-6-ref.html
== menclose-6-longdiv.html menclose-6-ref.html
@@ -268,7 +268,7 @@ fuzzy-if(OSX,1,100) == menclose-5-circle.html menclose-5-circle-ref.html
== menclose-6-roundedbox.html menclose-6-ref.html
== menclose-6-top.html menclose-6-ref.html
== menclose-6-updiagonalarrow.html menclose-6-ref.html
-== menclose-6-updiagonalstrike.html menclose-6-ref.html
+fuzzy-if(d2d&&!contentSameGfxBackendAsCanvas,7,1) == menclose-6-updiagonalstrike.html menclose-6-ref.html
== menclose-6-verticalstrike.html menclose-6-ref.html
== menclose-6-phasorangle.html menclose-6-ref.html
== mmultiscript-align.html mmultiscript-align-ref.html
diff --git a/layout/reftests/scrolling/scroll-behavior-2.html b/layout/reftests/scrolling/scroll-behavior-2.html
index ee7ff866eb7..7a01eb01006 100644
--- a/layout/reftests/scrolling/scroll-behavior-2.html
+++ b/layout/reftests/scrolling/scroll-behavior-2.html
@@ -37,16 +37,13 @@
overflow: scroll;
}
- #scroll_1, #scroll_2, #scroll_3, #scroll_7 {
+ #scroll_1, #scroll_2, #scroll_3, #scroll_6 {
scroll-behavior: smooth;
}
#scroll_4 {
- scroll-behavior: instant;
- }
-
- #scroll_5 {
scroll-behavior: auto;
+ }
}
@@ -76,10 +73,6 @@
-