mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1232782 - Convert JS callsites to use open2 within intl/ (r=sicking)
This commit is contained in:
parent
5b44277caf
commit
f631460d98
@ -12,7 +12,7 @@
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
const test = [
|
||||
// 0: Valid surrogate pair
|
||||
@ -75,16 +75,8 @@ const ios = new IOService();
|
||||
function testCase(testText, expectedText, bufferLength, charset)
|
||||
{
|
||||
var dataURI = "data:text/plain;charset=" + charset + "," + testText;
|
||||
|
||||
var channel = ios.newChannel2(dataURI,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var testInputStream = channel.open();
|
||||
var channel = NetUtil.newChannel({uri: dataURI, loadUsingSystemPrincipal: true});
|
||||
var testInputStream = channel.open2();
|
||||
var testConverter = new ConverterInputStream(testInputStream,
|
||||
charset,
|
||||
bufferLength,
|
||||
|
@ -14,7 +14,7 @@
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
const beBOM="%FE%FF";
|
||||
const leBOM="%FF%FE";
|
||||
@ -40,23 +40,13 @@ function testCase(withBOM, charset, charsetDec, decoder, bufferLength)
|
||||
var dataURI = "data:text/plain;charset=" + charsetDec + "," +
|
||||
makeText(withBOM, charset);
|
||||
|
||||
var IOService = Components.Constructor("@mozilla.org/network/io-service;1",
|
||||
"nsIIOService");
|
||||
var ConverterInputStream =
|
||||
Components.Constructor("@mozilla.org/intl/converter-input-stream;1",
|
||||
"nsIConverterInputStream",
|
||||
"init");
|
||||
|
||||
var ios = new IOService();
|
||||
var channel = ios.newChannel2(dataURI,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var testInputStream = channel.open();
|
||||
var channel = NetUtil.newChannel({uri: dataURI, loadUsingSystemPrincipal: true});
|
||||
var testInputStream = channel.open2();
|
||||
var testConverter = new ConverterInputStream(testInputStream,
|
||||
decoder,
|
||||
bufferLength,
|
||||
|
@ -7,7 +7,7 @@
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
const test = [
|
||||
// 0: 0x8e followed by hi byte, not valid JIS X 0201
|
||||
@ -27,27 +27,16 @@ const test = [
|
||||
// expected: one replacement character, invalid byte not eaten
|
||||
"abcdefghijklmnopqrstuvwxyz12test03\uFFFDfoobar"]];
|
||||
|
||||
const IOService = Components.Constructor("@mozilla.org/network/io-service;1",
|
||||
"nsIIOService");
|
||||
const ConverterInputStream =
|
||||
Components.Constructor("@mozilla.org/intl/converter-input-stream;1",
|
||||
"nsIConverterInputStream",
|
||||
"init");
|
||||
const ios = new IOService();
|
||||
|
||||
function testCase(testText, expectedText, bufferLength, charset)
|
||||
{
|
||||
var dataURI = "data:text/plain;charset=" + charset + "," + testText;
|
||||
|
||||
var channel = ios.newChannel2(dataURI,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var testInputStream = channel.open();
|
||||
var channel = NetUtil.newChannel({uri: dataURI, loadUsingSystemPrincipal: true});
|
||||
var testInputStream = channel.open2();
|
||||
var testConverter = new ConverterInputStream(testInputStream,
|
||||
charset,
|
||||
bufferLength,
|
||||
|
@ -4,7 +4,7 @@ var Cc = Components.Constructor;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
const tests = [
|
||||
{ inStrings: ["%80", // Illegal or incomplete sequences
|
||||
@ -98,23 +98,12 @@ function testCaseInputStream(inStr, expected)
|
||||
var dataURI = "data:text/plain; charset=UTF-8,ABC" + inStr + "XYZ"
|
||||
dump(inStr + "==>");
|
||||
|
||||
var IOService = Cc("@mozilla.org/network/io-service;1",
|
||||
"nsIIOService");
|
||||
var ConverterInputStream =
|
||||
Cc("@mozilla.org/intl/converter-input-stream;1",
|
||||
"nsIConverterInputStream",
|
||||
"init");
|
||||
|
||||
var ios = new IOService();
|
||||
var channel = ios.newChannel2(dataURI,
|
||||
"",
|
||||
null,
|
||||
null, // aLoadingNode
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null, // aTriggeringPrincipal
|
||||
Ci.nsILoadInfo.SEC_NORMAL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
var testInputStream = channel.open();
|
||||
var channel = NetUtil.newChannel({uri: dataURI, loadUsingSystemPrincipal: true});
|
||||
var testInputStream = channel.open2();
|
||||
var testConverter = new ConverterInputStream(testInputStream,
|
||||
"UTF-8",
|
||||
16,
|
||||
|
Loading…
Reference in New Issue
Block a user