RESOLVED FIXED 89530
Web Inspector: Allow module injections into the InjectedScript
https://bugs.webkit.org/show_bug.cgi?id=89530
Summary Web Inspector: Allow module injections into the InjectedScript
Andrey Adaikin
Reported 2012-06-19 16:46:55 PDT
Add a new InjectedModule abstract class that inherits InjectedScriptBase to reuse implementation, and which javascript code is injected via InjectedScript's addModule.
Attachments
Patch (23.86 KB, patch)
2012-06-19 16:56 PDT, Andrey Adaikin
no flags
Patch (24.59 KB, patch)
2012-06-19 20:12 PDT, Andrey Adaikin
no flags
Patch (26.28 KB, patch)
2012-06-20 10:04 PDT, Andrey Adaikin
no flags
Andrey Adaikin
Comment 1 2012-06-19 16:56:35 PDT
Pavel Feldman
Comment 2 2012-06-19 17:38:25 PDT
Comment on attachment 148460 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=148460&action=review > Source/WebCore/inspector/InjectedModule.h:42 > +class InjectedModule : public InjectedScriptBase { InjectedScriptModule > Source/WebCore/inspector/InjectedModule.h:49 > + friend void InjectedScript::injectModule(InjectedModule&, bool&); friend class InjectedScript > Source/WebCore/inspector/InjectedScript.cpp:242 > + ASSERT(!hasNoValue()); I would try to hold all the module-related logic in a single location. (InjectedScriptModule). Eventually, we might want to make generic injected script a module itself.
Andrey Adaikin
Comment 3 2012-06-19 20:12:16 PDT
Yury Semikhatsky
Comment 4 2012-06-20 00:10:22 PDT
Comment on attachment 148491 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=148491&action=review > Source/WebCore/inspector/InjectedScriptBase.h:53 > + virtual String name() const = 0; Just pass it as a constructor parameter? > Source/WebCore/inspector/InjectedScriptBase.h:70 > + friend class InjectedScriptModule; I'd rather introduce protected method initialize(ScriptObject, inspectedStateAccessCheck) > Source/WebCore/inspector/InjectedScriptModule.cpp:51 > + ASSERT(!injectedScript.hasNoValue()); If InjectedScript is required we may have injectModule method defined on InjectedScript and avoid this check and InjectedScriptManager parameter.
Andrey Adaikin
Comment 5 2012-06-20 09:56:21 PDT
Comment on attachment 148491 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=148491&action=review >> Source/WebCore/inspector/InjectedScriptBase.h:53 >> + virtual String name() const = 0; > > Just pass it as a constructor parameter? Done. >> Source/WebCore/inspector/InjectedScriptBase.h:70 >> + friend class InjectedScriptModule; > > I'd rather introduce protected method initialize(ScriptObject, inspectedStateAccessCheck) Done. >> Source/WebCore/inspector/InjectedScriptModule.cpp:51 >> + ASSERT(!injectedScript.hasNoValue()); > > If InjectedScript is required we may have injectModule method defined on InjectedScript and avoid this check and InjectedScriptManager parameter. The previous attachment does suggest a solution with injectModule defined on the InjectedScript. But ultimately we would like the InjectedScript be a module itself (e.g. smth like GenericInjectedScriptModule), and prohibit it to inject other modules. The "injectModule" method will be in a separate entity (let it call InjectedModuleManager) that will be also shared across all modules to reuse methods like bindObject, wrapObject and etc. In other words, now we have: InjectedScript = GenericInjectedScriptModule + InjectedModuleManager, which should be split up accordingly in a future refactoring. Thus, not having the "injectModule" method defined on InjectedScript helps the future efforts.
Andrey Adaikin
Comment 6 2012-06-20 10:04:05 PDT
WebKit Review Bot
Comment 7 2012-06-20 11:28:23 PDT
Comment on attachment 148589 [details] Patch Clearing flags on attachment: 148589 Committed r120842: <http://trac.webkit.org/changeset/120842>
WebKit Review Bot
Comment 8 2012-06-20 11:28:29 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.