1ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// Copyright 2010 the V8 project authors. All rights reserved. 2ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// Redistribution and use in source and binary forms, with or without 3ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// modification, are permitted provided that the following conditions are 4ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// met: 5ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// 6ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// * Redistributions of source code must retain the above copyright 7ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// notice, this list of conditions and the following disclaimer. 8ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// * Redistributions in binary form must reproduce the above 9ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// copyright notice, this list of conditions and the following 10ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// disclaimer in the documentation and/or other materials provided 11ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// with the distribution. 12ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// * Neither the name of Google Inc. nor the names of its 13ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// contributors may be used to endorse or promote products derived 14ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// from this software without specific prior written permission. 15ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// 16ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke 28ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarkefunction MyException() { } 29ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke 30ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarkevar o = new Object(); 31ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarkeo.valueOf = function() { throw new MyException(); } 32ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon Clarke 33ac95265630a4e0c317a7a7201d17a57df7d9bcceLeon ClarkeassertThrows(function() { o + 1 }, MyException); 34