refactor: clean up webFrame implementation to use gin wrappers (#28497)
* refactor: clean up webFrame implementation to use gin wrappers The previous implementation of webFrame in the renderer process leaked sub-frame contexts and global objects across the context boundaries thus making it possible for apps to either maliciously or accidentally violate the contextIsolation boundary. This re-implementation binds all methods in native code directly to content::RenderFrame instances instead of relying on JS to provide a "window" with every method request. This is much more consistent with the rest of the Electron codebase and is substantially safer. * chore: un-re-order for ease of review * chore: pass isolate around instead of ErrorThrower * chore: fix rebase typo * chore: remove unused variables
This commit is contained in:
parent
e775467e9c
commit
6df2680cb6
8 changed files with 604 additions and 632 deletions
|
@ -17,18 +17,18 @@ class ErrorThrower {
|
|||
|
||||
~ErrorThrower();
|
||||
|
||||
void ThrowError(base::StringPiece err_msg);
|
||||
void ThrowTypeError(base::StringPiece err_msg);
|
||||
void ThrowRangeError(base::StringPiece err_msg);
|
||||
void ThrowReferenceError(base::StringPiece err_msg);
|
||||
void ThrowSyntaxError(base::StringPiece err_msg);
|
||||
void ThrowError(base::StringPiece err_msg) const;
|
||||
void ThrowTypeError(base::StringPiece err_msg) const;
|
||||
void ThrowRangeError(base::StringPiece err_msg) const;
|
||||
void ThrowReferenceError(base::StringPiece err_msg) const;
|
||||
void ThrowSyntaxError(base::StringPiece err_msg) const;
|
||||
|
||||
v8::Isolate* isolate() const { return isolate_; }
|
||||
|
||||
private:
|
||||
using ErrorGenerator =
|
||||
v8::Local<v8::Value> (*)(v8::Local<v8::String> err_msg);
|
||||
void Throw(ErrorGenerator gen, base::StringPiece err_msg);
|
||||
void Throw(ErrorGenerator gen, base::StringPiece err_msg) const;
|
||||
|
||||
v8::Isolate* isolate_;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue