Title: [200087] trunk/Source/WebCore
Revision
200087
Author
[email protected]
Date
2016-04-26 09:07:57 -0700 (Tue, 26 Apr 2016)

Log Message

[Web IDL] Specify default values for optional parameters of type 'long' / 'unrestricted double'
https://bugs.webkit.org/show_bug.cgi?id=157012

Reviewed by Darin Adler.

Specify default values for optional parameters of type 'long' / 'unrestricted double'
and let the bindings generator use WTF::Optional<> for the ones that do not have a
default value.

* Modules/mediastream/RTCDTMFSender.cpp:
(WebCore::RTCDTMFSender::insertDTMF):
(WebCore::RTCDTMFSender::didPlayTone): Deleted.
* Modules/mediastream/RTCDTMFSender.h:
* Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::start):
(WebCore::AudioBufferSourceNode::startPlaying): Deleted.
* Modules/webaudio/AudioBufferSourceNode.h:
* Modules/webaudio/AudioBufferSourceNode.idl:
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::createDelay): Deleted.
* Modules/webaudio/AudioContext.h:
* Modules/webaudio/AudioContext.idl:
* Modules/webaudio/AudioScheduledSourceNode.cpp:
(WebCore::AudioScheduledSourceNode::start): Deleted.
(WebCore::AudioScheduledSourceNode::stop): Deleted.
* Modules/webaudio/AudioScheduledSourceNode.h:
* Modules/webaudio/OscillatorNode.idl:
* bindings/scripts/CodeGeneratorJS.pm:
(CanUseWTFOptionalForParameter): Deleted.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
(WebCore::jsTestObjConstructorFunctionClassMethodWithOptional):
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue): Deleted.
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalString): Deleted.
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod4): Deleted.
(WebCore::jsTestObjConstructorFunctionClassMethod2): Deleted.
(WebCore::jsTestObjConstructorFunctionOverloadedMethod1): Deleted.
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise): Deleted.
* html/HTMLInputElement.idl:
* page/WindowTimers.idl:
* testing/Internals.h:
* testing/Internals.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (200086 => 200087)


--- trunk/Source/WebCore/ChangeLog	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/ChangeLog	2016-04-26 16:07:57 UTC (rev 200087)
@@ -1,3 +1,53 @@
+2016-04-26  Chris Dumez  <[email protected]>
+
+        [Web IDL] Specify default values for optional parameters of type 'long' / 'unrestricted double'
+        https://bugs.webkit.org/show_bug.cgi?id=157012
+
+        Reviewed by Darin Adler.
+
+        Specify default values for optional parameters of type 'long' / 'unrestricted double'
+        and let the bindings generator use WTF::Optional<> for the ones that do not have a
+        default value.
+
+        * Modules/mediastream/RTCDTMFSender.cpp:
+        (WebCore::RTCDTMFSender::insertDTMF):
+        (WebCore::RTCDTMFSender::didPlayTone): Deleted.
+        * Modules/mediastream/RTCDTMFSender.h:
+        * Modules/webaudio/AudioBufferSourceNode.cpp:
+        (WebCore::AudioBufferSourceNode::start):
+        (WebCore::AudioBufferSourceNode::startPlaying): Deleted.
+        * Modules/webaudio/AudioBufferSourceNode.h:
+        * Modules/webaudio/AudioBufferSourceNode.idl:
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::createDelay): Deleted.
+        * Modules/webaudio/AudioContext.h:
+        * Modules/webaudio/AudioContext.idl:
+        * Modules/webaudio/AudioScheduledSourceNode.cpp:
+        (WebCore::AudioScheduledSourceNode::start): Deleted.
+        (WebCore::AudioScheduledSourceNode::stop): Deleted.
+        * Modules/webaudio/AudioScheduledSourceNode.h:
+        * Modules/webaudio/OscillatorNode.idl:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (CanUseWTFOptionalForParameter): Deleted.
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter2):
+        (WebCore::jsTestObjConstructorFunctionClassMethodWithOptional):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
+        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArgAndDefaultValue): Deleted.
+        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalString): Deleted.
+        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4): Deleted.
+        (WebCore::jsTestObjConstructorFunctionClassMethod2): Deleted.
+        (WebCore::jsTestObjConstructorFunctionOverloadedMethod1): Deleted.
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise): Deleted.
+        * html/HTMLInputElement.idl:
+        * page/WindowTimers.idl:
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2016-04-26  Youenn Fablet  <[email protected]>
 
         Drop [UsePointersEvenForNonNullableObjectArguments] from SpeechSynthesis

Modified: trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp (200086 => 200087)


--- trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.cpp	2016-04-26 16:07:57 UTC (rev 200087)
@@ -89,35 +89,25 @@
     return m_handler->currentToneBuffer();
 }
 
-void RTCDTMFSender::insertDTMF(const String& tones, ExceptionCode& ec)
+void RTCDTMFSender::insertDTMF(const String& tones, Optional<int> duration, Optional<int> interToneGap, ExceptionCode& ec)
 {
-    insertDTMF(tones, defaultToneDurationMs, defaultInterToneGapMs, ec);
-}
-
-void RTCDTMFSender::insertDTMF(const String& tones, long duration, ExceptionCode& ec)
-{
-    insertDTMF(tones, duration, defaultInterToneGapMs, ec);
-}
-
-void RTCDTMFSender::insertDTMF(const String& tones, long duration, long interToneGap, ExceptionCode& ec)
-{
     if (!canInsertDTMF()) {
         ec = NOT_SUPPORTED_ERR;
         return;
     }
 
-    if (duration > maxToneDurationMs || duration < minToneDurationMs) {
+    if (duration && (duration.value() > maxToneDurationMs || duration.value() < minToneDurationMs)) {
         ec = SYNTAX_ERR;
         return;
     }
 
-    if (interToneGap < minInterToneGapMs) {
+    if (interToneGap && interToneGap.value() < minInterToneGapMs) {
         ec = SYNTAX_ERR;
         return;
     }
 
-    m_duration = duration;
-    m_interToneGap = interToneGap;
+    m_duration = duration.valueOr(defaultToneDurationMs);
+    m_interToneGap = interToneGap.valueOr(defaultInterToneGapMs);
 
     if (!m_handler->insertDTMF(tones, m_duration, m_interToneGap))
         ec = SYNTAX_ERR;

Modified: trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.h (200086 => 200087)


--- trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.h	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/Modules/mediastream/RTCDTMFSender.h	2016-04-26 16:07:57 UTC (rev 200087)
@@ -52,9 +52,7 @@
     long duration() const { return m_duration; }
     long interToneGap() const { return m_interToneGap; }
 
-    void insertDTMF(const String& tones, ExceptionCode&);
-    void insertDTMF(const String& tones, long duration, ExceptionCode&);
-    void insertDTMF(const String& tones, long duration, long interToneGap, ExceptionCode&);
+    void insertDTMF(const String& tones, Optional<int> duration, Optional<int> interToneGap, ExceptionCode&);
 
     // EventTarget
     EventTargetInterface eventTargetInterface() const override { return RTCDTMFSenderEventTargetInterfaceType; }

Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp (200086 => 200087)


--- trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp	2016-04-26 16:07:57 UTC (rev 200087)
@@ -441,23 +441,14 @@
     return output(0)->numberOfChannels();
 }
 
-void AudioBufferSourceNode::start(ExceptionCode& ec)
+void AudioBufferSourceNode::start(double when, double grainOffset, Optional<double> optionalGrainDuration, ExceptionCode& ec)
 {
-    startPlaying(Entire, 0, 0, buffer() ? buffer()->duration() : 0, ec);
-}
+    double grainDuration = 0;
+    if (optionalGrainDuration)
+        grainDuration = optionalGrainDuration.value();
+    else if (buffer())
+        grainDuration = buffer()->duration() - grainOffset;
 
-void AudioBufferSourceNode::start(double when, ExceptionCode& ec)
-{
-    startPlaying(Entire, when, 0, buffer() ? buffer()->duration() : 0, ec);
-}
-
-void AudioBufferSourceNode::start(double when, double grainOffset, ExceptionCode& ec)
-{
-    startPlaying(Partial, when, grainOffset, buffer() ? buffer()->duration() - grainOffset : 0, ec);
-}
-
-void AudioBufferSourceNode::start(double when, double grainOffset, double grainDuration, ExceptionCode& ec)
-{
     startPlaying(Partial, when, grainOffset, grainDuration, ec);
 }
 

Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h (200086 => 200087)


--- trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.h	2016-04-26 16:07:57 UTC (rev 200087)
@@ -63,10 +63,7 @@
     unsigned numberOfChannels();
 
     // Play-state
-    void start(ExceptionCode&);
-    void start(double when, ExceptionCode&);
-    void start(double when, double grainOffset, ExceptionCode&);
-    void start(double when, double grainOffset, double grainDuration, ExceptionCode&);
+    void start(double when, double grainOffset, Optional<double> grainDuration, ExceptionCode&);
 
 #if ENABLE(LEGACY_WEB_AUDIO)
     void noteGrainOn(double when, double grainOffset, double grainDuration, ExceptionCode&);

Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl (200086 => 200087)


--- trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.idl	2016-04-26 16:07:57 UTC (rev 200087)
@@ -44,8 +44,8 @@
     attribute unrestricted double loopStart;
     attribute unrestricted double loopEnd;
 
-    [RaisesException] void start(optional unrestricted double when, optional unrestricted double grainOffset, optional unrestricted double grainDuration);
-    [RaisesException] void stop(optional unrestricted double when);
+    [RaisesException] void start(optional unrestricted double when = 0, optional unrestricted double grainOffset = 0, optional unrestricted double grainDuration);
+    [RaisesException] void stop(optional unrestricted double when = 0);
 
     [Conditional=LEGACY_WEB_AUDIO] attribute boolean looping; // This is an alias for the .loop attribute for backwards compatibility.
 

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (200086 => 200087)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2016-04-26 16:07:57 UTC (rev 200087)
@@ -557,12 +557,6 @@
     return GainNode::create(*this, m_destinationNode->sampleRate());
 }
 
-RefPtr<DelayNode> AudioContext::createDelay(ExceptionCode& ec)
-{
-    const double defaultMaxDelayTime = 1;
-    return createDelay(defaultMaxDelayTime, ec);
-}
-
 RefPtr<DelayNode> AudioContext::createDelay(double maxDelayTime, ExceptionCode& ec)
 {
     ASSERT(isMainThread());

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.h (200086 => 200087)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.h	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.h	2016-04-26 16:07:57 UTC (rev 200087)
@@ -132,7 +132,6 @@
     Ref<GainNode> createGain();
     Ref<BiquadFilterNode> createBiquadFilter();
     Ref<WaveShaperNode> createWaveShaper();
-    RefPtr<DelayNode> createDelay(ExceptionCode&);
     RefPtr<DelayNode> createDelay(double maxDelayTime, ExceptionCode&);
     Ref<PannerNode> createPanner();
     Ref<ConvolverNode> createConvolver();

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.idl (200086 => 200087)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.idl	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.idl	2016-04-26 16:07:57 UTC (rev 200087)
@@ -77,7 +77,7 @@
 
     // Processing nodes
     GainNode createGain();
-    [RaisesException] DelayNode createDelay(optional unrestricted double maxDelayTime);
+    [RaisesException] DelayNode createDelay(optional unrestricted double maxDelayTime = 1);
     BiquadFilterNode createBiquadFilter();
     WaveShaperNode createWaveShaper();
     PannerNode createPanner();
@@ -98,7 +98,7 @@
     void startRendering();
 
     [Conditional=LEGACY_WEB_AUDIO, ImplementedAs=createGain] GainNode createGainNode();
-    [Conditional=LEGACY_WEB_AUDIO, ImplementedAs=createDelay, RaisesException] DelayNode createDelayNode(optional unrestricted double maxDelayTime);
+    [Conditional=LEGACY_WEB_AUDIO, ImplementedAs=createDelay, RaisesException] DelayNode createDelayNode(optional unrestricted double maxDelayTime = 1);
 
     [Conditional=LEGACY_WEB_AUDIO, ImplementedAs=createScriptProcessor, RaisesException] ScriptProcessorNode createJavaScriptNode(unsigned long bufferSize, optional unsigned long numberOfInputChannels, optional unsigned long numberOfOutputChannels);
 

Modified: trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp (200086 => 200087)


--- trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.cpp	2016-04-26 16:07:57 UTC (rev 200087)
@@ -137,11 +137,6 @@
     return;
 }
 
-void AudioScheduledSourceNode::start(ExceptionCode& ec)
-{
-    start(0, ec);
-}
-
 void AudioScheduledSourceNode::start(double when, ExceptionCode& ec)
 {
     ASSERT(isMainThread());
@@ -162,11 +157,6 @@
     m_playbackState = SCHEDULED_STATE;
 }
 
-void AudioScheduledSourceNode::stop(ExceptionCode& ec)
-{
-    stop(0, ec);
-}
-
 void AudioScheduledSourceNode::stop(double when, ExceptionCode& ec)
 {
     ASSERT(isMainThread());

Modified: trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h (200086 => 200087)


--- trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/Modules/webaudio/AudioScheduledSourceNode.h	2016-04-26 16:07:57 UTC (rev 200087)
@@ -58,8 +58,6 @@
     AudioScheduledSourceNode(AudioContext&, float sampleRate);
 
     // Scheduling.
-    void start(ExceptionCode&);
-    void stop(ExceptionCode&);
     void start(double when, ExceptionCode&);
     void stop(double when, ExceptionCode&);
 

Modified: trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl (200086 => 200087)


--- trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/Modules/webaudio/OscillatorNode.idl	2016-04-26 16:07:57 UTC (rev 200087)
@@ -48,8 +48,8 @@
     readonly attribute AudioParam frequency; // in Hertz
     readonly attribute AudioParam detune; // in Cents
 
-    [RaisesException] void start(optional unrestricted double when);
-    [RaisesException] void stop(optional unrestricted double when);
+    [RaisesException] void start(optional unrestricted double when = 0);
+    [RaisesException] void stop(optional unrestricted double when = 0);
 
     [Conditional=LEGACY_WEB_AUDIO, RaisesException] void noteOn(unrestricted double when);
     [Conditional=LEGACY_WEB_AUDIO, RaisesException] void noteOff(unrestricted double when);

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200086 => 200087)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-04-26 16:07:57 UTC (rev 200087)
@@ -3386,8 +3386,6 @@
     return 0 if $type eq "DOMString";
     return 0 if $type eq "Dictionary";
     return 0 if $type eq "any";
-    return 0 if $type eq "long";
-    return 0 if $type eq "unrestricted double";
     return 0 if $type eq "unsigned long";
 
     return 1;

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (200086 => 200087)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2016-04-26 16:07:57 UTC (rev 200087)
@@ -3987,14 +3987,7 @@
         return throwThisTypeError(*state, "TestObj", "methodWithOptionalArg");
     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
     auto& impl = castedThis->wrapped();
-
-    size_t argsCount = state->argumentCount();
-    if (argsCount <= 0) {
-        impl.methodWithOptionalArg();
-        return JSValue::encode(jsUndefined());
-    }
-
-    int opt = toInt32(state, state->argument(0), NormalConversion);
+    Optional<int> opt = state->argument(0).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(0), NormalConversion);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     impl.methodWithOptionalArg(opt);
@@ -4029,14 +4022,7 @@
     int nonOpt = toInt32(state, state->argument(0), NormalConversion);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
-
-    size_t argsCount = state->argumentCount();
-    if (argsCount <= 1) {
-        impl.methodWithNonOptionalArgAndOptionalArg(nonOpt);
-        return JSValue::encode(jsUndefined());
-    }
-
-    int opt = toInt32(state, state->argument(1), NormalConversion);
+    Optional<int> opt = state->argument(1).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(1), NormalConversion);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     impl.methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
@@ -4056,22 +4042,10 @@
     int nonOpt = toInt32(state, state->argument(0), NormalConversion);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
-
-    size_t argsCount = state->argumentCount();
-    if (argsCount <= 1) {
-        impl.methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
-        return JSValue::encode(jsUndefined());
-    }
-
-    int opt1 = toInt32(state, state->argument(1), NormalConversion);
+    Optional<int> opt1 = state->argument(1).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(1), NormalConversion);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
-    if (argsCount <= 2) {
-        impl.methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1);
-        return JSValue::encode(jsUndefined());
-    }
-
-    int opt2 = toInt32(state, state->argument(2), NormalConversion);
+    Optional<int> opt2 = state->argument(2).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(2), NormalConversion);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     impl.methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
@@ -4588,14 +4562,7 @@
     TestObj* objArg = JSTestObj::toWrapped(state->argument(0));
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
-
-    size_t argsCount = state->argumentCount();
-    if (argsCount <= 1) {
-        impl.overloadedMethod(objArg);
-        return JSValue::encode(jsUndefined());
-    }
-
-    int longArg = toInt32(state, state->argument(1), NormalConversion);
+    Optional<int> longArg = state->argument(1).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(1), NormalConversion);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     impl.overloadedMethod(objArg, longArg);
@@ -4849,14 +4816,7 @@
     TestObj* objArg = JSTestObj::toWrapped(state->argument(0));
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
-
-    size_t argsCount = state->argumentCount();
-    if (argsCount <= 1) {
-        impl.overloadedMethodWithOptionalParameter(objArg);
-        return JSValue::encode(jsUndefined());
-    }
-
-    int longArg = toInt32(state, state->argument(1), NormalConversion);
+    Optional<int> longArg = state->argument(1).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(1), NormalConversion);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     impl.overloadedMethodWithOptionalParameter(objArg, longArg);
@@ -4885,14 +4845,7 @@
 
 EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionClassMethodWithOptional(ExecState* state)
 {
-
-    size_t argsCount = state->argumentCount();
-    if (argsCount <= 0) {
-        JSValue result = jsNumber(TestObj::classMethodWithOptional());
-        return JSValue::encode(result);
-    }
-
-    int arg = toInt32(state, state->argument(0), NormalConversion);
+    Optional<int> arg = state->argument(0).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(0), NormalConversion);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     JSValue result = jsNumber(TestObj::classMethodWithOptional(arg));
@@ -5445,14 +5398,7 @@
         return throwThisTypeError(*state, "TestObj", "testPromiseFunctionWithOptionalIntArgument");
     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
     auto& impl = castedThis->wrapped();
-
-    size_t argsCount = state->argumentCount();
-    if (argsCount <= 0) {
-        impl.testPromiseFunctionWithOptionalIntArgument(DeferredWrapper(state, castedThis->globalObject(), promiseDeferred));
-        return JSValue::encode(jsUndefined());
-    }
-
-    int a = toInt32(state, state->argument(0), NormalConversion);
+    Optional<int> a = state->argument(0).isUndefined() ? Optional<int>() : toInt32(state, state->uncheckedArgument(0), NormalConversion);
     if (UNLIKELY(state->hadException()))
         return JSValue::encode(jsUndefined());
     impl.testPromiseFunctionWithOptionalIntArgument(a, DeferredWrapper(state, castedThis->globalObject(), promiseDeferred));

Modified: trunk/Source/WebCore/page/WindowTimers.idl (200086 => 200087)


--- trunk/Source/WebCore/page/WindowTimers.idl	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/page/WindowTimers.idl	2016-04-26 16:07:57 UTC (rev 200087)
@@ -28,9 +28,9 @@
 [
     NoInterfaceObject,
 ] interface WindowTimers {
-    [Custom] long setTimeout(any handler, optional long timeout);
+    [Custom] long setTimeout(any handler, optional long timeout = 0);
     void clearTimeout(optional long handle = 0);
-    [Custom] long setInterval(any handler, optional long timeout);
+    [Custom] long setInterval(any handler, optional long timeout = 0);
     void clearInterval(optional long handle = 0);
 };
 

Modified: trunk/Source/WebCore/testing/Internals.h (200086 => 200087)


--- trunk/Source/WebCore/testing/Internals.h	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/testing/Internals.h	2016-04-26 16:07:57 UTC (rev 200087)
@@ -161,7 +161,6 @@
     void setScrollViewPosition(int x, int y, ExceptionCode&);
     void setViewBaseBackgroundColor(const String& colorValue, ExceptionCode&);
 
-    void setPagination(const String& mode, int gap, ExceptionCode& ec) { setPagination(mode, gap, 0, ec); }
     void setPagination(const String& mode, int gap, int pageLength, ExceptionCode&);
     void setPaginationLineGridEnabled(bool, ExceptionCode&);
     String configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&);

Modified: trunk/Source/WebCore/testing/Internals.idl (200086 => 200087)


--- trunk/Source/WebCore/testing/Internals.idl	2016-04-26 15:03:37 UTC (rev 200086)
+++ trunk/Source/WebCore/testing/Internals.idl	2016-04-26 16:07:57 UTC (rev 200087)
@@ -144,7 +144,7 @@
 
     [RaisesException] void setViewBaseBackgroundColor(DOMString colorValue);
 
-    [RaisesException] void setPagination(DOMString mode, long gap, optional long pageLength);
+    [RaisesException] void setPagination(DOMString mode, long gap, optional long pageLength = 0);
     [RaisesException] void setPaginationLineGridEnabled(boolean enabled);
 
     [RaisesException] DOMString configurationForViewport(unrestricted float devicePixelRatio,
@@ -273,7 +273,7 @@
     DOMString counterValue(Element element);
     long pageNumber(Element element, optional unrestricted float pageWidth = 800, optional unrestricted float pageHeight = 600);
     DOMString[] shortcutIconURLs();
-    long numberOfPages(optional unrestricted double pageWidthInPixels, optional unrestricted double pageHeightInPixels);
+    long numberOfPages(optional unrestricted double pageWidthInPixels = 800, optional unrestricted double pageHeightInPixels = 600);
     [RaisesException] DOMString pageProperty(DOMString propertyName, long pageNumber);
     [RaisesException] DOMString pageSizeAndMarginsInPixels(long pageIndex, long width, long height, long marginTop, long marginRight, long marginBottom, long marginLeft);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to