Closed Bug 1259292 Opened 8 years ago Closed 7 years ago

pageMod worker tab becomes false, tab.id = undefined

Categories

(Add-on SDK Graveyard :: General, defect)

x86_64
Windows
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: tim, Unassigned)

References

()

Details

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
OS: Unspecified → Windows
Hardware: Unspecified → x86_64
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
Any testcase?
Component: Activity Streams: General → DOM
Product: Firefox → Core
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);
	    });
	  }
  });
}
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
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
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.