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

Side by Side Diff: Source/core/inspector/InspectorDOMAgent.cpp

Issue 72363002: Rename es => exceptionState in other than bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Retry 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 { 213 {
214 // The timer is stopped on m_domAgent destruction, so this method will never be called after m_domAgent has been destroyed. 214 // The timer is stopped on m_domAgent destruction, so this method will never be called after m_domAgent has been destroyed.
215 Vector<Element*> elements; 215 Vector<Element*> elements;
216 for (HashSet<RefPtr<Element> >::iterator it = m_elements.begin(), end = m_el ements.end(); it != end; ++it) 216 for (HashSet<RefPtr<Element> >::iterator it = m_elements.begin(), end = m_el ements.end(); it != end; ++it)
217 elements.append(it->get()); 217 elements.append(it->get());
218 m_domAgent->styleAttributeInvalidated(elements); 218 m_domAgent->styleAttributeInvalidated(elements);
219 219
220 m_elements.clear(); 220 m_elements.clear();
221 } 221 }
222 222
223 String InspectorDOMAgent::toErrorString(ExceptionState& es) 223 String InspectorDOMAgent::toErrorString(ExceptionState& exceptionState)
224 { 224 {
225 if (es.hadException()) 225 if (exceptionState.hadException())
226 return DOMException::getErrorName(es.code()); 226 return DOMException::getErrorName(exceptionState.code());
227 return ""; 227 return "";
228 } 228 }
229 229
230 InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, I nspectorPageAgent* pageAgent, InspectorCompositeState* inspectorState, InjectedS criptManager* injectedScriptManager, InspectorOverlay* overlay, InspectorClient* client) 230 InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, I nspectorPageAgent* pageAgent, InspectorCompositeState* inspectorState, InjectedS criptManager* injectedScriptManager, InspectorOverlay* overlay, InspectorClient* client)
231 : InspectorBaseAgent<InspectorDOMAgent>("DOM", instrumentingAgents, inspecto rState) 231 : InspectorBaseAgent<InspectorDOMAgent>("DOM", instrumentingAgents, inspecto rState)
232 , m_pageAgent(pageAgent) 232 , m_pageAgent(pageAgent)
233 , m_injectedScriptManager(injectedScriptManager) 233 , m_injectedScriptManager(injectedScriptManager)
234 , m_overlay(overlay) 234 , m_overlay(overlay)
235 , m_client(client) 235 , m_client(client)
236 , m_frontend(0) 236 , m_frontend(0)
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 pushChildNodesToFrontend(nodeId, sanitizedDepth); 560 pushChildNodesToFrontend(nodeId, sanitizedDepth);
561 } 561 }
562 562
563 void InspectorDOMAgent::querySelector(ErrorString* errorString, int nodeId, cons t String& selectors, int* elementId) 563 void InspectorDOMAgent::querySelector(ErrorString* errorString, int nodeId, cons t String& selectors, int* elementId)
564 { 564 {
565 *elementId = 0; 565 *elementId = 0;
566 Node* node = assertNode(errorString, nodeId); 566 Node* node = assertNode(errorString, nodeId);
567 if (!node) 567 if (!node)
568 return; 568 return;
569 569
570 TrackExceptionState es; 570 TrackExceptionState exceptionState;
571 RefPtr<Element> element = node->querySelector(selectors, es); 571 RefPtr<Element> element = node->querySelector(selectors, exceptionState);
572 if (es.hadException()) { 572 if (exceptionState.hadException()) {
573 *errorString = "DOM Error while querying"; 573 *errorString = "DOM Error while querying";
574 return; 574 return;
575 } 575 }
576 576
577 if (element) 577 if (element)
578 *elementId = pushNodePathToFrontend(element.get()); 578 *elementId = pushNodePathToFrontend(element.get());
579 } 579 }
580 580
581 void InspectorDOMAgent::querySelectorAll(ErrorString* errorString, int nodeId, c onst String& selectors, RefPtr<TypeBuilder::Array<int> >& result) 581 void InspectorDOMAgent::querySelectorAll(ErrorString* errorString, int nodeId, c onst String& selectors, RefPtr<TypeBuilder::Array<int> >& result)
582 { 582 {
583 Node* node = assertNode(errorString, nodeId); 583 Node* node = assertNode(errorString, nodeId);
584 if (!node) 584 if (!node)
585 return; 585 return;
586 586
587 TrackExceptionState es; 587 TrackExceptionState exceptionState;
588 RefPtr<NodeList> nodes = node->querySelectorAll(selectors, es); 588 RefPtr<NodeList> nodes = node->querySelectorAll(selectors, exceptionState);
589 if (es.hadException()) { 589 if (exceptionState.hadException()) {
590 *errorString = "DOM Error while querying"; 590 *errorString = "DOM Error while querying";
591 return; 591 return;
592 } 592 }
593 593
594 result = TypeBuilder::Array<int>::create(); 594 result = TypeBuilder::Array<int>::create();
595 595
596 for (unsigned i = 0; i < nodes->length(); ++i) 596 for (unsigned i = 0; i < nodes->length(); ++i)
597 result->addItem(pushNodePathToFrontend(nodes->item(i))); 597 result->addItem(pushNodePathToFrontend(nodes->item(i)));
598 } 598 }
599 599
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 } 760 }
761 761
762 void InspectorDOMAgent::setNodeName(ErrorString* errorString, int nodeId, const String& tagName, int* newId) 762 void InspectorDOMAgent::setNodeName(ErrorString* errorString, int nodeId, const String& tagName, int* newId)
763 { 763 {
764 *newId = 0; 764 *newId = 0;
765 765
766 Node* oldNode = nodeForId(nodeId); 766 Node* oldNode = nodeForId(nodeId);
767 if (!oldNode || !oldNode->isElementNode()) 767 if (!oldNode || !oldNode->isElementNode())
768 return; 768 return;
769 769
770 TrackExceptionState es; 770 TrackExceptionState exceptionState;
771 RefPtr<Element> newElem = oldNode->document().createElement(tagName, es); 771 RefPtr<Element> newElem = oldNode->document().createElement(tagName, excepti onState);
772 if (es.hadException()) 772 if (exceptionState.hadException())
773 return; 773 return;
774 774
775 // Copy over the original node's attributes. 775 // Copy over the original node's attributes.
776 newElem->cloneAttributesFromElement(*toElement(oldNode)); 776 newElem->cloneAttributesFromElement(*toElement(oldNode));
777 777
778 // Copy over the original node's children. 778 // Copy over the original node's children.
779 Node* child; 779 Node* child;
780 while ((child = oldNode->firstChild())) { 780 while ((child = oldNode->firstChild())) {
781 if (!m_domEditor->insertBefore(newElem.get(), child, 0, errorString)) 781 if (!m_domEditor->insertBefore(newElem.get(), child, 0, errorString))
782 return; 782 return;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 break; 996 break;
997 } 997 }
998 default: 998 default:
999 break; 999 break;
1000 } 1000 }
1001 } 1001 }
1002 1002
1003 // XPath evaluation 1003 // XPath evaluation
1004 for (Vector<Document*>::iterator it = docs.begin(); it != docs.end(); ++ it) { 1004 for (Vector<Document*>::iterator it = docs.begin(); it != docs.end(); ++ it) {
1005 Document* document = *it; 1005 Document* document = *it;
1006 TrackExceptionState es; 1006 TrackExceptionState exceptionState;
1007 RefPtr<XPathResult> result = DocumentXPathEvaluator::evaluate(docume nt, whitespaceTrimmedQuery, document, 0, XPathResult::ORDERED_NODE_SNAPSHOT_TYPE , 0, es); 1007 RefPtr<XPathResult> result = DocumentXPathEvaluator::evaluate(docume nt, whitespaceTrimmedQuery, document, 0, XPathResult::ORDERED_NODE_SNAPSHOT_TYPE , 0, exceptionState);
1008 if (es.hadException() || !result) 1008 if (exceptionState.hadException() || !result)
1009 continue; 1009 continue;
1010 1010
1011 unsigned long size = result->snapshotLength(es); 1011 unsigned long size = result->snapshotLength(exceptionState);
1012 for (unsigned long i = 0; !es.hadException() && i < size; ++i) { 1012 for (unsigned long i = 0; !exceptionState.hadException() && i < size ; ++i) {
1013 Node* node = result->snapshotItem(i, es); 1013 Node* node = result->snapshotItem(i, exceptionState);
1014 if (es.hadException()) 1014 if (exceptionState.hadException())
1015 break; 1015 break;
1016 1016
1017 if (node->nodeType() == Node::ATTRIBUTE_NODE) 1017 if (node->nodeType() == Node::ATTRIBUTE_NODE)
1018 node = toAttr(node)->ownerElement(); 1018 node = toAttr(node)->ownerElement();
1019 resultCollector.add(node); 1019 resultCollector.add(node);
1020 } 1020 }
1021 } 1021 }
1022 1022
1023 // Selector evaluation 1023 // Selector evaluation
1024 for (Vector<Document*>::iterator it = docs.begin(); it != docs.end(); ++ it) { 1024 for (Vector<Document*>::iterator it = docs.begin(); it != docs.end(); ++ it) {
1025 Document* document = *it; 1025 Document* document = *it;
1026 TrackExceptionState es; 1026 TrackExceptionState exceptionState;
1027 RefPtr<NodeList> nodeList = document->querySelectorAll(whitespaceTri mmedQuery, es); 1027 RefPtr<NodeList> nodeList = document->querySelectorAll(whitespaceTri mmedQuery, exceptionState);
1028 if (es.hadException() || !nodeList) 1028 if (exceptionState.hadException() || !nodeList)
1029 continue; 1029 continue;
1030 1030
1031 unsigned size = nodeList->length(); 1031 unsigned size = nodeList->length();
1032 for (unsigned i = 0; i < size; ++i) 1032 for (unsigned i = 0; i < size; ++i)
1033 resultCollector.add(nodeList->item(i)); 1033 resultCollector.add(nodeList->item(i));
1034 } 1034 }
1035 } 1035 }
1036 1036
1037 *searchId = IdentifiersFactory::createIdentifier(); 1037 *searchId = IdentifiersFactory::createIdentifier();
1038 SearchResults::iterator resultsIt = m_searchResults.add(*searchId, Vector<Re fPtr<Node> >()).iterator; 1038 SearchResults::iterator resultsIt = m_searchResults.add(*searchId, Vector<Re fPtr<Node> >()).iterator;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 } 1275 }
1276 1276
1277 if (!m_domEditor->insertBefore(targetElement, node, anchorNode, errorString) ) 1277 if (!m_domEditor->insertBefore(targetElement, node, anchorNode, errorString) )
1278 return; 1278 return;
1279 1279
1280 *newNodeId = pushNodePathToFrontend(node); 1280 *newNodeId = pushNodePathToFrontend(node);
1281 } 1281 }
1282 1282
1283 void InspectorDOMAgent::undo(ErrorString* errorString) 1283 void InspectorDOMAgent::undo(ErrorString* errorString)
1284 { 1284 {
1285 TrackExceptionState es; 1285 TrackExceptionState exceptionState;
1286 m_history->undo(es); 1286 m_history->undo(exceptionState);
1287 *errorString = InspectorDOMAgent::toErrorString(es); 1287 *errorString = InspectorDOMAgent::toErrorString(exceptionState);
1288 } 1288 }
1289 1289
1290 void InspectorDOMAgent::redo(ErrorString* errorString) 1290 void InspectorDOMAgent::redo(ErrorString* errorString)
1291 { 1291 {
1292 TrackExceptionState es; 1292 TrackExceptionState exceptionState;
1293 m_history->redo(es); 1293 m_history->redo(exceptionState);
1294 *errorString = InspectorDOMAgent::toErrorString(es); 1294 *errorString = InspectorDOMAgent::toErrorString(exceptionState);
1295 } 1295 }
1296 1296
1297 void InspectorDOMAgent::markUndoableState(ErrorString*) 1297 void InspectorDOMAgent::markUndoableState(ErrorString*)
1298 { 1298 {
1299 m_history->markUndoableState(); 1299 m_history->markUndoableState();
1300 } 1300 }
1301 1301
1302 void InspectorDOMAgent::focus(ErrorString* errorString, int nodeId) 1302 void InspectorDOMAgent::focus(ErrorString* errorString, int nodeId)
1303 { 1303 {
1304 Element* element = assertElement(errorString, nodeId); 1304 Element* element = assertElement(errorString, nodeId);
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2017 if (!m_documentNodeToIdMap.contains(m_document)) { 2017 if (!m_documentNodeToIdMap.contains(m_document)) {
2018 RefPtr<TypeBuilder::DOM::Node> root; 2018 RefPtr<TypeBuilder::DOM::Node> root;
2019 getDocument(errorString, root); 2019 getDocument(errorString, root);
2020 return errorString->isEmpty(); 2020 return errorString->isEmpty();
2021 } 2021 }
2022 return true; 2022 return true;
2023 } 2023 }
2024 2024
2025 } // namespace WebCore 2025 } // namespace WebCore
2026 2026
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.cpp ('k') | Source/core/inspector/InspectorDOMStorageAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698