Bug 1396694 (part 1) - Make nsIAtom non-scriptable. r=froydnj.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 05 Sep 2017 16:06:43 +1000
changeset 379424 60ac0fadec3127895fa37fe392f4981f4fa75105
parent 379423 7282bbabab15133686eef40434da0940a9244cea
child 379425 15c449b14ea25a11bed7b9f5620c607aa7a3702b
push id32453
push userarchaeopteryx@coole-files.de
push dateThu, 07 Sep 2017 10:39:44 +0000
treeherdermozilla-central@37b95547f0d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1396694
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1396694 (part 1) - Make nsIAtom non-scriptable. r=froydnj. This also lets us remove a couple of IDL methods.
parser/html/nsHtml5Atom.cpp
xpcom/ds/nsAtomTable.cpp
xpcom/ds/nsIAtom.idl
--- a/parser/html/nsHtml5Atom.cpp
+++ b/parser/html/nsHtml5Atom.cpp
@@ -43,35 +43,21 @@ nsHtml5Atom::~nsHtml5Atom()
 NS_IMETHODIMP
 nsHtml5Atom::QueryInterface(REFNSIID aIID, void** aInstancePtr)
 {
   NS_NOTREACHED("Attempt to call QueryInterface an nsHtml5Atom.");
   return NS_ERROR_UNEXPECTED;
 }
 
 NS_IMETHODIMP
-nsHtml5Atom::ScriptableToString(nsAString& aBuf)
-{
-  NS_NOTREACHED("Should not call ScriptableToString.");
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
 nsHtml5Atom::ToUTF8String(nsACString& aReturn)
 {
   NS_NOTREACHED("Should not attempt to convert to an UTF-8 string.");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-NS_IMETHODIMP
-nsHtml5Atom::ScriptableEquals(const nsAString& aString, bool* aResult)
-{
-  NS_NOTREACHED("Should not call ScriptableEquals.");
-  return NS_ERROR_NOT_IMPLEMENTED;
-}
-
 NS_IMETHODIMP_(size_t)
 nsHtml5Atom::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
 {
   NS_NOTREACHED("Should not call SizeOfIncludingThis.");
   return 0;
 }
 
--- a/xpcom/ds/nsAtomTable.cpp
+++ b/xpcom/ds/nsAtomTable.cpp
@@ -213,36 +213,22 @@ public:
 protected:
   ThreadSafeAutoRefCnt mRefCnt;
   NS_DECL_OWNINGTHREAD
 };
 
 NS_IMPL_QUERY_INTERFACE(Atom, nsIAtom);
 
 NS_IMETHODIMP
-Atom::ScriptableToString(nsAString& aBuf)
-{
-  nsStringBuffer::FromData(mString)->ToString(mLength, aBuf);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 Atom::ToUTF8String(nsACString& aBuf)
 {
   CopyUTF16toUTF8(nsDependentString(mString, mLength), aBuf);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-Atom::ScriptableEquals(const nsAString& aString, bool* aResult)
-{
-  *aResult = aString.Equals(nsDependentString(mString, mLength));
-  return NS_OK;
-}
-
 NS_IMETHODIMP_(size_t)
 Atom::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf)
 {
   size_t n = aMallocSizeOf(this);
   // String buffers pointed to by static atoms are in static memory, and so
   // are not measured here.
   if (IsDynamicAtom()) {
     n += nsStringBuffer::FromData(mString)->SizeOfIncludingThisIfUnshared(
--- a/xpcom/ds/nsIAtom.idl
+++ b/xpcom/ds/nsIAtom.idl
@@ -13,31 +13,24 @@
 native MallocSizeOf(mozilla::MallocSizeOf);
 
 /*
  * Should this really be scriptable?  Using atoms from script or proxies
  * could be dangerous since double-wrapping could lead to loss of
  * pointer identity.
  */
 
-[scriptable, builtinclass, uuid(8b8c11d4-3ed5-4079-8974-73c7576cdb34)]
+[builtinclass, uuid(8b8c11d4-3ed5-4079-8974-73c7576cdb34)]
 interface nsIAtom : nsISupports
 {
   /**
-   * Get the Unicode or UTF8 value for the string
+   * Get the UTF8 value for the string
    */
-  [binaryname(ScriptableToString)] AString toString();
   [noscript] AUTF8String toUTF8String();
 
-  /**
-   * Compare the atom to a specific string value
-   * Note that this will NEVER return/throw an error condition.
-   */
-  [binaryname(ScriptableEquals)] boolean equals(in AString aString);
-
   [noscript, notxpcom]
   size_t SizeOfIncludingThis(in MallocSizeOf aMallocSizeOf);
 
 %{C++
   // The kind of atom we have, in order to be able to devirtualize hot stuff
   // looking at mKind.
   enum class AtomKind : uint8_t {
     DynamicAtom = 0,