Addon button click for server redirection not working in FF45

Hi In my addon there is a button which on click would redirect to Server.
But the Javascript code getWebNavigation().loadURI is not working in FireFox 46.
The same code works in old version of FireFox
Here is the code snippet.

		var postData = Components.classes["@mozilla.org/io/string-input-stream;1"].createInstance(Components.interfaces.nsIStringInputStream);
		postData.setData(sPost, sPost.length);
		var mimeStream = Components.classes["@mozilla.org/network/mime-input-stream;1"].createInstance(Components.interfaces.nsIMIMEInputStream);
		mimeStream.setData(postData);
		mimeStream.addHeader("Content-Type", "application/x-www-form-urlencoded");
		mimeStream.addHeader("Content-Length", sPost.length);
		getWebNavigation().loadURI (sAddr, 
			nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY | nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY,
			null,
			mimeStream,
			null);

Have you checked the docs? Shouldn’t the post data and headers be passed separately?

Hi

I am doing the same way with Firefox 43 and it works.
Please let me know what needs to be changed to make this work.
Do you mean to say Mimestream should not contain postData?

It crashes in loadURI method.
The same loadURI works in lower version of FireFox namely 43

getWebNavigation().loadURI (sAddr,
nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY | nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY,
null,
mimeStream,
null);

What do you mean by crashes? Does the browser crash, or do you get a console error?

No console error or no browser crash.
I have put an alert statement after loadURI which does not get executed.

I tried looking at the source for that function, but I don’t see any difference between 45 and 46.