import from UXP: Issue #1134: Reinstate postDataString for about:home searches. (06634f64)

This commit is contained in:
2022-04-05 14:30:54 +08:00
parent 9b70831b31
commit 29dc7dd319
2 changed files with 15 additions and 3 deletions
+7 -1
View File
@@ -7,7 +7,7 @@
interface nsIURI;
interface nsIInputStream;
[scriptable, uuid(5799251f-5b55-4df7-a9e7-0c27812c469a)]
[scriptable, uuid(72599f7a-3712-4b93-90e9-86127006cd68)]
interface nsISearchSubmission : nsISupports
{
/**
@@ -20,6 +20,12 @@ interface nsISearchSubmission : nsISupports
* The URI to submit a search to.
*/
readonly attribute nsIURI uri;
/**
* The POST data associated with a search submission as an
* application/x-www-form-urlencoded string. May be null.
*/
readonly attribute AString postDataString;
};
[scriptable, uuid(620bd920-0491-48c8-99a8-d6047e64802d)]
+8 -2
View File
@@ -1146,6 +1146,7 @@ EngineURL.prototype = {
}
var postData = null;
let postDataString = null;
if (this.method == "GET") {
// GET method requests have no post data, and append the encoded
// query string to the url...
@@ -1153,6 +1154,7 @@ EngineURL.prototype = {
url += "?";
url += dataString;
} else if (this.method == "POST") {
postDataString = dataString;
// POST method requests must wrap the encoded text in a MIME
// stream and supply that as POSTDATA.
var stringStream = Cc["@mozilla.org/io/string-input-stream;1"].
@@ -1166,7 +1168,7 @@ EngineURL.prototype = {
postData.setData(stringStream);
}
return new Submission(makeURI(url), postData);
return new Submission(makeURI(url), postData, postDataString);
},
_getTermsParameterName: function SRCH_EURL__getTermsParameterName() {
@@ -2587,9 +2589,10 @@ Engine.prototype = {
};
// nsISearchSubmission
function Submission(aURI, aPostData = null) {
function Submission(aURI, aPostData = null, aPostDataString = null) {
this._uri = aURI;
this._postData = aPostData;
this._postDataString = aPostDataString;
}
Submission.prototype = {
get uri() {
@@ -2598,6 +2601,9 @@ Submission.prototype = {
get postData() {
return this._postData;
},
get postDataString() {
return this._postDataString;
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsISearchSubmission])
}