Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: Source/bindings/v8/custom/V8DocumentCustom.cpp

Issue 111533002: Have document.evaluate() report TypeError over incorrect resolvers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: The detail argument is no longer optional. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/v8/ExceptionMessages.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8DocumentCustom.cpp
diff --git a/Source/bindings/v8/custom/V8DocumentCustom.cpp b/Source/bindings/v8/custom/V8DocumentCustom.cpp
index 2dfb0f183d3ad52b63276180f162311410bb900d..94ed248cb90c1d000dc7bc1254b04575a19a8d0c 100644
--- a/Source/bindings/v8/custom/V8DocumentCustom.cpp
+++ b/Source/bindings/v8/custom/V8DocumentCustom.cpp
@@ -39,6 +39,7 @@
#include "V8WebGLRenderingContext.h"
#include "V8XPathNSResolver.h"
#include "V8XPathResult.h"
+#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/ScriptController.h"
#include "bindings/v8/V8Binding.h"
@@ -66,9 +67,11 @@ void V8Document::evaluateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>&
if (V8Node::hasInstance(info[1], info.GetIsolate(), worldType(info.GetIsolate())))
contextNode = V8Node::toNative(v8::Handle<v8::Object>::Cast(info[1]));
- RefPtr<XPathNSResolver> resolver = toXPathNSResolver(info[2], info.GetIsolate());
- if (!resolver && !info[2]->IsNull() && !info[2]->IsUndefined()) {
- setDOMException(TypeMismatchError, info.GetIsolate());
+ const int resolverArgumentIndex = 2;
+ RefPtr<XPathNSResolver> resolver = toXPathNSResolver(info[resolverArgumentIndex], info.GetIsolate());
+ if (!resolver && !isUndefinedOrNull(info[resolverArgumentIndex])) {
+ exceptionState.throwTypeError(ExceptionMessages::incorrectArgumentType(resolverArgumentIndex + 1, "is not a resolver function."));
+ exceptionState.throwIfNeeded();
return;
}
« no previous file with comments | « Source/bindings/v8/ExceptionMessages.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698