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

Side by Side Diff: Source/bindings/v8/custom/V8DocumentCustom.cpp

Issue 68563003: Create DOM exceptions in the correct context. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased onto df9a982fbe97 Created 7 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. 2 * Copyright (C) 2007-2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 #include "core/xml/DocumentXPathEvaluator.h" 53 #include "core/xml/DocumentXPathEvaluator.h"
54 #include "core/xml/XPathNSResolver.h" 54 #include "core/xml/XPathNSResolver.h"
55 #include "core/xml/XPathResult.h" 55 #include "core/xml/XPathResult.h"
56 #include "wtf/RefPtr.h" 56 #include "wtf/RefPtr.h"
57 57
58 namespace WebCore { 58 namespace WebCore {
59 59
60 void V8Document::evaluateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) 60 void V8Document::evaluateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
61 { 61 {
62 RefPtr<Document> document = V8Document::toNative(info.Holder()); 62 RefPtr<Document> document = V8Document::toNative(info.Holder());
63 ExceptionState exceptionState(info.GetIsolate()); 63 ExceptionState exceptionState(info.Holder(), info.GetIsolate());
64 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, expression, info[0] ); 64 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, expression, info[0] );
65 RefPtr<Node> contextNode; 65 RefPtr<Node> contextNode;
66 if (V8Node::hasInstance(info[1], info.GetIsolate(), worldType(info.GetIsolat e()))) 66 if (V8Node::hasInstance(info[1], info.GetIsolate(), worldType(info.GetIsolat e())))
67 contextNode = V8Node::toNative(v8::Handle<v8::Object>::Cast(info[1])); 67 contextNode = V8Node::toNative(v8::Handle<v8::Object>::Cast(info[1]));
68 68
69 RefPtr<XPathNSResolver> resolver = toXPathNSResolver(info[2], info.GetIsolat e()); 69 RefPtr<XPathNSResolver> resolver = toXPathNSResolver(info[2], info.GetIsolat e());
70 if (!resolver && !info[2]->IsNull() && !info[2]->IsUndefined()) { 70 if (!resolver && !info[2]->IsNull() && !info[2]->IsUndefined()) {
71 setDOMException(TypeMismatchError, info.GetIsolate()); 71 setDOMException(TypeMismatchError, info.GetIsolate());
72 return; 72 return;
73 } 73 }
74 74
75 int type = toInt32(info[3]); 75 int type = toInt32(info[3]);
76 RefPtr<XPathResult> inResult; 76 RefPtr<XPathResult> inResult;
77 if (V8XPathResult::hasInstance(info[4], info.GetIsolate(), worldType(info.Ge tIsolate()))) 77 if (V8XPathResult::hasInstance(info[4], info.GetIsolate(), worldType(info.Ge tIsolate())))
78 inResult = V8XPathResult::toNative(v8::Handle<v8::Object>::Cast(info[4]) ); 78 inResult = V8XPathResult::toNative(v8::Handle<v8::Object>::Cast(info[4]) );
79 79
80 V8TRYCATCH_VOID(RefPtr<XPathResult>, result, DocumentXPathEvaluator::evaluat e(document.get(), expression, contextNode.get(), resolver.get(), type, inResult. get(), exceptionState)); 80 V8TRYCATCH_VOID(RefPtr<XPathResult>, result, DocumentXPathEvaluator::evaluat e(document.get(), expression, contextNode.get(), resolver.get(), type, inResult. get(), exceptionState));
81 if (exceptionState.throwIfNeeded()) 81 if (exceptionState.throwIfNeeded())
82 return; 82 return;
83 83
84 v8SetReturnValueFast(info, result.release(), document.get()); 84 v8SetReturnValueFast(info, result.release(), document.get());
85 } 85 }
86 86
87 } // namespace WebCore 87 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698