1303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// Copyright 2010 the V8 project authors. All rights reserved. 2303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// Redistribution and use in source and binary forms, with or without 3303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// modification, are permitted provided that the following conditions are 4303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// met: 5303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// 6303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// * Redistributions of source code must retain the above copyright 7303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// notice, this list of conditions and the following disclaimer. 8303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// * Redistributions in binary form must reproduce the above 9303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// copyright notice, this list of conditions and the following 10303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// disclaimer in the documentation and/or other materials provided 11303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// with the distribution. 12303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// * Neither the name of Google Inc. nor the names of its 13303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// contributors may be used to endorse or promote products derived 14303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// from this software without specific prior written permission. 15303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// 16303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org 28303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org// See http://code.google.com/p/v8/issues/detail?id=617 comment 5 29303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org 30303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.orgvar got_here = 0; 31303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org 32303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.orgfunction make_sure_we_dont_get_here() { 33303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org got_here = 1; 34303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org} 35303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org 36303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.orgRegExp.prototype.exec = make_sure_we_dont_get_here; 37303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org 38303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.orgvar re = /foo/; 39303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org 40303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.orgre.exec = make_sure_we_dont_get_here; 41303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org 42303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.orgre("foo"); 43303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.org 44303ada708275d2d425b846fb237f1ba7598ee239lrn@chromium.orgassertEquals(got_here, 0); 45