Detect page load in active/foreground tab with e10s

Discuss building things with or for the Mozilla Platform.
Posts: 44
Joined: March 6th, 2013, 7:47 pm

Post Posted March 25th, 2015, 5:51 am

Hi all,

I need to detect whenever a page in a active/foreground tab is loaded. In principle it works with something along the lines of
Code: Select all
function onPageLoad(event) {
   // check if the event was dispatched from a background tab
   if ( != window.gBrowser.selectedBrowser.contentDocument)

   // otherwise do something

window.gBrowser.addEventListener("DOMContentLoaded", onPageLoad, false);

So far so good BUT I need to do this in a restartless extension in e10s Firefox (in other words in bloody hell!)

Does anyone know how to do that? With above code I'm already facing two problems:
  1. If e10s is enabled, the listener for "DOMContentLoaded" does not work directly after installing the extension - a restart is required.
  2. The condition to check if the event target is the contentDocument of the currently selected Browser does not work. There are two issues I faced with all variations I tried so far: Either a) The check works, but I get an "unsafe CPOW" warning because I'm accessing the content document from my add-ons chrome environment, or b) The check always evaluates to "false" with e10s enabled because different objects are compared (that would be equal with e10s disabled though).

Any idea on how to do this? I'm also open to different approaches, we don't have to stick to my example above...

Posts: 44
Joined: March 6th, 2013, 7:47 pm

Post Posted March 25th, 2015, 5:53 am

Sorry, wrong forum, correct thread is here:


User avatar
Posts: 38051
Joined: October 19th, 2007, 1:53 am
Location: The South Coast of N.S.W. Oz.

Post Posted March 25th, 2015, 6:24 am

Duplicate, X post, locking. Continue the discussion here: viewtopic.php?f=19&t=2923745
Ancient Amateur Astronomer
Win-7-HP/IntelĀ® DualCore-2.0GHz/500G HDD/4 Gig Ram/550Watt PSU/350WattUPS/Firefox-20.0-57.0/T-bird-
RadioYachting. (Always choose the "Custom" Install.)

Return to Mozilla Development

Who is online

Users browsing this forum: No registered users and 1 guest