Bind chunk promises to avoid scope problems.
This commit is contained in:
parent
220c827e9e
commit
328cfd0246
@ -884,7 +884,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
case 'TJ':
|
case 'TJ':
|
||||||
var chunkPromise = new Promise();
|
var chunkPromise = new Promise();
|
||||||
chunkPromises.push(chunkPromise);
|
chunkPromises.push(chunkPromise);
|
||||||
fontPromise.then(function(items, font) {
|
fontPromise.then(function(items, chunkPromise, font) {
|
||||||
var chunk = '';
|
var chunk = '';
|
||||||
for (var j = 0, jj = items.length; j < jj; j++) {
|
for (var j = 0, jj = items.length; j < jj; j++) {
|
||||||
if (typeof items[j] === 'string') {
|
if (typeof items[j] === 'string') {
|
||||||
@ -901,19 +901,18 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chunkPromise.resolve(
|
chunkPromise.resolve(
|
||||||
getBidiText(chunk, -1, font.vertical));
|
getBidiText(chunk, -1, font.vertical));
|
||||||
}.bind(null, args[0]));
|
}.bind(null, args[0], chunkPromise));
|
||||||
break;
|
break;
|
||||||
case 'Tj':
|
case 'Tj':
|
||||||
var chunkPromise = new Promise();
|
var chunkPromise = new Promise();
|
||||||
chunkPromises.push(chunkPromise);
|
chunkPromises.push(chunkPromise);
|
||||||
fontPromise.then(function(charCodes, font) {
|
fontPromise.then(function(charCodes, chunkPromise, font) {
|
||||||
var chunk = fontCharsToUnicode(charCodes, font);
|
var chunk = fontCharsToUnicode(charCodes, font);
|
||||||
chunkPromise.resolve(
|
chunkPromise.resolve(
|
||||||
getBidiText(chunk, -1, font.vertical));
|
getBidiText(chunk, -1, font.vertical));
|
||||||
}.bind(null, args[0]));
|
}.bind(null, args[0], chunkPromise));
|
||||||
break;
|
break;
|
||||||
case '\'':
|
case '\'':
|
||||||
// For search, adding a extra white space for line breaks
|
// For search, adding a extra white space for line breaks
|
||||||
@ -921,21 +920,21 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||||||
// the text-selection divs.
|
// the text-selection divs.
|
||||||
var chunkPromise = new Promise();
|
var chunkPromise = new Promise();
|
||||||
chunkPromises.push(chunkPromise);
|
chunkPromises.push(chunkPromise);
|
||||||
fontPromise.then(function(charCodes, font) {
|
fontPromise.then(function(charCodes, chunkPromise, font) {
|
||||||
var chunk = fontCharsToUnicode(charCodes, font);
|
var chunk = fontCharsToUnicode(charCodes, font);
|
||||||
chunkPromise.resolve(
|
chunkPromise.resolve(
|
||||||
getBidiText(chunk, -1, font.vertical));
|
getBidiText(chunk, -1, font.vertical));
|
||||||
}.bind(null, args[0]));
|
}.bind(null, args[0], chunkPromise));
|
||||||
break;
|
break;
|
||||||
case '"':
|
case '"':
|
||||||
// Note comment in "'"
|
// Note comment in "'"
|
||||||
var chunkPromise = new Promise();
|
var chunkPromise = new Promise();
|
||||||
chunkPromises.push(chunkPromise);
|
chunkPromises.push(chunkPromise);
|
||||||
fontPromise.then(function(charCodes, font) {
|
fontPromise.then(function(charCodes, chunkPromise, font) {
|
||||||
var chunk = fontCharsToUnicode(charCodes, font);
|
var chunk = fontCharsToUnicode(charCodes, font);
|
||||||
chunkPromise.resolve(
|
chunkPromise.resolve(
|
||||||
getBidiText(chunk, -1, font.vertical));
|
getBidiText(chunk, -1, font.vertical));
|
||||||
}.bind(null, args[2]));
|
}.bind(null, args[2], chunkPromise));
|
||||||
break;
|
break;
|
||||||
case 'Do':
|
case 'Do':
|
||||||
if (args[0].code) {
|
if (args[0].code) {
|
||||||
|
Loading…
Reference in New Issue
Block a user