1fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// Copyright 2013 the V8 project authors. All rights reserved. 2fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// 4fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// Redistribution and use in source and binary forms, with or without 5fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// modification, are permitted provided that the following conditions 6fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// are met: 7fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// 1. Redistributions of source code must retain the above copyright 8fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// notice, this list of conditions and the following disclaimer. 9fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// 2. Redistributions in binary form must reproduce the above copyright 10fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// notice, this list of conditions and the following disclaimer in the 11fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// documentation and/or other materials provided with the distribution. 12fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// 13fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY 14fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org 24fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.orgdescription("This test checks expressions with alternative lengths of appox. 2^31."); 25fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org 26fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.orgvar regexp1 = /(?:(?=g))|(?:m).{2147483648,}/; 27fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.orgshouldBe("regexp1.exec('')", 'null'); 28fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org 29fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.orgvar regexp2 = /(?:(?=g)).{2147483648,}/; 30fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.orgshouldBe("regexp2.exec('')", 'null'); 31fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org 32fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.orgvar s3 = "&{6}u4a64YfQP{C}u88c4u5772Qu8693{4294967167}u85f2u7f3fs((uf202){4})u5bc6u1947"; 33fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.orgvar regexp3 = new RegExp(s3, ""); 34fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.orgshouldBe("regexp3.exec(s3)", 'null'); 35fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.org 36fb732b17922ea75830be4db6b80534c4827d8a55jkummerow@chromium.orgshouldThrow("function f() { /[^a$]{4294967295}/ }", '"SyntaxError: Invalid regular expression: number too large in {} quantifier"'); 37