Title: [118063] trunk/Source/WebCore
Revision
118063
Author
[email protected]
Date
2012-05-22 15:22:24 -0700 (Tue, 22 May 2012)

Log Message

[V8] Replace 'setDOMException(); return Undefined();' with 'return setDOMException();'
https://bugs.webkit.org/show_bug.cgi?id=87102

Reviewed by Adam Barth.

This patch replaces

    setDOMException();
    return v8::Undefined();

with

    return setDOMException();

In addition, just in case, this patch replaces

    if (...)
        setDOMException();
    return v8::Undefined();

with

    if (...)
        return setDOMException();
    return v8::Undefined();

because people might insert some code just above
'return v8::Undefined()' in the future.

No tests. No change in behavior.

* bindings/v8/custom/V8ArrayBufferViewCustom.h:
(WebCore::constructWebGLArrayWithArrayBufferArgument):
(WebCore::setWebGLArrayHelper):
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::WindowSetTimeoutImpl):
* bindings/v8/custom/V8DataViewCustom.cpp:
(WebCore::V8DataView::getInt8Callback):
(WebCore::V8DataView::getUint8Callback):
(WebCore::V8DataView::setInt8Callback):
(WebCore::V8DataView::setUint8Callback):
* bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp:
(WebCore::V8DirectoryEntrySync::getDirectoryCallback):
(WebCore::V8DirectoryEntrySync::getFileCallback):
* bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
(WebCore::V8HTMLOptionsCollection::addCallback):
* bindings/v8/custom/V8NodeCustom.cpp:
(WebCore::V8Node::insertBeforeCallback):
(WebCore::V8Node::replaceChildCallback):
(WebCore::V8Node::removeChildCallback):
(WebCore::V8Node::appendChildCallback):
* bindings/v8/custom/V8SVGLengthCustom.cpp:
(WebCore::V8SVGLength::valueAccessorGetter):
(WebCore::V8SVGLength::convertToSpecifiedUnitsCallback):
* bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
(WebCore::getObjectParameter):
(WebCore::V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback):
(WebCore::V8WebGLRenderingContext::getParameterCallback):
(WebCore::V8WebGLRenderingContext::getProgramParameterCallback):
(WebCore::V8WebGLRenderingContext::getShaderParameterCallback):
(WebCore::V8WebGLRenderingContext::getUniformCallback):
(WebCore::vertexAttribAndUniformHelperf):
(WebCore::uniformHelperi):
(WebCore::uniformMatrixHelper):
* bindings/v8/custom/V8WebKitMutationObserverCustom.cpp:
(WebCore::V8WebKitMutationObserver::observeCallback):
* bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
(WebCore::V8XMLHttpRequest::responseAccessorGetter):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (118062 => 118063)


--- trunk/Source/WebCore/ChangeLog	2012-05-22 22:11:12 UTC (rev 118062)
+++ trunk/Source/WebCore/ChangeLog	2012-05-22 22:22:24 UTC (rev 118063)
@@ -1,3 +1,74 @@
+2012-05-22  Kentaro Hara  <[email protected]>
+
+        [V8] Replace 'setDOMException(); return Undefined();' with 'return setDOMException();'
+        https://bugs.webkit.org/show_bug.cgi?id=87102
+
+        Reviewed by Adam Barth.
+
+        This patch replaces
+
+            setDOMException();
+            return v8::Undefined();
+
+        with
+
+            return setDOMException();
+
+        In addition, just in case, this patch replaces
+
+            if (...)
+                setDOMException();
+            return v8::Undefined();
+
+        with
+
+            if (...)
+                return setDOMException();
+            return v8::Undefined();
+
+        because people might insert some code just above
+        'return v8::Undefined()' in the future.
+
+        No tests. No change in behavior.
+
+        * bindings/v8/custom/V8ArrayBufferViewCustom.h:
+        (WebCore::constructWebGLArrayWithArrayBufferArgument):
+        (WebCore::setWebGLArrayHelper):
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        (WebCore::WindowSetTimeoutImpl):
+        * bindings/v8/custom/V8DataViewCustom.cpp:
+        (WebCore::V8DataView::getInt8Callback):
+        (WebCore::V8DataView::getUint8Callback):
+        (WebCore::V8DataView::setInt8Callback):
+        (WebCore::V8DataView::setUint8Callback):
+        * bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp:
+        (WebCore::V8DirectoryEntrySync::getDirectoryCallback):
+        (WebCore::V8DirectoryEntrySync::getFileCallback):
+        * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp:
+        (WebCore::V8HTMLOptionsCollection::addCallback):
+        * bindings/v8/custom/V8NodeCustom.cpp:
+        (WebCore::V8Node::insertBeforeCallback):
+        (WebCore::V8Node::replaceChildCallback):
+        (WebCore::V8Node::removeChildCallback):
+        (WebCore::V8Node::appendChildCallback):
+        * bindings/v8/custom/V8SVGLengthCustom.cpp:
+        (WebCore::V8SVGLength::valueAccessorGetter):
+        (WebCore::V8SVGLength::convertToSpecifiedUnitsCallback):
+        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
+        (WebCore::getObjectParameter):
+        (WebCore::V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback):
+        (WebCore::V8WebGLRenderingContext::getParameterCallback):
+        (WebCore::V8WebGLRenderingContext::getProgramParameterCallback):
+        (WebCore::V8WebGLRenderingContext::getShaderParameterCallback):
+        (WebCore::V8WebGLRenderingContext::getUniformCallback):
+        (WebCore::vertexAttribAndUniformHelperf):
+        (WebCore::uniformHelperi):
+        (WebCore::uniformMatrixHelper):
+        * bindings/v8/custom/V8WebKitMutationObserverCustom.cpp:
+        (WebCore::V8WebKitMutationObserver::observeCallback):
+        * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+        (WebCore::V8XMLHttpRequest::responseAccessorGetter):
+
 2012-05-22  Martin Robinson  <[email protected]>
 
         [TextureMapper] [Cairo] Implement repaint counters

Modified: trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h (118062 => 118063)


--- trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h	2012-05-22 22:11:12 UTC (rev 118062)
+++ trunk/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h	2012-05-22 22:22:24 UTC (rev 118063)
@@ -80,10 +80,8 @@
         length = (buf->byteLength() - offset) / sizeof(ElementType);
     }
     RefPtr<ArrayClass> array = ArrayClass::create(buf, offset, length);
-    if (!array) {
-        V8Proxy::setDOMException(INDEX_SIZE_ERR, args.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (!array)
+        return V8Proxy::setDOMException(INDEX_SIZE_ERR, args.GetIsolate());
     // Transform the holder into a wrapper object for the array.
     V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get());
     if (hasIndexer)
@@ -187,10 +185,8 @@
 template <class CPlusPlusArrayType, class _javascript_WrapperArrayType>
 v8::Handle<v8::Value> setWebGLArrayHelper(const v8::Arguments& args)
 {
-    if (args.Length() < 1) {
-        V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (args.Length() < 1)
+        return V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
 
     CPlusPlusArrayType* impl = _javascript_WrapperArrayType::toNative(args.Holder());
 
@@ -201,7 +197,7 @@
         if (args.Length() == 2)
             offset = toUInt32(args[1]);
         if (!impl->set(src, offset))
-            V8Proxy::setDOMException(INDEX_SIZE_ERR, args.GetIsolate());
+            return V8Proxy::setDOMException(INDEX_SIZE_ERR, args.GetIsolate());
         return v8::Undefined();
     }
 
@@ -214,23 +210,22 @@
         uint32_t length = toUInt32(array->Get(v8::String::New("length")));
         if (offset > impl->length()
             || offset + length > impl->length()
-            || offset + length < offset)
+            || offset + length < offset) {
             // Out of range offset or overflow
-            V8Proxy::setDOMException(INDEX_SIZE_ERR, args.GetIsolate());
-        else {
-            if (!fastSetInstalled(args.Holder())) {
-                installFastSet(args.Holder());
-                copyElements(args.Holder(), array, offset);
-            } else {
-                for (uint32_t i = 0; i < length; i++)
-                    impl->set(offset + i, array->Get(i)->NumberValue());
-            }
+            return V8Proxy::setDOMException(INDEX_SIZE_ERR, args.GetIsolate());
         }
+
+        if (!fastSetInstalled(args.Holder())) {
+            installFastSet(args.Holder());
+            copyElements(args.Holder(), array, offset);
+        } else {
+            for (uint32_t i = 0; i < length; i++)
+                impl->set(offset + i, array->Get(i)->NumberValue());
+        }
         return v8::Undefined();
     }
 
-    V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
-    return v8::Handle<v8::Value>();
+    return V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
 }
 
 }

Modified: trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp (118062 => 118063)


--- trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp	2012-05-22 22:11:12 UTC (rev 118062)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp	2012-05-22 22:22:24 UTC (rev 118063)
@@ -79,10 +79,8 @@
     DOMWindow* imp = V8DOMWindow::toNative(args.Holder());
     ScriptExecutionContext* scriptContext = static_cast<ScriptExecutionContext*>(imp->document());
 
-    if (!scriptContext) {
-        V8Proxy::setDOMException(INVALID_ACCESS_ERR, args.GetIsolate());
-        return v8::Undefined();
-    }
+    if (!scriptContext)
+        return V8Proxy::setDOMException(INVALID_ACCESS_ERR, args.GetIsolate());
 
     v8::Handle<v8::Value> function = args[0];
     WTF::String functionString;

Modified: trunk/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp (118062 => 118063)


--- trunk/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp	2012-05-22 22:11:12 UTC (rev 118062)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DataViewCustom.cpp	2012-05-22 22:22:24 UTC (rev 118063)
@@ -74,10 +74,8 @@
     ExceptionCode ec = 0;
     EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
     int8_t result = imp->getInt8(byteOffset, ec);
-    if (UNLIKELY(ec)) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (UNLIKELY(ec))
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return v8::Integer::New(result);
 }
 
@@ -91,10 +89,8 @@
     ExceptionCode ec = 0;
     EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0]));
     uint8_t result = imp->getUint8(byteOffset, ec);
-    if (UNLIKELY(ec)) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (UNLIKELY(ec))
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return v8::Integer::New(result);
 }
 
@@ -110,7 +106,7 @@
     EXCEPTION_BLOCK(int, value, toInt32(args[1]));
     imp->setInt8(byteOffset, static_cast<int8_t>(value), ec);
     if (UNLIKELY(ec))
-        V8Proxy::setDOMException(ec, args.GetIsolate());
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return v8::Handle<v8::Value>();
 }
 
@@ -126,7 +122,7 @@
     EXCEPTION_BLOCK(int, value, toInt32(args[1]));
     imp->setUint8(byteOffset, static_cast<uint8_t>(value), ec);
     if (UNLIKELY(ec))
-        V8Proxy::setDOMException(ec, args.GetIsolate());
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return v8::Handle<v8::Value>();
 }
 

Modified: trunk/Source/WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp (118062 => 118063)


--- trunk/Source/WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp	2012-05-22 22:11:12 UTC (rev 118062)
+++ trunk/Source/WebCore/bindings/v8/custom/V8DirectoryEntrySyncCustom.cpp	2012-05-22 22:22:24 UTC (rev 118063)
@@ -98,15 +98,11 @@
     ExceptionCode ec = 0;
     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, path, args[0]);
     RefPtr<WebKitFlags> flags = getFlags(args[1], ec);
-    if (UNLIKELY(ec)) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (UNLIKELY(ec))
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     RefPtr<DirectoryEntrySync> result = imp->getDirectory(path, flags, ec);
-    if (UNLIKELY(ec)) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (UNLIKELY(ec))
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return toV8(result.release(), args.GetIsolate());
 }
 
@@ -117,15 +113,11 @@
     ExceptionCode ec = 0;
     STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, path, args[0]);
     RefPtr<WebKitFlags> flags = getFlags(args[1], ec);
-    if (UNLIKELY(ec)) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (UNLIKELY(ec))
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     RefPtr<FileEntrySync> result = imp->getFile(path, flags, ec);
-    if (UNLIKELY(ec)) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (UNLIKELY(ec))
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return toV8(result.release(), args.GetIsolate());
 }
 

Modified: trunk/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp (118062 => 118063)


--- trunk/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp	2012-05-22 22:11:12 UTC (rev 118062)
+++ trunk/Source/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp	2012-05-22 22:22:24 UTC (rev 118063)
@@ -55,10 +55,8 @@
 v8::Handle<v8::Value> V8HTMLOptionsCollection::addCallback(const v8::Arguments& args)
 {
     INC_STATS("DOM.HTMLOptionsCollection.add()");
-    if (!V8HTMLOptionElement::HasInstance(args[0])) {
-        V8Proxy::setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
-        return v8::Undefined();
-    }
+    if (!V8HTMLOptionElement::HasInstance(args[0]))
+        return V8Proxy::setDOMException(TYPE_MISMATCH_ERR, args.GetIsolate());
     HTMLOptionsCollection* imp = V8HTMLOptionsCollection::toNative(args.Holder());
     HTMLOptionElement* option = V8HTMLOptionElement::toNative(v8::Handle<v8::Object>(v8::Handle<v8::Object>::Cast(args[0])));
 
@@ -79,8 +77,8 @@
             imp->add(option, index, ec);
     }
 
-    if (ec != 0)
-        V8Proxy::setDOMException(ec, args.GetIsolate());
+    if (ec)
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
 
     return v8::Undefined();
 }

Modified: trunk/Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp (118062 => 118063)


--- trunk/Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp	2012-05-22 22:11:12 UTC (rev 118062)
+++ trunk/Source/WebCore/bindings/v8/custom/V8NodeCustom.cpp	2012-05-22 22:22:24 UTC (rev 118063)
@@ -73,10 +73,8 @@
     Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     Node* refChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
     bool success = imp->insertBefore(newChild, refChild, ec, true);
-    if (ec) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (ec)
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     if (success)
         return args[0];
     return v8::Null();
@@ -92,10 +90,8 @@
     Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     Node* oldChild = V8Node::HasInstance(args[1]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
     bool success = imp->replaceChild(newChild, oldChild, ec, true);
-    if (ec) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (ec)
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     if (success)
         return args[1];
     return v8::Null();
@@ -109,10 +105,8 @@
     ExceptionCode ec = 0;
     Node* oldChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     bool success = imp->removeChild(oldChild, ec);
-    if (ec) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (ec)
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     if (success)
         return args[0];
     return v8::Null();
@@ -127,10 +121,8 @@
     ExceptionCode ec = 0;
     Node* newChild = V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     bool success = imp->appendChild(newChild, ec, true );
-    if (ec) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (ec)
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     if (success)
         return args[0];
     return v8::Null();

Modified: trunk/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp (118062 => 118063)


--- trunk/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp	2012-05-22 22:11:12 UTC (rev 118062)
+++ trunk/Source/WebCore/bindings/v8/custom/V8SVGLengthCustom.cpp	2012-05-22 22:22:24 UTC (rev 118063)
@@ -49,10 +49,8 @@
     ExceptionCode ec = 0;
     SVGLengthContext lengthContext(wrapper->contextElement());
     float value = imp.value(lengthContext, ec);
-    if (UNLIKELY(ec)) {
-        V8Proxy::setDOMException(ec, info.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (UNLIKELY(ec))
+        return V8Proxy::setDOMException(ec, info.GetIsolate());
     return v8::Number::New(value);
 }
 
@@ -84,10 +82,8 @@
 {
     INC_STATS("DOM.SVGLength.convertToSpecifiedUnits");
     SVGPropertyTearOff<SVGLength>* wrapper = V8SVGLength::toNative(args.Holder());
-    if (wrapper->role() == AnimValRole) {
-        V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR, args.GetIsolate());
-        return v8::Handle<v8::Value>();
-    }
+    if (wrapper->role() == AnimValRole)
+        return V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR, args.GetIsolate());
 
     if (args.Length() < 1)
         return V8Proxy::throwNotEnoughArgumentsError(args.GetIsolate());
@@ -98,9 +94,9 @@
     SVGLengthContext lengthContext(wrapper->contextElement());
     imp.convertToSpecifiedUnits(unitType, lengthContext, ec);
     if (UNLIKELY(ec))
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-    else
-        wrapper->commitChange();
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
+
+    wrapper->commitChange();
     return v8::Handle<v8::Value>();
 }
 

Modified: trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp (118062 => 118063)


--- trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp	2012-05-22 22:11:12 UTC (rev 118062)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp	2012-05-22 22:22:24 UTC (rev 118063)
@@ -242,10 +242,8 @@
         notImplemented();
         break;
     }
-    if (ec) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Undefined();
-    }
+    if (ec)
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return toV8Object(info, args.GetIsolate());
 }
 
@@ -320,10 +318,8 @@
     unsigned attachment = toInt32(args[1]);
     unsigned pname = toInt32(args[2]);
     WebGLGetInfo info = context->getFramebufferAttachmentParameter(target, attachment, pname, ec);
-    if (ec) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Undefined();
-    }
+    if (ec)
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return toV8Object(info, args.GetIsolate());
 }
 
@@ -338,10 +334,8 @@
     WebGLRenderingContext* context = V8WebGLRenderingContext::toNative(args.Holder());
     unsigned pname = toInt32(args[0]);
     WebGLGetInfo info = context->getParameter(pname, ec);
-    if (ec) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Undefined();
-    }
+    if (ec)
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return toV8Object(info, args.GetIsolate());
 }
 
@@ -359,10 +353,8 @@
     WebGLProgram* program = V8WebGLProgram::HasInstance(args[0]) ? V8WebGLProgram::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     unsigned pname = toInt32(args[1]);
     WebGLGetInfo info = context->getProgramParameter(program, pname, ec);
-    if (ec) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Undefined();
-    }
+    if (ec)
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return toV8Object(info, args.GetIsolate());
 }
 
@@ -386,10 +378,8 @@
     WebGLShader* shader = V8WebGLShader::HasInstance(args[0]) ? V8WebGLShader::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
     unsigned pname = toInt32(args[1]);
     WebGLGetInfo info = context->getShaderParameter(shader, pname, ec);
-    if (ec) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Undefined();
-    }
+    if (ec)
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return toV8Object(info, args.GetIsolate());
 }
 
@@ -432,10 +422,8 @@
     WebGLUniformLocation* location = toWebGLUniformLocation(args[1], ok);
 
     WebGLGetInfo info = context->getUniform(program, location, ec);
-    if (ec) {
-        V8Proxy::setDOMException(ec, args.GetIsolate());
-        return v8::Undefined();
-    }
+    if (ec)
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return toV8Object(info, args.GetIsolate());
 }
 
@@ -517,7 +505,7 @@
             default: ASSERT_NOT_REACHED(); break;
         }
         if (ec)
-            V8Proxy::setDOMException(ec, args.GetIsolate());
+            return V8Proxy::setDOMException(ec, args.GetIsolate());
         return v8::Undefined();
     }
 
@@ -529,8 +517,7 @@
     float* data = "" len);
     if (!data) {
         // FIXME: consider different / better exception type.
-        V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
-        return v8::Handle<v8::Value>();
+        return V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
     }
     ExceptionCode ec = 0;
     switch (functionToCall) {
@@ -546,7 +533,7 @@
     }
     fastFree(data);
     if (ec)
-        V8Proxy::setDOMException(ec, args.GetIsolate());
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return v8::Undefined();
 }
 
@@ -583,7 +570,7 @@
             default: ASSERT_NOT_REACHED(); break;
         }
         if (ec)
-            V8Proxy::setDOMException(ec, args.GetIsolate());
+            return V8Proxy::setDOMException(ec, args.GetIsolate());
         return v8::Undefined();
     }
 
@@ -595,8 +582,7 @@
     int* data = "" len);
     if (!data) {
         // FIXME: consider different / better exception type.
-        V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
-        return v8::Handle<v8::Value>();
+        return V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
     }
     ExceptionCode ec = 0;
     switch (functionToCall) {
@@ -608,7 +594,7 @@
     }
     fastFree(data);
     if (ec)
-        V8Proxy::setDOMException(ec, args.GetIsolate());
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return v8::Undefined();
 }
 
@@ -694,7 +680,7 @@
             default: ASSERT_NOT_REACHED(); break;
         }
         if (ec)
-            V8Proxy::setDOMException(ec, args.GetIsolate());
+            return V8Proxy::setDOMException(ec, args.GetIsolate());
         return v8::Undefined();
     }
 
@@ -706,8 +692,7 @@
     float* data = "" len);
     if (!data) {
         // FIXME: consider different / better exception type.
-        V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
-        return v8::Handle<v8::Value>();
+        return V8Proxy::setDOMException(SYNTAX_ERR, args.GetIsolate());
     }
     ExceptionCode ec = 0;
     switch (matrixSize) {
@@ -718,7 +703,7 @@
     }
     fastFree(data);
     if (ec)
-        V8Proxy::setDOMException(ec, args.GetIsolate()); 
+        return V8Proxy::setDOMException(ec, args.GetIsolate()); 
     return v8::Undefined();
 }
 

Modified: trunk/Source/WebCore/bindings/v8/custom/V8WebKitMutationObserverCustom.cpp (118062 => 118063)


--- trunk/Source/WebCore/bindings/v8/custom/V8WebKitMutationObserverCustom.cpp	2012-05-22 22:11:12 UTC (rev 118062)
+++ trunk/Source/WebCore/bindings/v8/custom/V8WebKitMutationObserverCustom.cpp	2012-05-22 22:22:24 UTC (rev 118063)
@@ -112,7 +112,7 @@
     ExceptionCode ec = 0;
     imp->observe(target, options, attributeFilter, ec);
     if (ec)
-        V8Proxy::setDOMException(ec, args.GetIsolate());
+        return V8Proxy::setDOMException(ec, args.GetIsolate());
     return v8::Handle<v8::Value>();
 }
 

Modified: trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp (118062 => 118063)


--- trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp	2012-05-22 22:11:12 UTC (rev 118062)
+++ trunk/Source/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp	2012-05-22 22:22:24 UTC (rev 118063)
@@ -74,10 +74,8 @@
         {
             ExceptionCode ec = 0;
             Document* document = xmlHttpRequest->responseXML(ec);
-            if (ec) {
-                V8Proxy::setDOMException(ec, info.GetIsolate());
-                return v8::Undefined();
-            }
+            if (ec)
+                return V8Proxy::setDOMException(ec, info.GetIsolate());
             return toV8(document, info.GetIsolate());
         }
 
@@ -86,10 +84,8 @@
         {
             ExceptionCode ec = 0;
             Blob* blob = xmlHttpRequest->responseBlob(ec);
-            if (ec) {
-                V8Proxy::setDOMException(ec, info.GetIsolate());
-                return v8::Undefined();
-            }
+            if (ec)
+                return V8Proxy::setDOMException(ec, info.GetIsolate());
             return toV8(blob, info.GetIsolate());
         }
 #else
@@ -100,10 +96,8 @@
         {
             ExceptionCode ec = 0;
             ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(ec);
-            if (ec) {
-                V8Proxy::setDOMException(ec, info.GetIsolate());
-                return v8::Undefined();
-            }
+            if (ec)
+                return V8Proxy::setDOMException(ec, info.GetIsolate());
             return toV8(arrayBuffer, info.GetIsolate());
         }
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to