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

Unified Diff: third_party/WebKit/Source/core/dom/IntersectionObserver.cpp

Issue 1740923004: IntersectionObserver: make exceptions match spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Call disconnect from clearWeakMembers 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/core/dom/IntersectionObserver.cpp
diff --git a/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp b/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp
index cca839fc37d293f3ec5268455c9114185713afad..66d41f6bbf7b2967a98aa311129628f3aa0332b1 100644
--- a/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp
+++ b/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp
@@ -53,11 +53,11 @@ static void parseRootMargin(String rootMarginParameter, Vector<Length>& rootMarg
rootMargin.append(Length(token.numericValue(), Percent));
break;
default:
- exceptionState.throwTypeError("rootMargin must be specified in pixels or percent.");
+ exceptionState.throwDOMException(SyntaxError, "rootMargin must be specified in pixels or percent.");
}
break;
default:
- exceptionState.throwTypeError("rootMargin must be specified in pixels or percent.");
+ exceptionState.throwDOMException(SyntaxError, "rootMargin must be specified in pixels or percent.");
}
}
}
@@ -73,7 +73,7 @@ static void parseThresholds(const DoubleOrDoubleArray& thresholdParameter, Vecto
for (auto thresholdValue : thresholds) {
if (thresholdValue < 0.0 || thresholdValue > 1.0) {
- exceptionState.throwTypeError("Threshold values must be between 0 and 1");
+ exceptionState.throwRangeError("Threshold values must be between 0 and 1");
break;
}
}
@@ -175,7 +175,7 @@ LayoutObject* IntersectionObserver::rootLayoutObject() const
void IntersectionObserver::observe(Element* target, ExceptionState& exceptionState)
{
if (!m_root) {
- exceptionState.throwDOMException(HierarchyRequestError, "Invalid observer: root element or containing document has been deleted.");
+ exceptionState.throwDOMException(InvalidStateError, "Invalid observer: root element or containing document has been deleted.");
ojan 2016/02/27 01:45:45 I thought we decided this case wouldn't throw?
szager1 2016/02/29 22:35:53 Initially, I had thought this method would still t
return;
}
if (!target) {
@@ -202,7 +202,7 @@ void IntersectionObserver::observe(Element* target, ExceptionState& exceptionSta
m_observations.add(observation);
}
-void IntersectionObserver::unobserve(Element* target, ExceptionState&)
+void IntersectionObserver::unobserve(Element* target)
{
if (!target || !target->intersectionObserverData())
return;
@@ -248,9 +248,9 @@ HeapVector<Member<IntersectionObserverEntry>> IntersectionObserver::takeRecords(
Element* IntersectionObserver::root() const
{
Node* node = rootNode();
- if (node->isDocumentNode())
- return nullptr;
- return toElement(node);
+ if (node && !node->isDocumentNode())
+ return toElement(node);
+ return nullptr;
}
static void appendLength(StringBuilder& stringBuilder, const Length& length)
« no previous file with comments | « third_party/WebKit/Source/core/dom/IntersectionObserver.h ('k') | third_party/WebKit/Source/core/dom/IntersectionObserver.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698