Skip to content

Commit 64112e1

Browse files
committed
fix($parse): add .assign() function to settable expressions in CSP mode
Due to changes to CSP-mode detection and the CSP api in general, the test suite was not able to report regressions related to CSP. This CL corrects the broken test suite and broken CSP detection mechanics in $parse, and corrects the regression introduced where assignable expressions would not have an `assign` routine in CSP mode. Closes angular#9048
1 parent 2bf83a0 commit 64112e1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/ng/parse.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ function getterFn(path, options, fullExp) {
897897
if (pathKeysLength < 6) {
898898
fn = cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4], fullExp);
899899
} else {
900-
fn = function(scope, locals) {
900+
fn = function cspSafeGetter(scope, locals) {
901901
var i = 0, val;
902902
do {
903903
val = cspSafeGetterFn(pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++],
@@ -926,14 +926,14 @@ function getterFn(path, options, fullExp) {
926926
var evaledFnGetter = new Function('s', 'l', code); // s=scope, l=locals
927927
/* jshint +W054 */
928928
evaledFnGetter.toString = valueFn(code);
929-
evaledFnGetter.assign = function(self, value) {
930-
return setter(self, path, value, path);
931-
};
932929

933930
fn = evaledFnGetter;
934931
}
935932

936933
fn.sharedGetter = true;
934+
fn.assign = function(self, value) {
935+
return setter(self, path, value, path);
936+
};
937937
getterFnCache[path] = fn;
938938
return fn;
939939
}

0 commit comments

Comments
 (0)