fix(extensions): set lowest isolated world id (#22212)

* fix(extensions): set lowest isolated world id

* refactor: move world IDs into separate header file

Several files are including electron_render_frame_observer.h just for the world IDs.
This commit is contained in:
Samuel Maddock 2020-02-23 23:33:58 -05:00 committed by GitHub
parent 68c6d53156
commit 8cc0435d9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 45 additions and 33 deletions

View file

@ -11,7 +11,6 @@
#include "content/public/renderer/render_frame_observer.h"
#include "ipc/ipc_platform_file.h"
#include "shell/renderer/renderer_client_base.h"
#include "third_party/blink/public/platform/web_isolated_world_ids.h"
#include "third_party/blink/public/web/web_local_frame.h"
namespace base {
@ -20,23 +19,6 @@ class ListValue;
namespace electron {
enum World {
MAIN_WORLD = 0,
// Use a high number far away from 0 to not collide with any other world
// IDs created internally by Chrome.
ISOLATED_WORLD = 999,
// Numbers for isolated worlds for extensions are set in
// lib/renderer/content-script-injector.ts, and are greater than or equal to
// this number, up to ISOLATED_WORLD_EXTENSIONS_END.
ISOLATED_WORLD_EXTENSIONS = 1 << 20,
// Last valid isolated world ID.
ISOLATED_WORLD_EXTENSIONS_END =
blink::IsolatedWorldId::kEmbedderWorldIdLimit - 1
};
// Helper class to forward the messages to the client.
class ElectronRenderFrameObserver : public content::RenderFrameObserver {
public: