port onDisconnect event is not fired when the tab is closed

Fixed Issue #9182205

Details

Author
Antanas
Created
Oct 4, 2016
Privacy
This issue is public.
Found in
  • Microsoft Edge
Reports
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce

  1. Create simple extension:
{
  "manifest_version": 2,
  "name": "onDisconnect bug example",
  "author": "sepikas.antanas@gmail.com",
  "version": "0.1",
  "content_scripts": [{
    "all_frames": true,
    "matches": ["http://*/*","https://*/*"],
    "js": ["content.js"],
    "run_at": "document_start"
  }],
  "background": {
    "persistent": true,
    "scripts": ["background.js"]
  },
  "permissions": [
    "<all_urls>",
    "tabs",
    "http://*/*",
    "https://*/*",
    "activeTab"
  ]
}
  1. Create connection from content.js to background.s
var port = browser.runtime.connect({
    name: "connectionName"
});
  1. Add connection listener in background.js
browser.runtime.onConnect.addListener(function (port) {
    console.log("connected port:", port);
    port.onDisconnect.addListener(function (port) {
        console.log("disconnected port:", port);
    });
});
  1. Open extension background debug window.
  2. Open new tab with regular webpage e.g. facebook.com
  3. See message “connected port:” [object] in background debug console.
  4. Close facebook tab.
  5. There should be console message “disconnected port:” [object] but there isn’t.

PS. Also when connected port sender object doesn’t have frameId property.

Attachments

Comments and activity

  • Microsoft Edge Team

    Changed Assigned To to “Brad E.”

    Changed Assigned To from “Brad E.” to “Akshay P.”

    Changed Assigned To from “Akshay P.” to “Arif S.”

    Changed Status to “Confirmed”

    Changed Title from “port onDisconnect event” to “port onDisconnect event is not fired when the tab is closed”

    Changed Status from “Confirmed” to “In code review”

    Changed Status from “In code review” to “Fixed”

    Changed Assigned To to “Akshay P.”

    Changed Assigned To from “Akshay P.” to “Snehita P.”

You need to sign in to your Microsoft account to add a comment.

Sign in