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

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

Issue 2848653003: Add a DevTools command to create an isolated world for a given frame (Closed)
Patch Set: Fix test Created 3 years, 7 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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 if (results) { 353 if (results) {
354 for (size_t i = 0; i < result_array->Length(); ++i) { 354 for (size_t i = 0; i < result_array->Length(); ++i) {
355 v8::Local<v8::Value> value; 355 v8::Local<v8::Value> value;
356 if (!result_array->Get(context, i).ToLocal(&value)) 356 if (!result_array->Get(context, i).ToLocal(&value))
357 return; 357 return;
358 results->push_back(value); 358 results->push_back(value);
359 } 359 }
360 } 360 }
361 } 361 }
362 362
363 int ScriptController::CreateNewDevToolsIsolatedWorld(const String& world_name) {
364 int world_id = DOMWrapperWorld::GenerateWorldIdForType(
365 DOMWrapperWorld::WorldType::kIsolated);
366 // Bail out if we could not allocate an id.
367 if (world_id == DOMWrapperWorld::kInvalidWorldId)
368 return DOMWrapperWorld::kInvalidWorldId;
369
370 RefPtr<DOMWrapperWorld> world =
371 DOMWrapperWorld::EnsureIsolatedWorld(GetIsolate(), world_id);
372
373 if (!world_name.IsEmpty())
374 DOMWrapperWorld::SetIsolatedWorldHumanReadableName(world_id, world_name);
375 // Make sure the execution context exists.
376 WindowProxy(*world);
377 return world_id;
378 }
379
363 } // namespace blink 380 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698