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

Side by Side Diff: third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp

Issue 2566823002: Remove deprecated ExceptionState constructors. (Closed)
Patch Set: Created 4 years 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) 2011 Google Inc. All rights reserved. 2 * Copyright (c) 2011 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 void MainThreadDebugger::querySelectorCallback( 362 void MainThreadDebugger::querySelectorCallback(
363 const v8::FunctionCallbackInfo<v8::Value>& info) { 363 const v8::FunctionCallbackInfo<v8::Value>& info) {
364 if (info.Length() < 1) 364 if (info.Length() < 1)
365 return; 365 return;
366 String selector = toCoreStringWithUndefinedOrNullCheck(info[0]); 366 String selector = toCoreStringWithUndefinedOrNullCheck(info[0]);
367 if (selector.isEmpty()) 367 if (selector.isEmpty())
368 return; 368 return;
369 Node* node = secondArgumentAsNode(info); 369 Node* node = secondArgumentAsNode(info);
370 if (!node || !node->isContainerNode()) 370 if (!node || !node->isContainerNode())
371 return; 371 return;
372 ExceptionState exceptionState(ExceptionState::ExecutionContext, "$", 372 ExceptionState exceptionState(info.GetIsolate(),
373 "CommandLineAPI", info.Holder(), 373 ExceptionState::ExecutionContext,
374 info.GetIsolate()); 374 "CommandLineAPI", "$");
375 Element* element = toContainerNode(node)->querySelector( 375 Element* element = toContainerNode(node)->querySelector(
376 AtomicString(selector), exceptionState); 376 AtomicString(selector), exceptionState);
377 if (exceptionState.hadException()) 377 if (exceptionState.hadException())
378 return; 378 return;
379 if (element) 379 if (element)
380 info.GetReturnValue().Set(toV8(element, info.Holder(), info.GetIsolate())); 380 info.GetReturnValue().Set(toV8(element, info.Holder(), info.GetIsolate()));
381 else 381 else
382 info.GetReturnValue().Set(v8::Null(info.GetIsolate())); 382 info.GetReturnValue().Set(v8::Null(info.GetIsolate()));
383 } 383 }
384 384
385 void MainThreadDebugger::querySelectorAllCallback( 385 void MainThreadDebugger::querySelectorAllCallback(
386 const v8::FunctionCallbackInfo<v8::Value>& info) { 386 const v8::FunctionCallbackInfo<v8::Value>& info) {
387 if (info.Length() < 1) 387 if (info.Length() < 1)
388 return; 388 return;
389 String selector = toCoreStringWithUndefinedOrNullCheck(info[0]); 389 String selector = toCoreStringWithUndefinedOrNullCheck(info[0]);
390 if (selector.isEmpty()) 390 if (selector.isEmpty())
391 return; 391 return;
392 Node* node = secondArgumentAsNode(info); 392 Node* node = secondArgumentAsNode(info);
393 if (!node || !node->isContainerNode()) 393 if (!node || !node->isContainerNode())
394 return; 394 return;
395 ExceptionState exceptionState(ExceptionState::ExecutionContext, "$$", 395 ExceptionState exceptionState(info.GetIsolate(),
396 "CommandLineAPI", info.Holder(), 396 ExceptionState::ExecutionContext,
397 info.GetIsolate()); 397 "CommandLineAPI", "$$");
398 // toV8(elementList) doesn't work here, since we need a proper Array instance, 398 // toV8(elementList) doesn't work here, since we need a proper Array instance,
399 // not NodeList. 399 // not NodeList.
400 StaticElementList* elementList = toContainerNode(node)->querySelectorAll( 400 StaticElementList* elementList = toContainerNode(node)->querySelectorAll(
401 AtomicString(selector), exceptionState); 401 AtomicString(selector), exceptionState);
402 if (exceptionState.hadException() || !elementList) 402 if (exceptionState.hadException() || !elementList)
403 return; 403 return;
404 v8::Isolate* isolate = info.GetIsolate(); 404 v8::Isolate* isolate = info.GetIsolate();
405 v8::Local<v8::Context> context = isolate->GetCurrentContext(); 405 v8::Local<v8::Context> context = isolate->GetCurrentContext();
406 v8::Local<v8::Array> nodes = v8::Array::New(isolate, elementList->length()); 406 v8::Local<v8::Array> nodes = v8::Array::New(isolate, elementList->length());
407 for (size_t i = 0; i < elementList->length(); ++i) { 407 for (size_t i = 0; i < elementList->length(); ++i) {
(...skipping 10 matching lines...) Expand all
418 const v8::FunctionCallbackInfo<v8::Value>& info) { 418 const v8::FunctionCallbackInfo<v8::Value>& info) {
419 if (info.Length() < 1) 419 if (info.Length() < 1)
420 return; 420 return;
421 String selector = toCoreStringWithUndefinedOrNullCheck(info[0]); 421 String selector = toCoreStringWithUndefinedOrNullCheck(info[0]);
422 if (selector.isEmpty()) 422 if (selector.isEmpty())
423 return; 423 return;
424 Node* node = secondArgumentAsNode(info); 424 Node* node = secondArgumentAsNode(info);
425 if (!node || !node->isContainerNode()) 425 if (!node || !node->isContainerNode())
426 return; 426 return;
427 427
428 ExceptionState exceptionState(ExceptionState::ExecutionContext, "$x", 428 ExceptionState exceptionState(info.GetIsolate(),
429 "CommandLineAPI", info.Holder(), 429 ExceptionState::ExecutionContext,
430 info.GetIsolate()); 430 "CommandLineAPI", "$x");
431 XPathResult* result = XPathEvaluator::create()->evaluate( 431 XPathResult* result = XPathEvaluator::create()->evaluate(
432 selector, node, nullptr, XPathResult::kAnyType, ScriptValue(), 432 selector, node, nullptr, XPathResult::kAnyType, ScriptValue(),
433 exceptionState); 433 exceptionState);
434 if (exceptionState.hadException() || !result) 434 if (exceptionState.hadException() || !result)
435 return; 435 return;
436 if (result->resultType() == XPathResult::kNumberType) { 436 if (result->resultType() == XPathResult::kNumberType) {
437 info.GetReturnValue().Set(toV8(result->numberValue(exceptionState), 437 info.GetReturnValue().Set(toV8(result->numberValue(exceptionState),
438 info.Holder(), info.GetIsolate())); 438 info.Holder(), info.GetIsolate()));
439 } else if (result->resultType() == XPathResult::kStringType) { 439 } else if (result->resultType() == XPathResult::kStringType) {
440 info.GetReturnValue().Set(toV8(result->stringValue(exceptionState), 440 info.GetReturnValue().Set(toV8(result->stringValue(exceptionState),
(...skipping 13 matching lines...) Expand all
454 context, nodes, index++, 454 context, nodes, index++,
455 toV8(node, info.Holder(), info.GetIsolate())) 455 toV8(node, info.Holder(), info.GetIsolate()))
456 .FromMaybe(false)) 456 .FromMaybe(false))
457 return; 457 return;
458 } 458 }
459 info.GetReturnValue().Set(nodes); 459 info.GetReturnValue().Set(nodes);
460 } 460 }
461 } 461 }
462 462
463 } // namespace blink 463 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698