Giter Site home page Giter Site logo

Comments (6)

Lej77 avatar Lej77 commented on May 27, 2024 1

This bug seems to be introduced in version 3.9.16 since version 3.9.15 works without issues. The issue seems to be when a helper addon is listening to Tree Style Tab mouse events in a private window. This means that the helper addon must be allowed in TST option page so that it Notify Messages from Private Windows. Clicking on a tab that uses an inbult favicon (such as a new tab or the about:addons tab) will cause TST to encounter an error and no message will be sent to the helper addon. The clicked tab will also not be selected (same as if the addon returned Promise.resolve(true) even though that isn't what happened).

The error that is logged in TST is:

Uncaught (in promise) Error: Failed to open database
    onerror moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/TabFavIconHelper.js:154
    _openDB moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/TabFavIconHelper.js:153
    _openDB moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/TabFavIconHelper.js:150
    _getAssociatedFavIconUrlFromTabUrl moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/TabFavIconHelper.js:228
    _getAssociatedFavIconUrlFromTabUrl moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/TabFavIconHelper.js:227
    _getEffectiveFavIconURL moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/TabFavIconHelper.js:522
    _getEffectiveFavIconURL moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/TabFavIconHelper.js:470
    loadToImage moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/TabFavIconHelper.js:398
    processOneTask moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/TabFavIconHelper.js:387
    _run moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/TabFavIconHelper.js:392
    _addTask moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/TabFavIconHelper.js:373
    loadToImage moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/TabFavIconHelper.js:397
    set favIconUrl moz-extension://a96451a8-a49a-446e-8618-196a10143caa/sidebar/components/TabElement.js:613
    _updateTabProperties moz-extension://a96451a8-a49a-446e-8618-196a10143caa/sidebar/components/TabElement.js:529
    update moz-extension://a96451a8-a49a-446e-8618-196a10143caa/sidebar/components/TabElement.js:324
    connectedCallback moz-extension://a96451a8-a49a-446e-8618-196a10143caa/sidebar/components/TabElement.js:164
    <anonymous> moz-extension://a96451a8-a49a-446e-8618-196a10143caa/sidebar/sidebar-tabs.js:284
    dispatchWithDetails moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/EventListenerManager.js:64
    dispatch moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/EventListenerManager.js:43
    init moz-extension://a96451a8-a49a-446e-8618-196a10143caa/common/Tab.js:1726
    <anonymous> moz-extension://a96451a8-a49a-446e-8618-196a10143caa/sidebar/sidebar-tabs.js:542
    dispatchWithDetails moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/EventListenerManager.js:64
    dispatch moz-extension://a96451a8-a49a-446e-8618-196a10143caa/extlib/EventListenerManager.js:43
    onConnectionMessage moz-extension://a96451a8-a49a-446e-8618-196a10143caa/sidebar/background-connection.js:127
    onConnectionMessage moz-extension://a96451a8-a49a-446e-8618-196a10143caa/sidebar/background-connection.js:113
TabFavIconHelper.js:154:16

Below is the helper addon I used to test this issue:

Example TST helper addon

manifest.json

{
  "manifest_version": 2,
  "name": "Log TST Mouse Events",
  "version": "1.0",
  "permissions": [],
  "background": {
    "scripts": [
      "background.js"
    ]
  }
}

background.js

function getFormattedTime() {
  let time = Date.now();
  return '' +
    Math.trunc(time / (1000 * 60 * 60 * 24)) +
    ' days ' +
    Math.trunc(time / (1000 * 60 * 60) % 24).toString().padStart(2, '0') +
    ':' +
    Math.trunc(time / (1000 * 60) % 60).toString().padStart(2, '0') +
    ':' +
    Math.trunc(time / (1000) % 60).toString().padStart(2, '0') +
    ',' +
    Math.trunc(time % 1000).toString().padStart(3, '0');
}

const TST_ID = '[email protected]';

async function registerToTST() {
  try {
    await browser.runtime.sendMessage(TST_ID, {
      type: 'register-self',
      // The name of your addon (string, optional)
      name: browser.runtime.getManifest().name,
      // The list of listening message types (array of string)
      listeningTypes: ['tab-clicked', 'tab-dblclicked', 'tab-mousedown', 'tab-mouseup'],
      permissions: []
    });
  }
  catch (e) {
    // TST is not available
  }
}

async function start() {
  browser.runtime.onMessageExternal.addListener((message, sender) => {
    switch (sender.id) {
      case TST_ID:
        console.log(
          `TST Event "${message.type}"!\n`,
          message,
          "\nTime: " + getFormattedTime(),
        );
        switch (message.type) {
          case 'tab-clicked':
            return Promise.resolve(false);
        }
        break;
    }
  });
  registerToTST();
};
start();

from treestyletab.

LupinIII avatar LupinIII commented on May 27, 2024

Thanks for the detailed analysis! Due to that I now also found what's common to the tabs that break TST: it's those that do not have a favicon.

To test: in a private window search for anything on google and on the result page open any image in a new tab (by right clicking -> "show image in new tab"). It doesn't have to be an image search, the "favicons" that google shows in front of every result work as well. This should create a tab without a favicon and break TST. (on google the images seem to be either inline base64 encoded "data:" images or are served by gstatic.com, which does not have a favicon).

Maybe related as well, now that I think of it: even in a non-private window TST extensions like "hoverswitch" and "mouse wheel" aren't responsive, if you just opened a few tabs to different sites (e. g. by middle clicking a list of links in search results). While some of those tabs are still loading hoverswitch and mouse wheel don't work for a short time (a second or two). It is hard to test for me, but could the "lag" happen while those tabs are still trying to load the favicon? The difference to a private window being that a missing favicon does not "perma-break" TST.

from treestyletab.

irvinm avatar irvinm commented on May 27, 2024

@piroor, I just wanted to make sure you saw this one. Still has the "needs-triage" tag.

from treestyletab.

joshuacant avatar joshuacant commented on May 27, 2024

Hi, I'm the TST Mouse Wheel dev. I started noticing this in my own use, but didn't have time to look into it until this week. I got about 30 minutes into trying to figure it out when I had the bright idea to search the issues here and see if anyone else had run into the problem, since no issues were filed in my repo.

Thank you both for saving me a lot of time trying to chase this down. I'm sure @piroor will fix this one when he gets a chance. 😄

from treestyletab.

piroor avatar piroor commented on May 27, 2024

Sorry for my silence. I missed that the IndexedDB API is unavailable on private windows. I've introduced some changes to bypass IndexedDB-dependent operations on private windows. The error @Lej77 investigated won't raised anymore so I hope the change solve problems around helper addons and private windows successfully.

from treestyletab.

github-actions avatar github-actions commented on May 27, 2024

This issue has been closed due to no response within 14 days after labeled as "maybe fixed", 7 days after last reopened, and 7 days after last commented.

from treestyletab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.