如何将formData传递到loadOneTab中的postData? [英] How to pass formData to postData in loadOneTab?

查看:137
本文介绍了如何将formData传递到loadOneTab中的postData?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 formData 对象,并希望将它传递给 loadOneTab()



示例:

  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);

如何将上述对象传递给 postData

  window.gBrowser.loadOneTab('https://www.example.com/',
{inBackground: false,postData:postStream});


解决方案

我已经有点回答这是你最后一个问题的一部分了。



不幸的是我们不能使用 FormData 在这里,因为目前还没有办法从FormData实例( nsixHRSendable 不能脚本化)获取流(和其他信息) 。但是预计该值为 nsIInputStream 实例。



<所以没有办法使用 FormData loadOneTab 和好友(基本上所有的< tabbrowser> < browser> 方法如果接受 postData 参数)。


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).

这篇关于如何将formData传递到loadOneTab中的postData?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆