WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-153765-20160201212812.patch (text/plain), 10.81 KB, created by
Chris Dumez
on 2016-02-01 21:28:37 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2016-02-01 21:28:37 PST
Size:
10.81 KB
patch
obsolete
>Subversion Revision: 196001 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index c88e6958dab8636cbe73eaedcaa06a1e62ec74a0..4c3102451291b3b4ed221122ab6715a5d751c6e5 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,5 +1,22 @@ > 2016-02-01 Chris Dumez <cdumez@apple.com> > >+ object.__lookupGetter__() / object.__lookupSetter__() does not work for native bindings >+ https://bugs.webkit.org/show_bug.cgi?id=153765 >+ <rdar://problem/24439699> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add support for CustomAccessor slots to objectProtoFuncLookupGetter() and >+ objectProtoFuncLookupSetter() by return getOwnPropertyDescriptor().get / set. >+ getOwnPropertyDescriptor() now correctly deals with CustomAccessors since >+ r196001. >+ >+ * runtime/ObjectPrototype.cpp: >+ (JSC::objectProtoFuncLookupGetter): >+ (JSC::objectProtoFuncLookupSetter): >+ >+2016-02-01 Chris Dumez <cdumez@apple.com> >+ > Native Bindings Descriptors are Incomplete > https://bugs.webkit.org/show_bug.cgi?id=140575 > <rdar://problem/19506502> >diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp >index c525436218d4c0c1e9e0825e1a062c6049bf2337..fdaba1af2aee6d7aa749926d3d265163212ed5fb 100644 >--- a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp >+++ b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp >@@ -175,9 +175,17 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState* exec) > return JSValue::encode(jsUndefined()); > > PropertySlot slot(thisObject); >- if (thisObject->getPropertySlot(exec, propertyName, slot) && slot.isAccessor()) { >- GetterSetter* getterSetter = slot.getterSetter(); >- return getterSetter->isGetterNull() ? JSValue::encode(jsUndefined()) : JSValue::encode(getterSetter->getter()); >+ if (thisObject->getPropertySlot(exec, propertyName, slot)) { >+ if (slot.isAccessor()) { >+ GetterSetter* getterSetter = slot.getterSetter(); >+ return getterSetter->isGetterNull() ? JSValue::encode(jsUndefined()) : JSValue::encode(getterSetter->getter()); >+ } >+ if (slot.attributes() & CustomAccessor) { >+ PropertyDescriptor descriptor; >+ ASSERT(slot.slotBase()); >+ if (slot.slotBase()->getOwnPropertyDescriptor(exec, propertyName, descriptor)) >+ return descriptor.getterPresent() ? JSValue::encode(descriptor.getter()) : JSValue::encode(jsUndefined()); >+ } > } > > return JSValue::encode(jsUndefined()); >@@ -194,9 +202,17 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec) > return JSValue::encode(jsUndefined()); > > PropertySlot slot(thisObject); >- if (thisObject->getPropertySlot(exec, propertyName, slot) && slot.isAccessor()) { >- GetterSetter* getterSetter = slot.getterSetter(); >- return getterSetter->isSetterNull() ? JSValue::encode(jsUndefined()) : JSValue::encode(getterSetter->setter()); >+ if (thisObject->getPropertySlot(exec, propertyName, slot)) { >+ if (slot.isAccessor()) { >+ GetterSetter* getterSetter = slot.getterSetter(); >+ return getterSetter->isSetterNull() ? JSValue::encode(jsUndefined()) : JSValue::encode(getterSetter->setter()); >+ } >+ if (slot.attributes() & CustomAccessor) { >+ PropertyDescriptor descriptor; >+ ASSERT(slot.slotBase()); >+ if (slot.slotBase()->getOwnPropertyDescriptor(exec, propertyName, descriptor)) >+ return descriptor.setterPresent() ? JSValue::encode(descriptor.setter()) : JSValue::encode(jsUndefined()); >+ } > } > > return JSValue::encode(jsUndefined()); >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index f11affdbdebbcffebf75d914588b423cf2cbd367..512e6efd79080bcc37129c16b648e5013ca9229f 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,5 +1,19 @@ > 2016-02-01 Chris Dumez <cdumez@apple.com> > >+ object.__lookupGetter__() / object.__lookupSetter__() does not work for native bindings >+ https://bugs.webkit.org/show_bug.cgi?id=153765 >+ <rdar://problem/24439699> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add layout tests to test that object.__lookupGetter__() / object.__lookupSetter__() >+ works for native bindings. >+ >+ * js/lookupGetterGetter-native-bindings-expected.txt: Added. >+ * js/lookupGetterGetter-native-bindings.html: Added. >+ >+2016-02-01 Chris Dumez <cdumez@apple.com> >+ > Native Bindings Descriptors are Incomplete > https://bugs.webkit.org/show_bug.cgi?id=140575 > <rdar://problem/19506502> >diff --git a/LayoutTests/js/lookupGetterGetter-native-bindings-expected.txt b/LayoutTests/js/lookupGetterGetter-native-bindings-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..2a0b817b55575786429da95b656da0a8312c75d6 >--- /dev/null >+++ b/LayoutTests/js/lookupGetterGetter-native-bindings-expected.txt >@@ -0,0 +1,41 @@ >+Checks that __lookupGetter__ / __lookupSetter__() works for native bindings. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS Element.prototype.__lookupGetter__('tagName') is an instance of Function >+PASS Element.prototype.__lookupSetter__('tagName') is undefined. >+PASS Element.prototype.__lookupGetter__('tagName') is Object.getOwnPropertyDescriptor(Element.prototype, 'tagName').get >+PASS Element.prototype.__lookupSetter__('tagName') is Object.getOwnPropertyDescriptor(Element.prototype, 'tagName').set >+PASS testDiv.tagName is "DIV" >+PASS Element.prototype.__lookupGetter__('tagName').call(testDiv) is "DIV" >+ >+PASS Element.prototype.__lookupGetter__('nodeName') is an instance of Function >+PASS Element.prototype.__lookupSetter__('nodeName') is undefined. >+PASS Element.prototype.__lookupGetter__('nodeName') is Object.getOwnPropertyDescriptor(Node.prototype, 'nodeName').get >+PASS Element.prototype.__lookupSetter__('nodeName') is Object.getOwnPropertyDescriptor(Node.prototype, 'nodeName').set >+PASS testDiv.nodeName is "DIV" >+PASS Element.prototype.__lookupGetter__('nodeName').call(testDiv) is "DIV" >+ >+PASS HTMLElement.prototype.__lookupGetter__('innerText') is an instance of Function >+PASS HTMLElement.prototype.__lookupSetter__('innerText') is an instance of Function >+PASS HTMLDivElement.prototype.__lookupGetter__('innerText') is an instance of Function >+PASS HTMLDivElement.prototype.__lookupSetter__('innerText') is an instance of Function >+PASS testDiv.__proto__.__lookupGetter__('innerText') is an instance of Function >+PASS testDiv.__proto__.__lookupSetter__('innerText') is an instance of Function >+PASS testDiv.__proto__.__proto__.__lookupGetter__('innerText') is an instance of Function >+PASS testDiv.__proto__.__proto__.__lookupSetter__('innerText') is an instance of Function >+PASS HTMLElement.prototype.__lookupGetter__('innerText') is Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'innerText').get >+PASS HTMLElement.prototype.__lookupSetter__('innerText') is Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'innerText').set >+PASS testDiv.innerText is "" >+PASS HTMLElement.prototype.__lookupGetter__('innerText').call(testDiv) is "" >+testDiv.innerText = 'TEST1' >+PASS testDiv.innerText is "TEST1" >+PASS HTMLElement.prototype.__lookupGetter__('innerText').call(testDiv) is "TEST1" >+HTMLElement.prototype.__lookupSetter__('innerText').call(testDiv, '') >+PASS testDiv.innerText is "" >+PASS HTMLElement.prototype.__lookupGetter__('innerText').call(testDiv) is "" >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/js/lookupGetterGetter-native-bindings.html b/LayoutTests/js/lookupGetterGetter-native-bindings.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d9e3a2390331a4d533fa3ffec6a21e18db914069 >--- /dev/null >+++ b/LayoutTests/js/lookupGetterGetter-native-bindings.html >@@ -0,0 +1,50 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../resources/js-test-pre.js"></script> >+</head> >+<body> >+<div id="testDiv"></div> >+<script> >+description("Checks that __lookupGetter__ / __lookupSetter__() works for native bindings."); >+ >+var testDiv = document.getElementById("testDiv"); >+ >+shouldBeType("Element.prototype.__lookupGetter__('tagName')", "Function"); >+shouldBeUndefined("Element.prototype.__lookupSetter__('tagName')"); >+shouldBe("Element.prototype.__lookupGetter__('tagName')", "Object.getOwnPropertyDescriptor(Element.prototype, 'tagName').get"); >+shouldBe("Element.prototype.__lookupSetter__('tagName')", "Object.getOwnPropertyDescriptor(Element.prototype, 'tagName').set"); >+shouldBeEqualToString("testDiv.tagName", "DIV"); >+shouldBeEqualToString("Element.prototype.__lookupGetter__('tagName').call(testDiv)", "DIV"); >+ >+debug(""); >+shouldBeType("Element.prototype.__lookupGetter__('nodeName')", "Function"); >+shouldBeUndefined("Element.prototype.__lookupSetter__('nodeName')"); >+shouldBe("Element.prototype.__lookupGetter__('nodeName')", "Object.getOwnPropertyDescriptor(Node.prototype, 'nodeName').get"); >+shouldBe("Element.prototype.__lookupSetter__('nodeName')", "Object.getOwnPropertyDescriptor(Node.prototype, 'nodeName').set"); >+shouldBeEqualToString("testDiv.nodeName", "DIV"); >+shouldBeEqualToString("Element.prototype.__lookupGetter__('nodeName').call(testDiv)", "DIV"); >+ >+debug(""); >+shouldBeType("HTMLElement.prototype.__lookupGetter__('innerText')", "Function"); >+shouldBeType("HTMLElement.prototype.__lookupSetter__('innerText')", "Function"); >+shouldBeType("HTMLDivElement.prototype.__lookupGetter__('innerText')", "Function"); >+shouldBeType("HTMLDivElement.prototype.__lookupSetter__('innerText')", "Function"); >+shouldBeType("testDiv.__proto__.__lookupGetter__('innerText')", "Function"); >+shouldBeType("testDiv.__proto__.__lookupSetter__('innerText')", "Function"); >+shouldBeType("testDiv.__proto__.__proto__.__lookupGetter__('innerText')", "Function"); >+shouldBeType("testDiv.__proto__.__proto__.__lookupSetter__('innerText')", "Function"); >+shouldBe("HTMLElement.prototype.__lookupGetter__('innerText')", "Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'innerText').get"); >+shouldBe("HTMLElement.prototype.__lookupSetter__('innerText')", "Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'innerText').set"); >+shouldBeEqualToString("testDiv.innerText", ""); >+shouldBeEqualToString("HTMLElement.prototype.__lookupGetter__('innerText').call(testDiv)", ""); >+evalAndLog("testDiv.innerText = 'TEST1'"); >+shouldBeEqualToString("testDiv.innerText", "TEST1"); >+shouldBeEqualToString("HTMLElement.prototype.__lookupGetter__('innerText').call(testDiv)", "TEST1"); >+evalAndLog("HTMLElement.prototype.__lookupSetter__('innerText').call(testDiv, '')"); >+shouldBeEqualToString("testDiv.innerText", ""); >+shouldBeEqualToString("HTMLElement.prototype.__lookupGetter__('innerText').call(testDiv)", ""); >+</script> >+<script src="../resources/js-test-post.js"></script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 153765
: 270470