Question: I'm currently developing a chrome extension that is mainly driven by a JS application.
I'm able to send message between application and background page using long-lived connection until I reload the extension.
Once it's reloaded, there is no way to connect to it (either from a content script or from the JS code using the extension ID). It keeps saying "Attemptin to use a disconnected port object".
I tried switching to a one-time requests model, with no luck. After reloading the extension, the sendMessage callback is called without argument and the extension receives no message.
I followed hints in this solution :
[chrome.runtime.sendMessage throws exception from content script after reloading Chrome Extension](https://stackoverflow.com/questions/25840674/chrome-runtime-sendmessage-throws-exception-from-content-script-after-reloading)
But it doesn't change anything.

What am I missing on this ?

Edit:
-----

Here is how I set up the connection:

```
var port = chrome.runtime.connect()
// Then I use a DOM message to communicate with content-script :
window.addEventListener("message", function(message) {
    port.postMessage(message);
}

```

Answer: 
Because you're passing in a value of `null`.

If you want your varargs method to receive an empty array, either

1. pass that explicitly:

```
method(new Object(), new Object[0])

```
2. don't pass anything at all:

```
method(new Object())

```

Option 2 would be more idiomatic.
`null` is a value.

You provide a single value for the varargs argument, so the array will be `new Object[] { null }` which has a length of 1.

If you wanted to pass no values at all, you'd have to call `method(new Object());`.