Add operator==(PropertyName, const char*)
authormsaboff@apple.com <msaboff@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Oct 2014 20:43:18 +0000 (20:43 +0000)
committermsaboff@apple.com <msaboff@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 21 Oct 2014 20:43:18 +0000 (20:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=137925

Reviewed by Mark Lam.

Source/JavaScriptCore:

* runtime/PropertyName.h:
(JSC::operator==): Added to simplify comparison with string literals.

Source/WebCore:

Use new == operator to compare a PropertyName with a string literal.

* bindings/js/JSHTMLDocumentCustom.cpp:
(WebCore::JSHTMLDocument::getOwnPropertySlot):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174997 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/PropertyName.h
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp

index 22cefcd..8e85731 100644 (file)
@@ -1,5 +1,16 @@
 2014-10-21  Michael Saboff  <msaboff@apple.com>
 
+        Add operator==(PropertyName, const char*)
+        https://bugs.webkit.org/show_bug.cgi?id=137925
+
+        Reviewed by Mark Lam.
+
+        * runtime/PropertyName.h:
+        (JSC::operator==): Added to simplify comparison with string literals.
+
+
+2014-10-21  Michael Saboff  <msaboff@apple.com>
+
         Change native call frames to use the scope from their Callee instead of their caller's scope
         https://bugs.webkit.org/show_bug.cgi?id=137907
 
index d739cef..22a8ff8 100644 (file)
@@ -141,6 +141,11 @@ inline bool operator==(PropertyName a, PropertyName b)
     return a.uid() == b.uid();
 }
 
+inline bool operator==(PropertyName a, const char* b)
+{
+    return equal(a.uid(), b);
+}
+
 inline bool operator!=(PropertyName a, const Identifier& b)
 {
     return a.uid() != b.impl();
index 7adf7c0..baa7711 100644 (file)
@@ -1,3 +1,15 @@
+2014-10-21  Michael Saboff  <msaboff@apple.com>
+
+        Add operator==(PropertyName, const char*)
+        https://bugs.webkit.org/show_bug.cgi?id=137925
+
+        Reviewed by Mark Lam.
+
+        Use new == operator to compare a PropertyName with a string literal.
+
+        * bindings/js/JSHTMLDocumentCustom.cpp:
+        (WebCore::JSHTMLDocument::getOwnPropertySlot):
+
 2014-10-21  Chris Dumez  <cdumez@apple.com>
 
         Unreviewed iOS build fix after r174921.
index 8463811..6a8ec18 100644 (file)
@@ -62,15 +62,15 @@ bool JSHTMLDocument::getOwnPropertySlot(JSObject* object, ExecState* exec, Prope
     JSHTMLDocument* thisObject = jsCast<JSHTMLDocument*>(object);
     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
 
-    if (equal(propertyName.publicName(), "open")) {
+    if (propertyName == "open") {
         slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsHTMLDocumentPrototypeFunctionOpen, 2>);
         return true;
     }
-    if (equal(propertyName.publicName(), "write")) {
+    if (propertyName == "write") {
         slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsHTMLDocumentPrototypeFunctionWrite, 1>);
         return true;
     }
-    if (equal(propertyName.publicName(), "writeln")) {
+    if (propertyName == "writeln") {
         slot.setCustom(thisObject, ReadOnly | DontDelete | DontEnum, nonCachingStaticFunctionGetter<jsHTMLDocumentPrototypeFunctionWriteln, 1>);
         return true;
     }