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

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

Issue 2848653003: Add a DevTools command to create an isolated world for a given frame (Closed)
Patch Set: 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) 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 883 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 .setPageX(AdjustScrollForAbsoluteZoom(page_offset.Width(), page_zoom)) 894 .setPageX(AdjustScrollForAbsoluteZoom(page_offset.Width(), page_zoom))
895 .setPageY( 895 .setPageY(
896 AdjustScrollForAbsoluteZoom(page_offset.Height(), page_zoom)) 896 AdjustScrollForAbsoluteZoom(page_offset.Height(), page_zoom))
897 .setClientWidth(visible_rect.Width() - scrollbar_width) 897 .setClientWidth(visible_rect.Width() - scrollbar_width)
898 .setClientHeight(visible_rect.Height() - scrollbar_height) 898 .setClientHeight(visible_rect.Height() - scrollbar_height)
899 .setScale(scale) 899 .setScale(scale)
900 .build(); 900 .build();
901 return Response::OK(); 901 return Response::OK();
902 } 902 }
903 903
904 protocol::Response InspectorPageAgent::ensureIsolatedWorld(
905 const String& frame_id,
906 int world_id,
907 Maybe<String> security_origin,
908 Maybe<String> content_security_policy) {
909 LocalFrame* frame =
910 IdentifiersFactory::FrameById(inspected_frames_, frame_id);
911 if (!frame)
912 return Response::Error("No frame for given id found");
913
914 if (world_id <= DOMWrapperWorld::kMainWorldId ||
915 world_id >= DOMWrapperWorld::kEmbedderWorldIdLimit) {
916 return Response::Error("Invalid worldId");
917 }
918
919 frame->GetScriptController().EnsureIsolatedWorld(world_id);
920 if (security_origin.isJust()) {
921 DOMWrapperWorld::SetIsolatedWorldSecurityOrigin(
922 world_id, SecurityOrigin::CreateFromString(security_origin.fromJust()));
923 }
924
925 if (content_security_policy.isJust()) {
926 DOMWrapperWorld::SetIsolatedWorldContentSecurityPolicy(
927 world_id, content_security_policy.fromJust());
928 }
929 return Response::OK();
930 }
931
904 DEFINE_TRACE(InspectorPageAgent) { 932 DEFINE_TRACE(InspectorPageAgent) {
905 visitor->Trace(inspected_frames_); 933 visitor->Trace(inspected_frames_);
906 visitor->Trace(inspector_resource_content_loader_); 934 visitor->Trace(inspector_resource_content_loader_);
907 InspectorBaseAgent::Trace(visitor); 935 InspectorBaseAgent::Trace(visitor);
908 } 936 }
909 937
910 } // namespace blink 938 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698