mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 14:28:33 +02:00
* README.md 1st commit * New demo with devtools and the webextensions * evolution script example * Remove commented out code, to see if it triggers a Travis build * Updated README; added more descriptive labels for buttons * Added some comments * update evolution * correction * correction next * correction next * update script for jquery * update part jquery in the devtools * Remove jQuery check from handleResult
24 lines
435 B
JavaScript
24 lines
435 B
JavaScript
|
|
/**
|
|
When we receive the message, execute the given script in the given
|
|
tab.
|
|
*/
|
|
function handleMessage(request, sender, sendResponse) {
|
|
|
|
if (sender.url != browser.runtime.getURL("/devtools/panel/panel.html")) {
|
|
return;
|
|
}
|
|
|
|
browser.tabs.executeScript(
|
|
request.tabId,
|
|
{
|
|
code: request.script
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
Listen for messages from our devtools panel.
|
|
*/
|
|
browser.runtime.onMessage.addListener(handleMessage);
|