문제

I have a formData object and would like to pass it to loadOneTab()

Example:

var formData = Components.classes['@mozilla.org/files/formdata;1']
                .createInstance(Components.interfaces.nsIDOMFormData);
formData.append('Content-Type', 'multipart/form-data');
formData.append('filename', '');
formData.append('image_url', URL);

How can I pass above object to postData

window.gBrowser.loadOneTab('https://www.example.com/',
    {inBackground: false, postData: postStream});
도움이 되었습니까?

해결책

I already kinda answered this as part of your last question.

Unfortunately we cannot use FormData here, as there is currently no way to get the stream (and other information) from a FormData instance (nsIXHRSendable is not scriptable, unfortunately). postData however expects the value to be an nsIInputStream instance.

So there is no way to use FormData in conjunction with loadOneTab and friends (essentially all <tabbrowser> and <browser> methods expect a stream if they accept a postData argument).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top