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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/custom/V8IntersectionObserverCustom.cpp

Issue 1740923004: IntersectionObserver: make exceptions match spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Get rid of IntersectionObserver::hasRootMargin Created 4 years, 10 months 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
Index: third_party/WebKit/Source/bindings/core/v8/custom/V8IntersectionObserverCustom.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8IntersectionObserverCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8IntersectionObserverCustom.cpp
index c6bbfce265b1d4c344b28ada36ae9e81e7ac32a7..44e91b46258e11c907af4b410bdc4f94bf9fdb9b 100644
--- a/third_party/WebKit/Source/bindings/core/v8/custom/V8IntersectionObserverCustom.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8IntersectionObserverCustom.cpp
@@ -36,15 +36,15 @@ void V8IntersectionObserver::constructorCustom(const v8::FunctionCallbackInfo<v8
IntersectionObserverInit intersectionObserverInit;
ExceptionState exceptionState(ExceptionState::ConstructionContext, "Intersection", info.Holder(), info.GetIsolate());
V8IntersectionObserverInit::toImpl(info.GetIsolate(), info[1], intersectionObserverInit, exceptionState);
- if (exceptionState.hadException()) {
- V8ThrowException::throwGeneralError(info.GetIsolate(), exceptionState.message());
+ if (exceptionState.throwIfNeeded())
return;
- }
IntersectionObserverCallback* callback = new V8IntersectionObserverCallback(v8::Local<v8::Function>::Cast(info[0]), wrapper, ScriptState::current(info.GetIsolate()));
IntersectionObserver* observer = IntersectionObserver::create(intersectionObserverInit, *callback, exceptionState);
- if (!observer || exceptionState.hadException()) {
- V8ThrowException::throwGeneralError(info.GetIsolate(), exceptionState.message());
+ if (exceptionState.throwIfNeeded())
+ return;
+ if (!observer) {
haraken 2016/02/29 23:35:56 Can this be ASSERT(observer)? If observer is null,
szager1 2016/02/29 23:45:39 Done.
+ V8ThrowException::throwGeneralError(info.GetIsolate(), "Unknown error while constructing IntersectionObserver.");
return;
}

Powered by Google App Engine
This is Rietveld 408576698