Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Firefox support #2

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Binary file added postmessage_tracker-1.0.1-fx.xpi
Binary file not shown.
8 changes: 1 addition & 7 deletions chrome/background.js → src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,4 @@ chrome.tabs.onActivated.addListener(function(activeInfo) {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
selectedId = tabs[0].id;
refreshCount();
});

chrome.extension.onConnect.addListener(function(port) {
port.onMessage.addListener(function(msg) {
port.postMessage({listeners:tab_listeners});
});
})
});
8 changes: 4 additions & 4 deletions chrome/content_script.js → src/content_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ var injectedJS = function(pushstate, addeventlistener) {
});
var c = function(listener) {
var listener_str = listener.toString()
if(listener_str.match(/\.deep.*apply.*captureException/s)) return 'raven';
else if(listener_str.match(/arguments.*(start|typeof).*err.*finally.*end/s) && listener["nr@original"] && typeof listener["nr@original"] == "function") return 'newrelic';
else if(listener_str.match(/rollbarContext.*rollbarWrappedError/s) && listener._isWrap &&
if(listener_str.match(/\.deep[^\x05]*apply[^\x05]*captureException/)) return 'raven';
else if(listener_str.match(/arguments[^\x05]*(start|typeof)[^\x05]*err[^\x05]*finally[^\x05]*end/) && listener["nr@original"] && typeof listener["nr@original"] == "function") return 'newrelic';
else if(listener_str.match(/rollbarContext[^\x05]*rollbarWrappedError/) && listener._isWrap &&
(typeof listener._wrapped == "function" || typeof listener._rollbar_wrapped == "function")) return 'rollbar';
else if(listener_str.match(/autoNotify.*(unhandledException|notifyException)/s) && typeof listener.bugsnag == "function") return 'bugsnag';
else if(listener_str.match(/autoNotify[^\x05]*(unhandledException|notifyException)/) && typeof listener.bugsnag == "function") return 'bugsnag';
return false;
}

Expand Down
10 changes: 8 additions & 2 deletions chrome/manifest.json → src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
"manifest_version": 2,
"name": "postMessage-tracker",
"description": "Monitors and indicates postMessage-listeners in the current window.",
"version": "1.0.0",
"version": "1.0.1",
"browser_specific_settings": {
"gecko": {
"id": "[email protected]",
"strict_min_version": "57.0"
}
},
"background": {
"scripts": [
"background.js"
Expand Down Expand Up @@ -33,4 +39,4 @@
"http:\/\/*\/",
"https:\/\/*\/"
]
}
}
1 change: 1 addition & 0 deletions chrome/options.html → src/options.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head></head>
<body>
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions chrome/popup.html → src/popup.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<script type="text/javascript" src="popup.js"></script>
Expand Down
22 changes: 5 additions & 17 deletions chrome/popup.js → src/popup.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
var port = chrome.extension.connect({
name: "Sample Communication"
});


function loaded() {
port.postMessage("get-stuff");
port.onMessage.addListener(function(msg) {
console.log("message recieved yea: ", msg);
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
selectedId = tabs[0].id;
listListeners(msg.listeners[selectedId]);
});
chrome.runtime.getBackgroundPage(function (page) {
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
selectedId = tabs[0].id;
listListeners(page.tab_listeners[selectedId]);
});
}

window.onload = loaded
//addEventListener('DOMContentLoaded', loaded);
});

function listListeners(listeners) {
var x = document.getElementById('x');
Expand Down