Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
44 lines (33 sloc) 1.62 KB
ExtensionAPI.js
client side of extensions. Loaded into .html files by some content_scripts. API maps to postMessage:
ConsoleAPI.prototype = {
getMessages: function(callback)
{
extensionServer.sendRequest({ command: commands.GetConsoleMessages }, callback);
},
where:
var extensionServer = new ExtensionServerClient();
is a proxy creates a MessageChannel to devtools.html and routes the response to callback.
This is very similar to my
connection.postObject(url, obj, callback, errback);
Within the ExtensionAPI
this.onMessageAdded = new EventSink(events.ConsoleMessageAdded);
ConsoleMessageAdded: "console-message-added",
ExtensionServer.js
server side of extensions. Runs in devtools.html.
takes a window.message event 'registerExtension' and opens a MessageChannel back to the poster.
services its end of the channel to
1) dispatch incoming commands
the command are registered when ExtensionServer is created.
2) notify subscribers of events.
a command Subscribe takes a message 'type' to register the remote port for events matching 'type'.
This is similar to my put() to the connection.putObject(
'ChromeDevtools.onEvent.addListener.'+domain,
remoteRef)
DevtoolsExtensionAPI.js
defines chrome.devtools if platformExtensionAPI() is called
devtools_extension_api.js
some kind of concatenation of ExtensionAPI.js and DevtoolsExtensionAPI.js
remoteDebug.onEvent fires backend.dispatch.apply(backend, [data]);, so
we can issue ExtensionServer _notifyRemoteDebugEvent() from there. Do it in onEvent in
Debuggee for now.
Something went wrong with that request. Please try again.