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

Unified Diff: third_party/WebKit/Source/core/inspector/DOMEditor.cpp

Issue 2468803002: [DevTools] migrate InspectorDOMAgent to new style (Closed)
Patch Set: addressed comments and rebased Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/DOMEditor.cpp
diff --git a/third_party/WebKit/Source/core/inspector/DOMEditor.cpp b/third_party/WebKit/Source/core/inspector/DOMEditor.cpp
index 2bb5ac80bc8d204eee359fee536f9d9a45911dda..661cacc10f7626137c81f5feb5d233c2d7b8c66d 100644
--- a/third_party/WebKit/Source/core/inspector/DOMEditor.cpp
+++ b/third_party/WebKit/Source/core/inspector/DOMEditor.cpp
@@ -446,67 +446,54 @@ bool DOMEditor::setNodeValue(Node* node,
exceptionState);
}
-static void populateErrorString(ExceptionState& exceptionState,
- ErrorString* errorString) {
- if (exceptionState.hadException())
- *errorString = DOMException::getErrorName(exceptionState.code());
+static Response toResponse(ExceptionState& exceptionState) {
+ if (exceptionState.hadException()) {
+ return Response::Error(DOMException::getErrorName(exceptionState.code()) +
+ " " + exceptionState.message());
+ }
+ return Response::OK();
}
-bool DOMEditor::insertBefore(ContainerNode* parentNode,
- Node* node,
- Node* anchorNode,
- ErrorString* errorString) {
+Response DOMEditor::insertBefore(ContainerNode* parentNode,
+ Node* node,
+ Node* anchorNode) {
TrackExceptionState exceptionState;
- bool result = insertBefore(parentNode, node, anchorNode, exceptionState);
- populateErrorString(exceptionState, errorString);
- return result;
+ insertBefore(parentNode, node, anchorNode, exceptionState);
+ return toResponse(exceptionState);
}
-bool DOMEditor::removeChild(ContainerNode* parentNode,
- Node* node,
- ErrorString* errorString) {
+Response DOMEditor::removeChild(ContainerNode* parentNode, Node* node) {
TrackExceptionState exceptionState;
- bool result = removeChild(parentNode, node, exceptionState);
- populateErrorString(exceptionState, errorString);
- return result;
+ removeChild(parentNode, node, exceptionState);
+ return toResponse(exceptionState);
}
-bool DOMEditor::setAttribute(Element* element,
- const String& name,
- const String& value,
- ErrorString* errorString) {
+Response DOMEditor::setAttribute(Element* element,
+ const String& name,
+ const String& value) {
TrackExceptionState exceptionState;
- bool result = setAttribute(element, name, value, exceptionState);
- populateErrorString(exceptionState, errorString);
- return result;
+ setAttribute(element, name, value, exceptionState);
+ return toResponse(exceptionState);
}
-bool DOMEditor::removeAttribute(Element* element,
- const String& name,
- ErrorString* errorString) {
+Response DOMEditor::removeAttribute(Element* element, const String& name) {
TrackExceptionState exceptionState;
- bool result = removeAttribute(element, name, exceptionState);
- populateErrorString(exceptionState, errorString);
- return result;
+ removeAttribute(element, name, exceptionState);
+ return toResponse(exceptionState);
}
-bool DOMEditor::setOuterHTML(Node* node,
- const String& html,
- Node** newNode,
- ErrorString* errorString) {
+Response DOMEditor::setOuterHTML(Node* node,
+ const String& html,
+ Node** newNode) {
TrackExceptionState exceptionState;
- bool result = setOuterHTML(node, html, newNode, exceptionState);
- populateErrorString(exceptionState, errorString);
- return result;
+ setOuterHTML(node, html, newNode, exceptionState);
+ return toResponse(exceptionState);
}
-bool DOMEditor::replaceWholeText(Text* textNode,
- const String& text,
- ErrorString* errorString) {
+Response DOMEditor::replaceWholeText(Text* textNode, const String& text) {
TrackExceptionState exceptionState;
- bool result = replaceWholeText(textNode, text, exceptionState);
- populateErrorString(exceptionState, errorString);
- return result;
+ replaceWholeText(textNode, text, exceptionState);
+ return toResponse(exceptionState);
}
DEFINE_TRACE(DOMEditor) {
« no previous file with comments | « third_party/WebKit/Source/core/inspector/DOMEditor.h ('k') | third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698