15913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// Copyright 2010 the V8 project authors. All rights reserved. 25913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// Redistribution and use in source and binary forms, with or without 35913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// modification, are permitted provided that the following conditions are 45913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// met: 55913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// 65913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// * Redistributions of source code must retain the above copyright 75913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// notice, this list of conditions and the following disclaimer. 85913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// * Redistributions in binary form must reproduce the above 95913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// copyright notice, this list of conditions and the following 105913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// disclaimer in the documentation and/or other materials provided 115913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// with the distribution. 125913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// * Neither the name of Google Inc. nor the names of its 135913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// contributors may be used to endorse or promote products derived 145913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// from this software without specific prior written permission. 155913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// 165913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 175913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 185913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 195913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 205913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 215913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 225913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 245913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 265913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 275913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck 285913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck// See http://code.google.com/p/v8/issues/detail?id=617 comment 5 295913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck 305913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reckvar got_here = 0; 315913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck 325913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reckfunction make_sure_we_dont_get_here() { 335913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck got_here = 1; 345913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck} 355913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck 365913587db4c6bab03d97bfe44b06289fd6d7270dJohn ReckRegExp.prototype.exec = make_sure_we_dont_get_here; 375913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck 385913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reckvar re = /foo/; 395913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck 405913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reckre.exec = make_sure_we_dont_get_here; 415913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck 425913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reckre("foo"); 435913587db4c6bab03d97bfe44b06289fd6d7270dJohn Reck 445913587db4c6bab03d97bfe44b06289fd6d7270dJohn ReckassertEquals(got_here, 0); 45