Changeset 224606 in webkit
- Timestamp:
- Nov 8, 2017, 4:36:15 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r224605 r224606 1 2017-11-08 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Show Internal properties of PaymentRequest in Web Inspector Console 4 https://bugs.webkit.org/show_bug.cgi?id=179276 5 6 Reviewed by Andy Estes. 7 8 * TestExpectations: 9 * platform/mac-wk2/TestExpectations: 10 Pass test on platforms that support Payment Requests. 11 12 * http/tests/inspector/paymentrequest/payment-request-internal-properties.https-expected.txt: Added. 13 * http/tests/inspector/paymentrequest/payment-request-internal-properties.https.html: Added. 14 Test for internal properties on PaymentRequest instances. 15 16 * resources/ui-helper.js: 17 (window.UIHelper.withUserGesture): 18 Provide an easier way to simulate work inside of a user gesture. 19 1 20 2017-11-08 Ryan Haddad <ryanhaddad@apple.com> 2 21 -
trunk/LayoutTests/TestExpectations
r224585 r224606 201 201 # Payment Request is only enabled on Cocoa platforms. 202 202 http/tests/paymentrequest [ Skip ] 203 http/tests/inspector/paymentrequest [ Skip ] 203 204 imported/w3c/web-platform-tests/payment-request [ Skip ] 204 205 -
trunk/LayoutTests/http/tests/inspector/network/resource-response-service-worker.html
r224357 r224606 17 17 function test() 18 18 { 19 InspectorTest.debug();20 19 let suite = InspectorTest.createAsyncSuite("Resource.ResponseSource.ServiceWorker"); 21 20 -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r224417 r224606 27 27 28 28 [ Sierra+ ] http/tests/paymentrequest [ Pass ] 29 [ Sierra+ ] http/tests/inspector/paymentrequest [ Pass ] 29 30 [ Sierra+ ] imported/w3c/web-platform-tests/payment-request [ Pass ] 30 31 webkit.org/b/178107 [ Sierra+ ] http/tests/paymentrequest/payment-request-abort-method.https.html [ Pass Failure ] -
trunk/LayoutTests/resources/ui-helper.js
r224402 r224606 157 157 return promise.then(finish, finish); 158 158 } 159 160 static withUserGesture(callback) 161 { 162 internals.withUserGesture(callback); 163 } 159 164 } -
trunk/Source/JavaScriptCore/ChangeLog
r224603 r224606 1 2017-11-08 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Show Internal properties of PaymentRequest in Web Inspector Console 4 https://bugs.webkit.org/show_bug.cgi?id=179276 5 6 Reviewed by Andy Estes. 7 8 * inspector/InjectedScriptHost.h: 9 * inspector/JSInjectedScriptHost.cpp: 10 (Inspector::JSInjectedScriptHost::getInternalProperties): 11 Call through to virtual implementation so that WebCore can provide custom 12 internal properties for Web / DOM objects. 13 1 14 2017-11-08 Saam Barati <sbarati@apple.com> 2 15 -
trunk/Source/JavaScriptCore/inspector/InjectedScriptHost.h
r218794 r224606 38 38 39 39 virtual JSC::JSValue subtype(JSC::ExecState*, JSC::JSValue) { return JSC::jsUndefined(); } 40 virtual JSC::JSValue getInternalProperties(JSC::VM&, JSC::ExecState*, JSC::JSValue) { return { }; } 40 41 virtual bool isHTMLAllCollection(JSC::VM&, JSC::JSValue) { return false; } 41 42 -
trunk/Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp
r222421 r224606 273 273 JSValue value = exec->uncheckedArgument(0); 274 274 275 JSValue internalProperties = impl().getInternalProperties(vm, exec, value); 276 if (internalProperties) 277 return internalProperties; 278 275 279 if (JSPromise* promise = jsDynamicCast<JSPromise*>(vm, value)) { 276 280 unsigned index = 0; -
trunk/Source/WebCore/ChangeLog
r224604 r224606 1 2017-11-08 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Show Internal properties of PaymentRequest in Web Inspector Console 4 https://bugs.webkit.org/show_bug.cgi?id=179276 5 6 Reviewed by Andy Estes. 7 8 Test: http/tests/inspector/runtime/internal-properties-payment-request.https.html 9 10 * Modules/paymentrequest/PaymentRequest.h: 11 Expose access to internal state. 12 13 * inspector/WebInjectedScriptHost.h: 14 * inspector/WebInjectedScriptHost.cpp: 15 (WebCore::constructInternalProperty): 16 (WebCore::WebInjectedScriptHost::getInternalProperties): 17 Provide internal properties for a PaymentRequest. 18 19 * testing/Internals.cpp: 20 (WebCore::Internals::withUserGesture): 21 * testing/Internals.h: 22 * testing/Internals.idl: 23 Provide a simple way to run code inside of a user gesture. 24 1 25 2017-11-08 Ryosuke Niwa <rniwa@webkit.org> 2 26 -
trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.h
r224459 r224606 66 66 std::optional<PaymentShippingType> shippingType() const; 67 67 68 enum class State { 69 Created, 70 Interactive, 71 Closed, 72 }; 73 74 State state() const { return m_state; } 75 68 76 const PaymentOptions& paymentOptions() const { return m_options; } 69 77 const PaymentDetailsInit& paymentDetails() const { return m_details; } … … 81 89 82 90 private: 83 enum class State {84 Created,85 Interactive,86 Closed,87 };88 89 91 struct Method { 90 92 MethodIdentifier identifier; -
trunk/Source/WebCore/html/VoidCallback.idl
r208408 r224606 21 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 24 */ 25 25 26 callback VoidCallback = void (); 26 [ 27 ExportMacro=WEBCORE_EXPORT 28 ] callback VoidCallback = void (); -
trunk/Source/WebCore/inspector/WebInjectedScriptHost.cpp
r223476 r224606 1 1 /* 2 * Copyright (C) 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2013-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 34 34 #include "JSNodeList.h" 35 35 36 #if ENABLE(PAYMENT_REQUEST) 37 #include "JSPaymentRequest.h" 38 #include "JSPaymentShippingType.h" 39 #include "PaymentOptions.h" 40 #include "PaymentRequest.h" 41 #endif 36 42 37 43 namespace WebCore { 44 38 45 using namespace JSC; 39 46 40 JSValue WebInjectedScriptHost::subtype( JSC::ExecState* exec, JSC::JSValue value)47 JSValue WebInjectedScriptHost::subtype(ExecState* exec, JSValue value) 41 48 { 42 49 VM& vm = exec->vm(); … … 53 60 } 54 61 62 #if ENABLE(PAYMENT_REQUEST) 63 static JSObject* constructInternalProperty(VM& vm, ExecState* exec, const String& name, JSValue value) 64 { 65 auto* object = constructEmptyObject(exec); 66 object->putDirect(vm, Identifier::fromString(exec, "name"), jsString(exec, name)); 67 object->putDirect(vm, Identifier::fromString(exec, "value"), value); 68 return object; 69 } 70 71 static JSObject* objectForPaymentOptions(VM& vm, ExecState* exec, const PaymentOptions& paymentOptions) 72 { 73 auto* object = constructEmptyObject(exec); 74 object->putDirect(vm, Identifier::fromString(exec, "requestPayerName"), jsBoolean(paymentOptions.requestPayerName)); 75 object->putDirect(vm, Identifier::fromString(exec, "requestPayerEmail"), jsBoolean(paymentOptions.requestPayerEmail)); 76 object->putDirect(vm, Identifier::fromString(exec, "requestPayerPhone"), jsBoolean(paymentOptions.requestPayerPhone)); 77 object->putDirect(vm, Identifier::fromString(exec, "requestShipping"), jsBoolean(paymentOptions.requestShipping)); 78 object->putDirect(vm, Identifier::fromString(exec, "shippingType"), jsNontrivialString(exec, convertEnumerationToString(paymentOptions.shippingType))); 79 return object; 80 } 81 82 static JSObject* objectForPaymentCurrencyAmount(VM& vm, ExecState* exec, const PaymentCurrencyAmount& paymentCurrencyAmount) 83 { 84 auto* object = constructEmptyObject(exec); 85 object->putDirect(vm, Identifier::fromString(exec, "currency"), jsString(exec, paymentCurrencyAmount.currency)); 86 object->putDirect(vm, Identifier::fromString(exec, "value"), jsString(exec, paymentCurrencyAmount.value)); 87 object->putDirect(vm, Identifier::fromString(exec, "currencySystem"), jsString(exec, paymentCurrencyAmount.currencySystem)); 88 return object; 89 } 90 91 static JSObject* objectForPaymentItem(VM& vm, ExecState* exec, const PaymentItem& paymentItem) 92 { 93 auto* object = constructEmptyObject(exec); 94 object->putDirect(vm, Identifier::fromString(exec, "label"), jsString(exec, paymentItem.label)); 95 object->putDirect(vm, Identifier::fromString(exec, "amount"), objectForPaymentCurrencyAmount(vm, exec, paymentItem.amount)); 96 object->putDirect(vm, Identifier::fromString(exec, "pending"), jsBoolean(paymentItem.pending)); 97 return object; 98 } 99 100 static JSObject* objectForPaymentShippingOption(VM& vm, ExecState* exec, const PaymentShippingOption& paymentShippingOption) 101 { 102 auto* object = constructEmptyObject(exec); 103 object->putDirect(vm, Identifier::fromString(exec, "id"), jsString(exec, paymentShippingOption.id)); 104 object->putDirect(vm, Identifier::fromString(exec, "label"), jsString(exec, paymentShippingOption.label)); 105 object->putDirect(vm, Identifier::fromString(exec, "amount"), objectForPaymentCurrencyAmount(vm, exec, paymentShippingOption.amount)); 106 object->putDirect(vm, Identifier::fromString(exec, "selected"), jsBoolean(paymentShippingOption.selected)); 107 return object; 108 } 109 110 static JSObject* objectForPaymentDetailsModifier(VM& vm, ExecState* exec, const PaymentDetailsModifier& modifier) 111 { 112 auto* additionalDisplayItems = constructEmptyArray(exec, nullptr); 113 for (unsigned i = 0; i < modifier.additionalDisplayItems.size(); ++i) 114 additionalDisplayItems->putDirectIndex(exec, i, objectForPaymentItem(vm, exec, modifier.additionalDisplayItems[i])); 115 116 auto* object = constructEmptyObject(exec); 117 object->putDirect(vm, Identifier::fromString(exec, "supportedMethods"), jsString(exec, modifier.supportedMethods)); 118 object->putDirect(vm, Identifier::fromString(exec, "total"), !modifier.total ? jsNull() : objectForPaymentItem(vm, exec, *modifier.total)); 119 object->putDirect(vm, Identifier::fromString(exec, "additionalDisplayItems"), additionalDisplayItems); 120 object->putDirect(vm, Identifier::fromString(exec, "data"), !modifier.data ? jsNull() : modifier.data.get()); 121 return object; 122 } 123 124 static JSObject* objectForPaymentDetails(VM& vm, ExecState* exec, const PaymentDetailsInit& paymentDetails) 125 { 126 auto* displayItems = constructEmptyArray(exec, nullptr); 127 for (unsigned i = 0; i < paymentDetails.displayItems.size(); ++i) 128 displayItems->putDirectIndex(exec, i, objectForPaymentItem(vm, exec, paymentDetails.displayItems[i])); 129 130 auto* shippingOptions = constructEmptyArray(exec, nullptr); 131 for (unsigned i = 0; i < paymentDetails.shippingOptions.size(); ++i) 132 shippingOptions->putDirectIndex(exec, i, objectForPaymentShippingOption(vm, exec, paymentDetails.shippingOptions[i])); 133 134 auto* modifiers = constructEmptyArray(exec, nullptr); 135 for (unsigned i = 0; i < paymentDetails.modifiers.size(); ++i) 136 modifiers->putDirectIndex(exec, i, objectForPaymentDetailsModifier(vm, exec, paymentDetails.modifiers[i])); 137 138 auto* object = constructEmptyObject(exec); 139 object->putDirect(vm, Identifier::fromString(exec, "id"), jsString(exec, paymentDetails.id)); 140 object->putDirect(vm, Identifier::fromString(exec, "total"), objectForPaymentItem(vm, exec, paymentDetails.total)); 141 object->putDirect(vm, Identifier::fromString(exec, "displayItems"), displayItems); 142 object->putDirect(vm, Identifier::fromString(exec, "shippingOptions"), shippingOptions); 143 object->putDirect(vm, Identifier::fromString(exec, "modifiers"), modifiers); 144 return object; 145 } 146 147 static JSString* jsStringForPaymentRequestState(VM& vm, ExecState* exec, PaymentRequest::State state) 148 { 149 switch (state) { 150 case PaymentRequest::State::Created: 151 return jsNontrivialString(exec, ASCIILiteral("created")); 152 case PaymentRequest::State::Interactive: 153 return jsNontrivialString(exec, ASCIILiteral("interactive")); 154 case PaymentRequest::State::Closed: 155 return jsNontrivialString(exec, ASCIILiteral("closed")); 156 } 157 158 ASSERT_NOT_REACHED(); 159 return jsEmptyString(&vm); 160 } 161 #endif 162 163 JSValue WebInjectedScriptHost::getInternalProperties(VM& vm, ExecState* exec, JSC::JSValue value) 164 { 165 auto scope = DECLARE_THROW_SCOPE(vm); 166 167 #if ENABLE(PAYMENT_REQUEST) 168 if (PaymentRequest* paymentRequest = JSPaymentRequest::toWrapped(vm, value)) { 169 unsigned index = 0; 170 auto* array = constructEmptyArray(exec, nullptr); 171 array->putDirectIndex(exec, index++, constructInternalProperty(vm, exec, ASCIILiteral("options"), objectForPaymentOptions(vm, exec, paymentRequest->paymentOptions()))); 172 array->putDirectIndex(exec, index++, constructInternalProperty(vm, exec, ASCIILiteral("details"), objectForPaymentDetails(vm, exec, paymentRequest->paymentDetails()))); 173 array->putDirectIndex(exec, index++, constructInternalProperty(vm, exec, ASCIILiteral("state"), jsStringForPaymentRequestState(vm, exec, paymentRequest->state()))); 174 RETURN_IF_EXCEPTION(scope, { }); 175 return array; 176 } 177 #else 178 UNUSED_PARAM(exec); 179 UNUSED_PARAM(value); 180 #endif 181 182 return { }; 183 } 184 55 185 bool WebInjectedScriptHost::isHTMLAllCollection(JSC::VM& vm, JSC::JSValue value) 56 186 { -
trunk/Source/WebCore/inspector/WebInjectedScriptHost.h
r211247 r224606 35 35 36 36 JSC::JSValue subtype(JSC::ExecState*, JSC::JSValue) override; 37 JSC::JSValue getInternalProperties(JSC::VM&, JSC::ExecState*, JSC::JSValue) override; 37 38 bool isHTMLAllCollection(JSC::VM&, JSC::JSValue) override; 38 39 }; -
trunk/Source/WebCore/testing/Internals.cpp
r224584 r224606 149 149 #include "UserMediaController.h" 150 150 #include "ViewportArguments.h" 151 #include "VoidCallback.h" 151 152 #include "WebCoreJSClientData.h" 152 153 #if ENABLE(WEBGL) … … 3898 3899 } 3899 3900 3901 void Internals::withUserGesture(RefPtr<VoidCallback>&& callback) 3902 { 3903 UserGestureIndicator gestureIndicator(ProcessingUserGesture, contextDocument()); 3904 callback->handleEvent(); 3905 } 3906 3900 3907 double Internals::lastHandledUserGestureTimestamp() 3901 3908 { -
trunk/Source/WebCore/testing/Internals.h
r224584 r224606 77 77 class NodeList; 78 78 class Page; 79 class RTCPeerConnection; 79 80 class Range; 80 81 class RenderedDocumentMarker; 81 class RTCPeerConnection;82 82 class SVGSVGElement; 83 83 class SerializedScriptValue; … … 87 87 class TimeRanges; 88 88 class TypeConversions; 89 class VoidCallback; 89 90 class WebGLRenderingContext; 90 91 class XMLHttpRequest; … … 559 560 double lastHandledUserGestureTimestamp(); 560 561 562 void withUserGesture(RefPtr<VoidCallback>&&); 563 561 564 RefPtr<GCObservation> observeGC(JSC::JSValue); 562 565 -
trunk/Source/WebCore/testing/Internals.idl
r224584 r224606 514 514 double lastHandledUserGestureTimestamp(); 515 515 516 void withUserGesture(VoidCallback callback); 517 516 518 GCObservation? observeGC(any observed); 517 519 -
trunk/Source/WebInspectorUI/ChangeLog
r224595 r224606 1 2017-11-08 Joseph Pecoraro <pecoraro@apple.com> 2 3 Web Inspector: Show Internal properties of PaymentRequest in Web Inspector Console 4 https://bugs.webkit.org/show_bug.cgi?id=179276 5 6 Reviewed by Andy Estes. 7 8 * UserInterface/Test.html: 9 * UserInterface/Test/FrontendTestHarness.js: 10 (FrontendTestHarness.prototype.evaluateInPage): 11 * UserInterface/Test/TestUtilities.js: Added. 12 (promisify): 13 Make async tests a little easier to work with by providing promises 14 in some cases that would normally take a callback. 15 1 16 2017-11-08 Brian Burg <bburg@apple.com> 2 17 -
trunk/Source/WebInspectorUI/UserInterface/Test.html
r224367 r224606 49 49 <script src="Controllers/AppControllerBase.js"></script> 50 50 <script src="Test/TestAppController.js"></script> 51 <script src="Test/TestUtilities.js"></script> 51 52 52 53 <script src="Base/DOMUtilities.js"></script> -
trunk/Source/WebInspectorUI/UserInterface/Test/FrontendTestHarness.js
r223308 r224606 87 87 } 88 88 89 RuntimeAgent.evaluate.invoke({expression, objectGroup: "test", includeCommandLineAPI: false}, callback); 89 if (typeof callback === "function") 90 RuntimeAgent.evaluate.invoke({expression, objectGroup: "test", includeCommandLineAPI: false}, callback); 91 else 92 return RuntimeAgent.evaluate.invoke({expression, objectGroup: "test", includeCommandLineAPI: false}); 90 93 } 91 94
Note:
See TracChangeset
for help on using the changeset viewer.