Hi,
I have a WebExtension that uses chrome.windows.create() to open a window that displays a locally packaged HTML file. In the locally packaged HTML file I have an HTML that has method=“post”. The action posts to an external URL / another site which then processes the data and displays a small UI.
When I load in my WebExtension from my every-day FF profile using “Load temporary add-on” everything works great. The signed copy of my extension installed in my users’ browsers also works great. However, when I run my extension using web-ext (npm run web-ext -- run
) Firefox always sends a GET instead of a POST. This prevents me from using web-ext to develop my extension.
I have tried a bunch of different things and searched Google for answers but can not find anything related to FF converting an extension form POST to a GET. Here is a simplified version of my plugin code.
Background Script
var popupURL = chrome.extension.getURL('html/popup.html'),
activeTabId,
popup,
popupChannel;
function handleClick() {
chrome.tabs.query({
currentWindow: true,
active: true
}, function (tabs) {
if (tabs.length > 0) {
activeTabId = tabs[0].id;
chrome.windows.create({
url: popupURL,
type: 'normal',
height: 900,
width: 680
}, function (window) {
popup = window;
});
}
});
}
// [snip]
chrome.browserAction.onClicked.addListener(handleClick);
Locally Package popup.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<link rel="stylesheet" type="text/css" href="../css/popup.css"/>
</head>
<body>
<div id="main">
<form action="http://another.site.com/form-handler?page=page-N" method="post" name="pageDataForm" id="pageDataForm">
<input type="hidden" name="pageData" value="blahblahblah" />
<input type="submit" name="submit" value="submit"/>
</form>
</div>
</body>
</html>
When I click on the “Submit” button in the FF launched using web-ext and use the network browser, I see my form request sent using GET and not POST. But only in the browser launched using web-ext. I thought maybe it might have something to do with the CSP that the default profile is using or some other security restriction in the profile?
Additional Note:
I noticed if I create a brand new profile using ProfileManager, install my signed XPI production version of the plugin, the issue happens there as well - form POST sent as GET instead (with the POST body totally missing for obvious reasons).
Any help would really be appreciated.
Thanks,
Scott