Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: test/intl/overrides/security.js

Issue 148883002: Synchronize with r15594. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/intl/overrides/number.js ('k') | test/intl/overrides/string.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/intl/overrides/security.js
diff --git a/test/mjsunit/array-non-smi-length.js b/test/intl/overrides/security.js
similarity index 65%
copy from test/mjsunit/array-non-smi-length.js
copy to test/intl/overrides/security.js
index 23a25ee797bd68690ad2a7ce26a9135e23b486e2..e012753fa231e034bb7cb42b56de019e07a690fe 100644
--- a/test/mjsunit/array-non-smi-length.js
+++ b/test/intl/overrides/security.js
@@ -25,22 +25,26 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax
+// Test that we always use original Intl.Constructors for toLocaleString calls.
-function TestNonSmiArrayLength() {
- function f(a) {
- return a.length+1;
- }
+function throwError() {
+ throw new Error('Malicious method invoked.');
+}
- var a = [];
- a.length = 0xFFFF;
- assertSame(0x10000, f(a));
- assertSame(0x10000, f(a));
+Intl.Collator = Intl.NumberFormat = Intl.DateTimeFormat = throwError;
- %OptimizeFunctionOnNextCall(f);
- a.length = 0xFFFFFFFF;
- assertSame(0x100000000, f(a));
-}
+Intl.Collator.prototype.compare = throwError;
+Intl.NumberFormat.prototype.format = throwError;
+Intl.DateTimeFormat.prototype.format = throwError;
-TestNonSmiArrayLength();
+// Make sure constructors actually throw now.
+assertThrows('new Intl.Collator()');
+assertThrows('new Intl.NumberFormat()');
+assertThrows('new Intl.DateTimeFormat()');
+// None of these should throw.
+assertDoesNotThrow('new Date().toLocaleString()');
+assertDoesNotThrow('new Date().toLocaleDateString()');
+assertDoesNotThrow('new Date().toLocaleTimeString()');
+assertDoesNotThrow('new Number(12345.412).toLocaleString()');
+assertDoesNotThrow('new String(\'abc\').localeCompare(\'bcd\')');
« no previous file with comments | « test/intl/overrides/number.js ('k') | test/intl/overrides/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698