Closed Bug 699450 Opened 13 years ago Closed 11 years ago

Exceptions are thrown when you use page-mod and tab.close()

Categories

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

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(1 file, 1 obsolete file)

Some issues weren't fixed in bug 676574 comment 12.
Thanks to riccardo's help, I've managed to identify two exception being thrown when you use tab.close() while having a page-mod instance running!

1/ When you call tab.close() multiple times, you get the following exception:
  TypeError: browser is null  from browser.js

2/ When you call worker.tab.close() multiple times, you get the following exception:
Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsIInterfaceRequestor.getInterface]"  nsresult: "0x80004002 (NS_NOINTERFACE)"  location: "JS frame :: resource://d535c5b8-4afd-4d29-a039-6f501b1146db-at-jetpack-api-utils-lib/cuddlefish.js -> resource://d535c5b8-4afd-4d29-a039-6f501b1146db-at-jetpack-api-utils-lib/tabs/tab.js :: <TOP_LEVEL> :: line 269

Both exceptions happen because tab's document is detach and we still attempt to do stuff with it.
Attached patch Avoid these exceptions (obsolete) — Splinter Review
Here is a patch to fix these exception, but I still have an issue.
I get some weird error on end of addon-kit tests execution:
2200 of 2200 tests passed.
error: An exception occurred.
Traceback (most recent call last):
  File "resource://2a9571f1-b38b-4212-86dd-9b22d785c427-at-jetpack-api-utils-lib
/tabs/tab.js", line 93, in destroy
    this._browser.removeEventListener(EVENTS.ready.dom, this._onReady,
TypeError: this._browser is null
Assignee: nobody → poirot.alex
Hum interesting! This exception already exists and is intermittent:
http://tinderbox.mozilla.org/showlog.cgi?log=Jetpack/1320375417.1320375713.22445.gz

info: executing 'test-private-browsing.testActivateDeactivate'
error: An exception occurred.
Traceback (most recent call last):
  File "resource://d96529e1-0589-448d-af84-17d622c38ca3-at-jetpack-api-utils-lib/tabs/tab.js", line 93, in destroy
    this._browser.removeEventListener(EVENTS.ready.dom, this._onReady,
NEXT ERROR TypeError: this._browser is null


But it may happen only when the following test failure, that happens before our exception:
info: executing 'test-windows.testActiveWindow'
info: pass: Correct number of browser windows
info: pass: Correct number of windows returned by iterator
NEXT ERROR console: [JavaScript Error: "nonBrowserWindow is null" {file: "resource://d96529e1-0589-448d-af84-17d622c38ca3-at-jetpack-api-utils-lib/cuddlefish.js -> resource://d96529e1-0589-448d-af84-17d622c38ca3-at-jetpack-addon-kit-tests/test-windows.js" line: 231}]
Attached file Pull request 1015
Here is an updated patch that doesn't seem to face the exception I was facing.
Attachment #571724 - Attachment is obsolete: true
Attachment #757437 - Flags: review?(evold)
Comment on attachment 757437 [details]
Pull request 1015

just a few nits
Attachment #757437 - Flags: review?(evold) → review+
Comment on attachment 757437 [details]
Pull request 1015

Erik, I made substantial modification to this patch, can you look at it again?
Attachment #757437 - Flags: review+ → review?(evold)
Attachment #757437 - Flags: review?(evold) → review+
Commits pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/928dfd3d28354a58ff2f16335235dd7061439f30
Bug 699450 - Exceptions are thrown when you use page-mod and tab.close()

https://github.com/mozilla/addon-sdk/commit/dc500961cd2b4156c31d66aa9ac331f9269e0e76
Merge pull request #1015 from ochameau/bug699450

Bug 699450 - Exceptions are thrown when you use page-mod and tab.close() r=@erikvold
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: