From 85437661bf02cf509cdc7fa6858c7bfb282378c5 Mon Sep 17 00:00:00 2001 From: gorhill Date: Wed, 22 Oct 2014 10:25:57 -0400 Subject: [PATCH] bring back behind-the-scene matrix --- src/js/dashboard-common.js | 2 +- src/js/messaging-handlers.js | 19 ++++++++++--------- src/js/popup.js | 7 +++++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/js/dashboard-common.js b/src/js/dashboard-common.js index 3ce4b1d..95c99fa 100644 --- a/src/js/dashboard-common.js +++ b/src/js/dashboard-common.js @@ -30,7 +30,7 @@ uDom('a').attr('target', '_blank'); uDom('a[href*="dashboard.html"]').attr('target', '_parent'); uDom('.whatisthis').on('click', function() { uDom(this).parent() - .find('.whatisthis-expandable') + .descendants('.whatisthis-expandable') .toggleClass('whatisthis-expanded'); }); diff --git a/src/js/messaging-handlers.js b/src/js/messaging-handlers.js index f8fb5ab..0a725a3 100644 --- a/src/js/messaging-handlers.js +++ b/src/js/messaging-handlers.js @@ -86,16 +86,17 @@ var matrixSnapshot = function(details) { popupScopeLevel: µmuser.popupScopeLevel } }; -/* - // Allow to scope on behind-the-scene virtual tab - if ( tab.url.indexOf('chrome-extension://' + chrome.runtime.id + '/') === 0 ) { - targetTabId = µm.behindTheSceneTabId; - targetPageURL = µm.behindTheSceneURL; - } else { - targetTabId = tab.id; - targetPageURL = µm.pageUrlFromTabId(targetTabId); + + // Allow examination of behind-the-scene requests + // TODO: Not portable + if ( details.tabURL ) { + if ( details.tabURL.indexOf('chrome-extension://' + chrome.runtime.id + '/') === 0 ) { + details.tabId = µm.behindTheSceneTabId; + } else if ( details.tabURL === µm.behindTheSceneURL ) { + details.tabId = µm.behindTheSceneTabId; + } } -*/ + var pageStore = µm.pageStatsFromTabId(details.tabId); if ( !pageStore ) { return r; diff --git a/src/js/popup.js b/src/js/popup.js index e440f79..ef42e90 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -1059,13 +1059,16 @@ var onMatrixSnapshotReady = function(response) { var queryMatrixSnapshot = function(callback) { var request = { what: 'matrixSnapshot', - tabId: targetTabId + tabId: targetTabId, + tabURL: matrixSnapshot.url }; var onTabsReceived = function(tabs) { if ( tabs.length === 0 ) { return; } - request.tabId = targetTabId = tabs[0].id; + var tab = tabs[0]; + request.tabId = targetTabId = tab.id; + request.tabURL = tab.url; messaging.ask(request, callback); }; if ( targetTabId === undefined ) {