Closed Bug 1263099 Opened 8 years ago Closed 8 years ago

The notification bar is seen, but it soon disappears

Categories

(Firefox :: Tabbed Browser, defect)

Unspecified
Windows
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: janekptacijarabaci, Unassigned)

References

Details

(Keywords: addon-compat, regression)

Attachments

(1 file)

User Agent: Opera/9.80 (Windows NT 6.1; WOW64) Presto/2.12.388 Version/12.18

Steps to reproduce:

Steps to reproduce:

1) Open Scratchpad

2) Menu: "Environment-Browser"

3) Insert the code:

  var timeout = null;
  if (confirm("Timeout?")) {
    timeout = 1000;
  }

  var tabBrowser = gBrowser.selectedBrowser.getTabBrowser();

  var tab = tabBrowser.addTab("chrome://global-platform/locale/accessible.properties");
  tabBrowser.selectedTab = tab;

  function addNotification() {
    tab.removeEventListener("load", addNotification, true);
    var notificationBox = tabBrowser.getNotificationBox(tab.linkedBrowser);
    var notificationStr = 'notificationBox.appendNotification(' +
        '"Hi",' +
        '"notification",' +
        '"chrome://global/skin/icons/warning-64.png",' +
        'notificationBox.PRIORITY_WARNING_MEDIUM,' +
        '[{' +
          '"label": "Hi!",' +
          '"accessKey": null,' +
          '"popup": null,' +
          '"callback": null' +
        '}]' +
      ');';
    if (!timeout) {
      eval(notificationStr);
    } else {
      setTimeout(function () {
        eval(notificationStr);
      }, timeout);
    }
  }
  tab.addEventListener("load", addNotification, true);

4) Run

5) The result:

Timeout - disabled:
The notification bar is seen, but it soon disappears.

Timeout (long enough) - enabled:
The notification bar is seen.

----------

Confirmed on:
Windows 7/8.1/10
Firefox Nightly 48.0a1 (2016-04-07)
https://hg.mozilla.org/mozilla-central/rev/b6683e141c47c022598c0caac3ea8ba8c6236d42

Not confirmed on:
Ubuntu 15.10
(i.e. Firefox Nightly 48.0a1 (2016-04-07))

Last good: Firefox 29.0 Beta 1
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0
Built from https://hg.mozilla.org/releases/mozilla-beta/rev/904eb7fb178c

First bad: Firefox 29.0 Beta 2
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0
Built from https://hg.mozilla.org/releases/mozilla-beta/rev/fceb90d30601

Pushlog
http://hg.mozilla.org/releases/mozilla-beta/pushloghtml?fromchange=904eb7fb178c&tochange=fceb90d30601

Bug 982993 is the suspect (maybe).

----------

See also https://github.com/greasemonkey/greasemonkey/issues/2348

Thank you in advance for solving the problem.
Has Regression Range: --- → yes
Has STR: --- → yes
Keywords: addon-compat
OS: Unspecified → Windows
I can't reproduce it with FF48, the notification bar appears and doesn't disappear, I need to click on the X cross to close it.
Attached image A sample
The attachment is a sample (the animated GIF).
In this case the windows 8.1.
I got a different regression range:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=5c0673441fc8&tochange=140ac04d7454

Alice, any idea of the regressing bug?
Flags: needinfo?(alice0775)
Pushlog:
https://hg.mozilla.org/integration/fx-team/pushloghtml?fromchange=907cacf958de&tochange=4e685cd530ac

Regressed by: f4ce22b60a18	Philipp Sackl — Bug 979938 - Delay the display of the tab close button to avoid visual noise. r=Dao
Blocks: 979938
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(alice0775)
Keywords: regression
And confirm that the followinfg CSS fixes the problem

.tab-close-button
{
visibility: visible;
transition: none;
}
.tab-close-button:not([fadein]):not([pinned])
{
display: none;
}
Component: Themes → Tabbed Browser
Product: Toolkit → Firefox
Flags: needinfo?(philipp)
(In reply to Alice0775 White from comment #5)
> And confirm that the followinfg CSS fixes the problem
> 
> .tab-close-button
> {
> visibility: visible;
> transition: none;
> }
> .tab-close-button:not([fadein]):not([pinned])
> {
> display: none;
> }

But... after following change:

From:
var tab = tabBrowser.addTab("chrome://global-platform/locale/accessible.properties");

To:
var tab = tabBrowser.addTab("https://raw.githubusercontent.com/anonim1133/wykop-userjs/a86014414395f71e2b9f930cf8ec876374808c24/wykop-zawijas.user.js");

...it does not work.
(In reply to janekptacijarabaci from comment #0)
>   var tabBrowser = gBrowser.selectedBrowser.getTabBrowser();
> 
>   var tab =
> tabBrowser.addTab("chrome://global-platform/locale/accessible.properties");

>   tab.addEventListener("load", addNotification, true);

http://www.gijsk.com/blog/2013/05/you-dont-know-what-youve-got-till-its-gone-or-tab-load-detection-gone-wrong/

It's not often that I can refer to my own blogpost in terms of why something isn't a bug...

You're adding an event listener for the "load" event on a <tab> element. That has nothing to do with the load of the actual web page. The <notification> you're adding is effectively just racing with the page load, because we hide notifications when the loaded page changes, which explains the behaviour you're seeing.

You can fix this by waiting for the page load "properly", or by setting the persistence (cf. https://dxr.mozilla.org/mozilla-central/rev/d62963756d9a9d19cbbb5d8f3dd3c7cfa8fdef88/browser/base/content/browser.js#2935 )  or timeout (cf. https://dxr.mozilla.org/mozilla-central/rev/d62963756d9a9d19cbbb5d8f3dd3c7cfa8fdef88/browser/base/content/browser-addons.js#597 ) properties.

As it is, this isn't a bug, so I'm resolving this as invalid.
Status: NEW → RESOLVED
Closed: 8 years ago
Flags: needinfo?(philipp)
Resolution: --- → INVALID
(In reply to :Gijs Kruitbosch from comment #7)
> 
> You can fix this by waiting for the page load "properly", or by setting the
> persistence (cf.
> https://dxr.mozilla.org/mozilla-central/rev/
> d62963756d9a9d19cbbb5d8f3dd3c7cfa8fdef88/browser/base/content/browser.
> js#2935 )  or timeout (cf.
> https://dxr.mozilla.org/mozilla-central/rev/
> d62963756d9a9d19cbbb5d8f3dd3c7cfa8fdef88/browser/base/content/browser-addons.
> js#597 ) properties.

Thank you :-)

Ad "tab.linkedBrowser.addEventListener":
However, doesn't work when e10 is enabled.

Maybe it's a bug in Firefox?

See also: https://groups.google.com/forum/#!topic/mozilla.dev.tech.electrolysis/OnAJIhSyWNQ
(In reply to janekptacijarabaci from comment #8)
> Ad "tab.linkedBrowser.addEventListener":
> However, doesn't work when e10 is enabled.

Yes, that sounds like the expected result.

> Maybe it's a bug in Firefox?

I don't think so. Or at least, it depends - is your add-on using shims? Scratchpad probably isn't, so there might be a behavioural difference there. See also this blogpost: https://blog.mozilla.org/addons/2016/04/11/the-why-of-electrolysis/ .
(In reply to :Gijs Kruitbosch from comment #9)
> Is your add-on using shims?

No.

Ad "tab.linkedBrowser.addEventListener"...
This is used in many places in Firefox source code and I think it works well in this case... (but, most of the files are tests).
(In reply to janekptacijarabaci from comment #10)
> (In reply to :Gijs Kruitbosch from comment #9)
> > Is your add-on using shims?
> 
> No.
> 
> Ad "tab.linkedBrowser.addEventListener"...
> This is used in many places in Firefox source code and I think it works well
> in this case... (but, most of the files are tests).

All the tests use shims, so that explains why it works there.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: