Index: third_party/WebKit/Source/modules/nfc/NFC.cpp |
diff --git a/third_party/WebKit/Source/modules/nfc/NFC.cpp b/third_party/WebKit/Source/modules/nfc/NFC.cpp |
index 4a3d6ece9cdd2b6a0ae11be11120a9e197a1d927..c404247ae0e2a2c90293b981d7987b5e1abc9387 100644 |
--- a/third_party/WebKit/Source/modules/nfc/NFC.cpp |
+++ b/third_party/WebKit/Source/modules/nfc/NFC.cpp |
@@ -618,6 +618,18 @@ ScriptPromise NFC::push(ScriptState* script_state, |
if (exception) |
return ScriptPromise::RejectWithDOMException(script_state, exception); |
+ // https://w3c.github.io/web-nfc/#dom-nfc-push |
+ // 9. If timeout value is NaN or negative, reject promise with "TypeError" |
+ // and abort these steps. |
+ if (options.hasTimeout() && |
+ (std::isnan(options.timeout()) || options.timeout() < 0)) { |
+ return ScriptPromise::Reject( |
+ script_state, |
+ V8ThrowException::CreateTypeError( |
+ script_state->GetIsolate(), |
+ "Invalid NFCPushOptions.timeout value was provided.")); |
+ } |
+ |
device::nfc::mojom::blink::NFCMessagePtr message = |
device::nfc::mojom::blink::NFCMessage::From(push_message); |
if (!message) |