Skip to content
This repository was archived by the owner on Oct 11, 2020. It is now read-only.

Commit 106f642

Browse files
authored
Edge reload compatibility improvements and fixes
1 parent d6a44bc commit 106f642

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

platform/edge/vapi-background.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -593,16 +593,15 @@ vAPI.tabs.reload = function(tabId /*, flags*/) {
593593
return;
594594
}
595595

596-
var onReloaded = function() {
597-
// https://code.google.com/p/chromium/issues/detail?id=410868#c8
598-
if ( browser.runtime.lastError ) {
596+
// Workaround for Edge tab reloading
597+
// see: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs/reload#Browser_compatibility
598+
browser.tabs.get(tabId, function(tab){
599+
if (browser.tabs.lastError || !tab) {
599600
/* noop */
601+
return;
600602
}
601-
};
602-
603-
// Workaround for Edge tab reloading
604-
tabUrl = browser.tabs.get(tabId).url;
605-
browser.tabs.update(tabId, {active: true, url: tabUrl}, onReloaded);
603+
vAPI.tabs.replace(tabId, tab.url);
604+
});
606605
};
607606

608607
/******************************************************************************/

0 commit comments

Comments
 (0)