Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 84322be

Browse files
committed
squash! wip
1 parent d5a94df commit 84322be

7 files changed

+35
-39
lines changed

src/AngularPublic.js

-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ function publishExternalAPI(angular) {
139139
'uppercase': uppercase,
140140
'callbacks': {counter: 0},
141141
'getTestability': getTestability,
142-
'$$interpolateMinErrors': $$interpolateMinErrors,
143142
'$$minErr': minErr,
144143
'$$csp': csp,
145144
'reloadWithDebugInfo': reloadWithDebugInfo

src/ng/interpolate.js

+13-14
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
'use strict';
22

3-
var $interpolateMinErr = minErr('$interpolate');
4-
var $$interpolateMinErrors = {
5-
noconcat: function(text) {
6-
return $interpolateMinErr('noconcat',
7-
"Error while interpolating: {0}\nStrict Contextual Escaping disallows " +
8-
"interpolations that concatenate multiple expressions when a trusted value is " +
9-
"required. See http://docs.angularjs.org/api/ng.$sce", text);
10-
},
11-
interr: function(text, err) {
12-
return $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text, err.toString());
13-
}
3+
var $$interpolateMinErr = angular.$$interpolateMinErr = minErr('$interpolate');
4+
$$interpolateMinErr.noconcat = function(text) {
5+
return $$interpolateMinErr('noconcat',
6+
"Error while interpolating: {0}\nStrict Contextual Escaping disallows " +
7+
"interpolations that concatenate multiple expressions when a trusted value is " +
8+
"required. See http://docs.angularjs.org/api/ng.$sce", text);
9+
};
10+
11+
$$interpolateMinErr.interr = function(text, err) {
12+
return $$interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text, err.toString());
1413
};
1514

1615
/**
@@ -255,7 +254,7 @@ function $InterpolateProvider() {
255254
// make it obvious that you bound the value to some user controlled value. This helps reduce
256255
// the load when auditing for XSS issues.
257256
if (trustedContext && concat.length > 1) {
258-
throw $interpolateMinErr.noconcat(text);
257+
throw $$interpolateMinErr.noconcat(text);
259258
}
260259

261260
if (!mustHaveExpression || expressions.length) {
@@ -285,7 +284,7 @@ function $InterpolateProvider() {
285284

286285
return compute(values);
287286
} catch (err) {
288-
$exceptionHandler($interpolateMinErr.interr(text, err));
287+
$exceptionHandler($$interpolateMinErr.interr(text, err));
289288
}
290289

291290
}, {
@@ -310,7 +309,7 @@ function $InterpolateProvider() {
310309
value = getValue(value);
311310
return allOrNothing && !isDefined(value) ? value : stringify(value);
312311
} catch (err) {
313-
$exceptionHandler($interpolateMinErr.interr(text, err));
312+
$exceptionHandler($$interpolateMinErr.interr(text, err));
314313
}
315314
}
316315
}

src/ngMessageFormat/messageFormatCommon.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using
66
// constructs incompatible with that mode.
77

8-
var $$interpolateMinErrors = angular['$$interpolateMinErrors'];
9-
var $interpolateMinErr = angular['$$minErr']('$interpolate');
8+
var $$interpolateMinErr = angular['$$interpolateMinErr'];
109

1110
var noop = angular['noop'],
1211
isFunction = angular['isFunction'],

src/ngMessageFormat/messageFormatInterpolationParts.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using
66
// constructs incompatible with that mode.
77

8-
/* global $$interpolateMinErrors: false */
8+
/* global $$interpolateMinErr: false */
99
/* global isFunction: false */
1010
/* global parseTextLiteral: false */
1111

@@ -82,7 +82,7 @@ InterpolationParts.prototype.toParsedFn = function toParsedFn(mustHaveExpression
8282
return parseTextLiteral('');
8383
}
8484
if (this.trustedContext && this.textParts.length > 1) {
85-
throw $$interpolateMinErrors['noconcat'](originalText);
85+
throw $$interpolateMinErr['noconcat'](originalText);
8686
}
8787
if (this.expressionFns.length === 0) {
8888
if (this.textParts.length != 1) { this.errorInParseLogic(); }

src/ngMessageFormat/messageFormatParser.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using
66
// constructs incompatible with that mode.
77

8-
/* global $interpolateMinErr: false */
8+
/* global $$interpolateMinErr: false */
99
/* global indexToLineAndColumn: false */
1010
/* global InterpolationParts: false */
1111
/* global PluralMessage: false */
@@ -124,7 +124,7 @@ MessageFormatParser.prototype.run = function run(initialRule) {
124124
};
125125

126126
MessageFormatParser.prototype.errorInParseLogic = function errorInParseLogic() {
127-
throw $interpolateMinErr('logicbug',
127+
throw $$interpolateMinErr('logicbug',
128128
'The messageformat parser has encountered an internal error. Please file a github issue against the AngularJS project and provide this message text that triggers the bug. Text: "{0}"',
129129
this.text);
130130
};
@@ -141,19 +141,19 @@ MessageFormatParser.prototype.errorExpecting = function errorExpecting() {
141141
var match = this.matchRe(NEXT_WORD_RE), position;
142142
if (match == null) {
143143
position = indexToLineAndColumn(this.text, this.index);
144-
throw $interpolateMinErr('reqarg',
144+
throw $$interpolateMinErr('reqarg',
145145
'Expected one of "plural" or "select" at line {0}, column {1} of text "{2}"',
146146
position.line, position.column, this.text);
147147
}
148148
var word = match[1];
149149
if (word == "select" || word == "plural") {
150150
position = indexToLineAndColumn(this.text, this.index);
151-
throw $interpolateMinErr('reqcomma',
151+
throw $$interpolateMinErr('reqcomma',
152152
'Expected a comma after the keyword "{0}" at line {1}, column {2} of text "{3}"',
153153
word, position.line, position.column, this.text);
154154
} else {
155155
position = indexToLineAndColumn(this.text, this.index);
156-
throw $interpolateMinErr('unknarg',
156+
throw $$interpolateMinErr('unknarg',
157157
'Unsupported keyword "{0}" at line {0}, column {1}. Only "plural" and "select" are currently supported. Text: "{3}"',
158158
word, position.line, position.column, this.text);
159159
}
@@ -164,7 +164,7 @@ MessageFormatParser.prototype.ruleString = function ruleString() {
164164
var match = this.matchRe(STRING_START_RE);
165165
if (match == null) {
166166
var position = indexToLineAndColumn(this.text, this.index);
167-
throw $interpolateMinErr('wantstring',
167+
throw $$interpolateMinErr('wantstring',
168168
'Expected the beginning of a string at line {0}, column {1} in text "{2}"',
169169
position.line, position.column, this.text);
170170
}
@@ -184,7 +184,7 @@ MessageFormatParser.prototype.ruleInsideString = function ruleInsideString() {
184184
var match = this.searchRe(this.stringInterestsRe);
185185
if (match == null) {
186186
var position = indexToLineAndColumn(this.text, this.stringStartIndex);
187-
throw $interpolateMinErr('untermstr',
187+
throw $$interpolateMinErr('untermstr',
188188
'The string beginning at line {0}, column {1} is unterminated in text "{2}"',
189189
position.line, position.column, this.text);
190190
}
@@ -233,7 +233,7 @@ MessageFormatParser.prototype.rulePluralOffset = function rulePluralOffset() {
233233
MessageFormatParser.prototype.assertChoiceKeyIsNew = function assertChoiceKeyIsNew(choiceKey, index) {
234234
if (this.choices[choiceKey] !== void 0) {
235235
var position = indexToLineAndColumn(this.text, index);
236-
throw $interpolateMinErr('dupvalue',
236+
throw $$interpolateMinErr('dupvalue',
237237
'The choice "{0}" is specified more than once. Duplicate key is at line {1}, column {2} in text "{3}"',
238238
choiceKey, position.line, position.column, this.text);
239239
}
@@ -274,7 +274,7 @@ var BRACE_CLOSE_RE = /}/g;
274274
MessageFormatParser.prototype.ruleMessageText = function ruleMessageText() {
275275
if (!this.consumeRe(BRACE_OPEN_RE)) {
276276
var position = indexToLineAndColumn(this.text, this.index);
277-
throw $interpolateMinErr('reqopenbrace',
277+
throw $$interpolateMinErr('reqopenbrace',
278278
'The plural choice "{0}" must be followed by a message in braces at line {1}, column {2} in text "{3}"',
279279
this.choiceKey, position.line, position.column, this.text);
280280
}
@@ -302,7 +302,7 @@ MessageFormatParser.prototype.advanceInInterpolationOrMessageText = function adv
302302
INTERP_OR_PLURALVALUE_OR_END_MESSAGE_RE : INTERP_OR_END_MESSAGE_RE);
303303
if (match == null) {
304304
var position = indexToLineAndColumn(this.text, this.msgStartIndex);
305-
throw $interpolateMinErr('reqendbrace',
305+
throw $$interpolateMinErr('reqendbrace',
306306
'The plural/select choice "{0}" message starting at line {1}, column {2} does not have an ending closing brace. Text "{3}"',
307307
this.choiceKey, position.line, position.column, this.text);
308308
}
@@ -398,7 +398,7 @@ MessageFormatParser.prototype.ruleEndMustache = function ruleEndMustache() {
398398
var match = this.matchRe(INTERP_END_RE);
399399
if (match == null) {
400400
var position = indexToLineAndColumn(this.text, this.index);
401-
throw $interpolateMinErr('reqendinterp',
401+
throw $$interpolateMinErr('reqendinterp',
402402
'Expecting end of interpolation symbol, "{0}", at line {1}, column {2} in text "{3}"',
403403
'}}', position.line, position.column, this.text);
404404
}
@@ -470,7 +470,7 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
470470
return;
471471
}
472472
var innermostOperator = this.angularOperatorStack[0];
473-
throw $interpolateMinErr('badexpr',
473+
throw $$interpolateMinErr('badexpr',
474474
'Unexpected end of Angular expression. Expecting operator "{0}" at the end of the text "{1}"',
475475
this.getEndOperator(innermostOperator), this.text);
476476
}
@@ -483,7 +483,7 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
483483
if (operator == ",") {
484484
if (this.trustedContext) {
485485
position = indexToLineAndColumn(this.text, this.index);
486-
throw $interpolateMinErr('unsafe',
486+
throw $$interpolateMinErr('unsafe',
487487
'Use of select/plural MessageFormat syntax is currently disallowed in a secure context ({0}). At line {1}, column {2} of text "{3}"',
488488
this.trustedContext, position.line, position.column, this.text);
489489
}
@@ -514,7 +514,7 @@ MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularEx
514514
return;
515515
}
516516
position = indexToLineAndColumn(this.text, this.index);
517-
throw $interpolateMinErr('badexpr',
517+
throw $$interpolateMinErr('badexpr',
518518
'Unexpected operator "{0}" at line {1}, column {2} in text. Was expecting "{3}". Text: "{4}"',
519519
operator, position.line, position.column, getEndOperator(this.angularOperatorStack[0]), this.text);
520520
}

src/ngMessageFormat/messageFormatSelector.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using
66
// constructs incompatible with that mode.
77

8-
/* global $interpolateMinErr: false */
8+
/* global $$interpolateMinErr: false */
99
/* global isFunction: false */
1010
/* global noop: false */
1111

@@ -18,7 +18,7 @@ function MessageSelectorBase(expressionFn, choices) {
1818
this.expressionFn = expressionFn;
1919
this.choices = choices;
2020
if (choices["other"] === void 0) {
21-
throw $interpolateMinErr('reqother', '"other" is a required option.');
21+
throw $$interpolateMinErr('reqother', '"other" is a required option.');
2222
}
2323
this.parsedFn = function(context) { return self.getResult(context); };
2424
this.parsedFn['$$watchDelegate'] = function $$watchDelegate(scope, listener, objectEquality) {

src/ngMessageFormat/messageFormatService.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
// This file is compiled with Closure compiler's ADVANCED_OPTIMIZATIONS flag! Be wary of using
66
// constructs incompatible with that mode.
77

8-
/* global $$interpolateMinErrors: false */
9-
/* global $interpolateMinErr: false */
8+
/* global $$interpolateMinErr: false */
109
/* global MessageFormatParser: false */
1110
/* global stringify: false */
1211

@@ -29,7 +28,7 @@ function $$MessageFormatProvider() {
2928
value = trustedContext ? $sce['getTrusted'](trustedContext, value) : $sce['valueOf'](value);
3029
return allOrNothing && (value === void 0) ? value : stringify(value);
3130
} catch (err) {
32-
$exceptionHandler($$interpolateMinErrors['interr'](text, err));
31+
$exceptionHandler($$interpolateMinErr['interr'](text, err));
3332
}
3433
};
3534
}
@@ -50,7 +49,7 @@ function $$MessageFormatProvider() {
5049

5150
var $$interpolateDecorator = ['$$messageFormat', '$delegate', function $$interpolateDecorator($$messageFormat, $interpolate) {
5251
if ($interpolate['startSymbol']() != "{{" || $interpolate['endSymbol']() != "}}") {
53-
throw $interpolateMinErr('nochgmustache', 'angular-messageformat.js currently does not allow you to use custom start and end symbols for interpolation.');
52+
throw $$interpolateMinErr('nochgmustache', 'angular-messageformat.js currently does not allow you to use custom start and end symbols for interpolation.');
5453
}
5554
var interpolate = $$messageFormat['interpolate'];
5655
interpolate['startSymbol'] = $interpolate['startSymbol'];

0 commit comments

Comments
 (0)