diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-08-02 21:51:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-02 21:51:51 -0400 |
commit | b253cdc92e38e960a6256f8aad730624c37d2a1b (patch) | |
tree | 9709cc6ad507e4f2000c9c3bef2e8c15fe7ad2c2 /ext/mixed | |
parent | a81d69d6c12a383664a92acb40c1c365b2425ca5 (diff) |
Fix extension unload cases (#712)
* Add _invokeSafe function to silently ignore extension unload errors
* Remove "Api" from function names
* Add invokeSafe to Popup
* Don't redundantly set content type to 'unloaded'
Diffstat (limited to 'ext/mixed')
-rw-r--r-- | ext/mixed/js/display.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index d1f92722..93272666 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -69,6 +69,7 @@ class Display extends EventDispatcher { this._historyChangeIgnore = false; this._historyHasChanged = false; this._navigationHeader = document.querySelector('#navigation-header'); + this._contentType = 'clear'; this._defaultTitle = 'Yomichan Search'; this._defaultTitleMaxLength = 1000; this._fullQuery = ''; @@ -393,6 +394,7 @@ class Display extends EventDispatcher { let asigned = false; const eventArgs = {type, urlSearchParams, token}; this._historyHasChanged = true; + this._contentType = type; this._mediaLoader.unloadAll(); switch (type) { case 'terms': @@ -416,8 +418,10 @@ class Display extends EventDispatcher { const stale = (this._setContentToken !== token); if (!stale) { if (!asigned) { + type = 'clear'; + this._contentType = type; const {content} = this._history; - eventArgs.type = 'clear'; + eventArgs.type = type; eventArgs.content = content; this.trigger('contentUpdating', eventArgs); this._clearContent(); @@ -451,10 +455,12 @@ class Display extends EventDispatcher { } _onExtensionUnloaded() { + const type = 'unloaded'; + if (this._contentType === type) { return; } const details = { focus: false, history: false, - params: {type: 'unloaded'}, + params: {type}, state: {}, content: {} }; |