pageMod worker tab becomes false, tab.id = undefined

RESOLVED INCOMPLETE

Status

Add-on SDK
General
RESOLVED INCOMPLETE
2 years ago
5 months ago

People

(Reporter: tim, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

2 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36

Steps to reproduce:

create worker using pageMod, open up some pages, then drag out one of the pages

http://stackoverflow.com/questions/36190084/how-do-i-keep-track-of-workers-tabs-via-pagemod-or-worker-tab-lost


Actual results:

the worker corresponding to the dragged out page gets .tab = false, so that tab.id = undefined. This makes it not possible to find in an activeTabs search 


Expected results:

the worker gets an updated tab and tab.id
(Reporter)

Updated

2 years ago
(Reporter)

Updated

2 years ago
OS: Unspecified → Windows
Hardware: Unspecified → x86_64
(Reporter)

Comment 1

2 years ago
I have the same problem in nightly 48.0a1 (2016-03-16).

```
console.log: capturemoz: pipeWorker: waiting for connection...
console.log: capturemoz: pipeWorker: connected.
console.log: capturemoz: attaching pageWorker in tab.id -5-1
console.log: capturemoz: showing page in tab.id -5-1
console.log: capturemoz: attaching pageWorker in tab.id -5-2
console.log: capturemoz: showing page in tab.id -5-2
<at this point I drag out the window>
console.log: capturemoz: hiding page in tab.id undefined
console.log: capturemoz: showing page in tab.id undefined
```

tab.id is undefined, and tab = false

Comment 2

2 years ago
Any testcase?
Component: Activity Streams: General → DOM
Product: Firefox → Core
(Reporter)

Comment 3

2 years ago
Make a new jpm project, and replace index.js with this. Then make a blank worker.js. Use jpm run to start Firefox and go to Google in two tabs. Then drag out one of the tabs. https://github.com/tofutim/pagepulla


var self = require("sdk/self");
var pageMod = require("sdk/page-mod");

exports.main = function(options, callbacks) {
  pageMod.PageMod({
	  include: "*",
	  contentScriptWhen: "ready",
	  contentScriptFile: ["./worker.js"],
	//  attachTo: ["existing", "top"],
	  onAttach: function(pageWorker) {
			pageWorker.id = Date.now();
		  console.log('attaching pageWorker', pageWorker.id,'in tab.ids',pageWorker.tab.id);
			pageWorker.on('pageshow', function() {
				console.log('showing pageWorker', pageWorker.id,'in tab.ids',pageWorker.tab.id);
			});
			pageWorker.on('pagehide', function() {
				console.log('hiding pageWorker', pageWorker.id,'in tab.ids',pageWorker.tab.id);
			});
	    pageWorker.on('detach', function() {
				console.log('detaching pageWorker', pageWorker.id,'in tab.ids',pageWorker.tab.id);
	      detachPageWorker(pageWorker);
	    });
	  }
  });
}
(Reporter)

Comment 4

2 years ago
Thanks for taking a look Loic. I updated the github repo with photos. Pls take a look and let me know if you need anything else.
I don't think tab.id is a DOM thing (but I could be wrong).
Component: DOM → Tabbed Browser
Product: Core → Firefox

Updated

2 years ago
Component: Tabbed Browser → General
Product: Firefox → Add-on SDK
Version: 45 Branch → unspecified
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: UNCONFIRMED → RESOLVED
Last Resolved: 5 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.