As requested on webkit-gtk mailing list. http://lists.webkit.org/pipermail/webkit-gtk/2012-November/001293.html There was at one time a desire to add this API to WebKit1, covered by bug #31508.
Created attachment 209352 [details] Patch
Patch doesn't apply because it depends on patch applied to bug #119743
Comment on attachment 209352 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=209352&action=review > Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.cpp:41 > + DEFINE_STATIC_LOCAL(ScriptWorldMap, map, ()); This can be NeverDestroyed<ScriptWorldMap> map if you include wtf/NeverDestroyed.h
(In reply to comment #3) > (From update of attachment 209352 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=209352&action=review Thanks for the review. > > Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.cpp:41 > > + DEFINE_STATIC_LOCAL(ScriptWorldMap, map, ()); > > This can be NeverDestroyed<ScriptWorldMap> map if you include wtf/NeverDestroyed.h Sure, I didn't know NeverDestroyed.
Comment on attachment 209352 [details] Patch The API looks sensible to me, +1.
Comment on attachment 209352 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=209352&action=review Looks good to me as well. > Source/WebKit2/UIProcess/API/gtk/tests/WebExtensionTest.cpp:154 > + const char *script; Nit: asterisk location > Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.cpp:88 > + return scriptWorlds().get(scriptWorld); This returns null if the world isn't in the map?
(In reply to comment #6) > (From update of attachment 209352 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=209352&action=review > > Looks good to me as well. Thanks! > > Source/WebKit2/UIProcess/API/gtk/tests/WebExtensionTest.cpp:154 > > + const char *script; > > Nit: asterisk location Ooops > > Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitScriptWorld.cpp:88 > > + return scriptWorlds().get(scriptWorld); > > This returns null if the world isn't in the map? Yes.
Committed r154545: <http://trac.webkit.org/changeset/154545>
Re-opened since this is blocked by bug 120252
Committed r154603: <http://trac.webkit.org/changeset/154603>