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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp

Issue 2628053003: Remove extension group from DOMWrapperWorld. (Closed)
Patch Set: Fix GCCallbackTest Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Apple Inc. All rights reserved.
4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
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 are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 428
429 if (object.IsEmpty()) 429 if (object.IsEmpty())
430 return v8::Local<v8::Value>(); 430 return v8::Local<v8::Value>();
431 431
432 return handleScope.Escape(object); 432 return handleScope.Escape(object);
433 } 433 }
434 434
435 void ScriptController::executeScriptInIsolatedWorld( 435 void ScriptController::executeScriptInIsolatedWorld(
436 int worldID, 436 int worldID,
437 const HeapVector<ScriptSourceCode>& sources, 437 const HeapVector<ScriptSourceCode>& sources,
438 int extensionGroup,
439 Vector<v8::Local<v8::Value>>* results) { 438 Vector<v8::Local<v8::Value>>* results) {
440 ASSERT(worldID > 0); 439 ASSERT(worldID > 0);
441 440
442 RefPtr<DOMWrapperWorld> world = 441 RefPtr<DOMWrapperWorld> world =
443 DOMWrapperWorld::ensureIsolatedWorld(isolate(), worldID, extensionGroup); 442 DOMWrapperWorld::ensureIsolatedWorld(isolate(), worldID);
444 LocalWindowProxy* isolatedWorldWindowProxy = windowProxy(*world); 443 LocalWindowProxy* isolatedWorldWindowProxy = windowProxy(*world);
445 ScriptState* scriptState = isolatedWorldWindowProxy->getScriptState(); 444 ScriptState* scriptState = isolatedWorldWindowProxy->getScriptState();
446 if (!scriptState->contextIsValid()) 445 if (!scriptState->contextIsValid())
447 return; 446 return;
448 v8::Context::Scope scope(scriptState->context()); 447 v8::Context::Scope scope(scriptState->context());
449 v8::Local<v8::Array> resultArray = v8::Array::New(isolate(), sources.size()); 448 v8::Local<v8::Array> resultArray = v8::Array::New(isolate(), sources.size());
450 449
451 for (size_t i = 0; i < sources.size(); ++i) { 450 for (size_t i = 0; i < sources.size(); ++i) {
452 v8::Local<v8::Value> evaluationResult = 451 v8::Local<v8::Value> evaluationResult =
453 executeScriptAndReturnValue(scriptState->context(), sources[i]); 452 executeScriptAndReturnValue(scriptState->context(), sources[i]);
454 if (evaluationResult.IsEmpty()) 453 if (evaluationResult.IsEmpty())
455 evaluationResult = 454 evaluationResult =
456 v8::Local<v8::Value>::New(isolate(), v8::Undefined(isolate())); 455 v8::Local<v8::Value>::New(isolate(), v8::Undefined(isolate()));
457 if (!v8CallBoolean(resultArray->CreateDataProperty(scriptState->context(), 456 if (!v8CallBoolean(resultArray->CreateDataProperty(scriptState->context(),
458 i, evaluationResult))) 457 i, evaluationResult)))
459 return; 458 return;
460 } 459 }
461 460
462 if (results) { 461 if (results) {
463 for (size_t i = 0; i < resultArray->Length(); ++i) { 462 for (size_t i = 0; i < resultArray->Length(); ++i) {
464 v8::Local<v8::Value> value; 463 v8::Local<v8::Value> value;
465 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) 464 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value))
466 return; 465 return;
467 results->push_back(value); 466 results->push_back(value);
468 } 467 }
469 } 468 }
470 } 469 }
471 470
472 } // namespace blink 471 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698