| 1 | /* |
| 2 | * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of |
| 14 | * its contributors may be used to endorse or promote products derived |
| 15 | * from this software without specific prior written permission. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
| 18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 20 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
| 21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #include "config.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/config.h`/ |
| 30 | #include "ExceptionHelpers.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/ExceptionHelpers.h`/ |
| 31 | |
| 32 | #include "CodeBlock.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/CodeBlock.h`/ |
| 33 | #include "CallFrame.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/CallFrame.h`/ |
| 34 | #include "JSGlobalObjectFunctions.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalObjectFunctions.h`/ |
| 35 | #include "JSObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSObject.h`/ |
| 36 | #include "JSNotAnObject.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSNotAnObject.h`/ |
| 37 | #include "Interpreter.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/interpreter/Interpreter.h`/ |
| 38 | #include "Nodes.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/parser/Nodes.h`/ |
| 39 | |
| 40 | namespace JSCcxx . . $ `<built-in>:463:9`! { |
| 41 | |
| 42 | class InterruptedExecutionErrorcxx . . $ QTJSC/InterruptedExecutionError# : public JSObjectcxx . . $ QTJSC/JSObject# { |
| 43 | public: |
| 44 | InterruptedExecutionErrorcxx . . $ QTJSC/InterruptedExecutionError#InterruptedExecutionError(71c44650a83bfd83).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData) |
| 45 | : JSObjectcxx . . $ QTJSC/JSObject#(globalData->interruptedExecutionErrorStructure) |
| 46 | { |
| 47 | } |
| 48 | |
| 49 | virtual bool isWatchdogExceptioncxx . . $ QTJSC/InterruptedExecutionError#isWatchdogException(50ce9a9e25b4a850).() const { return true; } |
| 50 | |
| 51 | virtual UStringcxx . . $ QTJSC/UString# toStringcxx . . $ QTJSC/InterruptedExecutionError#toString(9c94f5abb1995042).(ExecStatecxx . . $ QTJSC/ExecState#*) const { returncxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d). "JavaScript execution exceeded timeout."cxx . . $ QTJSC/UString#UString(85c52e162fed56f9).; } |
| 52 | }; |
| 53 | |
| 54 | JSValuecxx . . $ QTJSC/JSValue# createInterruptedExecutionExceptioncxx . . $ QTJSC/createInterruptedExecutionException(5f262fe1c647dd02).(JSGlobalDatacxx . . $ QTJSC/JSGlobalData#* globalData) |
| 55 | { |
| 56 | return new (globalData) InterruptedExecutionErrorcxx . . $ QTJSC/InterruptedExecutionError#(globalData); |
| 57 | } |
| 58 | |
| 59 | static JSValuecxx . . $ QTJSC/JSValue# createErrorcxx . . $ QTJSC/createError(ba6614afb728a652).(ExecStatecxx . . $ QTJSC/ExecState#* exec, ErrorTypecxx . . $ QTJSC/ErrorType# e, const char* msg) |
| 60 | { |
| 61 | return Errorcxx . . $ QTJSC/Error#::createcxx . . $ QTJSC/Error#create(7b4507467ace1137).(exec, e, msgcxx . . $ QTJSC/UString#UString(85c52e162fed56f9)., -1, -1, 0cxx . . $ QTJSC/UString#UString(85c52e162fed56f9).); |
| 62 | } |
| 63 | |
| 64 | JSValuecxx . . $ QTJSC/JSValue# createStackOverflowErrorcxx . . $ QTJSC/createStackOverflowError(3fbe51058e39576a).(ExecStatecxx . . $ QTJSC/ExecState#* exec) |
| 65 | { |
| 66 | return createErrorcxx . . $ QTJSC/createError(ba6614afb728a652).(exec, RangeErrorcxx . . $ QTJSC/RangeError., "Maximum call stack size exceeded."); |
| 67 | } |
| 68 | |
| 69 | JSValuecxx . . $ QTJSC/JSValue# createTypeErrorcxx . . $ QTJSC/createTypeError(56512a4af4f42c63).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const char* message) |
| 70 | { |
| 71 | return createErrorcxx . . $ QTJSC/createError(ba6614afb728a652).(exec, TypeErrorcxx . . $ QTJSC/TypeError., message); |
| 72 | } |
| 73 | |
| 74 | JSValuecxx . . $ QTJSC/JSValue# createUndefinedVariableErrorcxx . . $ QTJSC/createUndefinedVariableError(ad32a0e05e5e1c74).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const Identifiercxx . . $ QTJSC/Identifier#& ident, unsigned bytecodeOffset, CodeBlockcxx . . $ QTJSC/CodeBlock#* codeBlock) |
| 75 | { |
| 76 | int startOffset = 0; |
| 77 | int endOffset = 0; |
| 78 | int divotPoint = 0; |
| 79 | int line = codeBlock->expressionRangeForBytecodeOffsetcxx . . $ QTJSC/CodeBlock#expressionRangeForBytecodeOffset(285ee9e975c1f166).(exec, bytecodeOffset, divotPoint, startOffset, endOffset); |
| 80 | JSObjectcxx . . $ QTJSC/JSObject#* exception = Errorcxx . . $ QTJSC/Error#::createcxx . . $ QTJSC/Error#create(7b4507467ace1137).(exec, ReferenceErrorcxx . . $ QTJSC/ReferenceError., makeStringcxx . . $ QTJSC/makeString(b1788f951b46c19b).("Can't find variable: ", ident.ustringcxx . . $ QTJSC/Identifier#ustring(de21ee9ecbd506fd).()), line, codeBlock->ownerExecutablecxx . . $ QTJSC/CodeBlock#ownerExecutable(536727ad2b3735a6).()->sourceIDcxx . . $ QTJSC/ScriptExecutable#sourceID(57a65ae535d7db84).(), codeBlock->ownerExecutablecxx . . $ QTJSC/CodeBlock#ownerExecutable(536727ad2b3735a6).()->sourceURLcxx . . $ QTJSC/ScriptExecutable#sourceURL(de21ee9ecbd506fd).()); |
| 81 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionBeginOffsetPropertyNamecxx . . $ QTJSC/expressionBeginOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint - startOffset), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 82 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionCaretOffsetPropertyNamecxx . . $ QTJSC/expressionCaretOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 83 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionEndOffsetPropertyNamecxx . . $ QTJSC/expressionEndOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint + endOffset), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 84 | return exception; |
| 85 | } |
| 86 | |
| 87 | static UStringcxx . . $ QTJSC/UString# createErrorMessagecxx . . $ QTJSC/createErrorMessage(1704e103e672f4bb).(ExecStatecxx . . $ QTJSC/ExecState#* exec, CodeBlockcxx . . $ QTJSC/CodeBlock#* codeBlock, int, int expressionStart, int expressionStop, JSValuecxx . . $ QTJSC/JSValue# value, UStringcxx . . $ QTJSC/UString# error) |
| 88 | { |
| 89 | if (!expressionStop || expressionStart > codeBlock->sourcecxx . . $ QTJSC/CodeBlock#source(387ae131163f03a7).()->lengthcxx . . $ QTJSC/SourceProvider#length(455f465bc33b4cdf).()) |
| 90 | return makeStringcxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).(value.toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(exec), " is ", error); |
| 91 | if (expressionStart < expressionStop) |
| 92 | return makeStringcxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).("Result of expression '", codeBlock->sourcecxx . . $ QTJSC/CodeBlock#source(387ae131163f03a7).()->getRangecxx . . $ QTJSC/SourceProvider#getRange(2aae7669e5263855).(expressionStart, expressionStop), "' [", value.toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(exec), "] is ", error, "."); |
| 93 | |
| 94 | // No range information, so give a few characters of context |
| 95 | const UCharcxx . . $ UChar#* data = codeBlock->sourcecxx . . $ QTJSC/CodeBlock#source(387ae131163f03a7).()->datacxx . . $ QTJSC/SourceProvider#data(9865edf6270d80f8).(); |
| 96 | int dataLength = codeBlock->sourcecxx . . $ QTJSC/CodeBlock#source(387ae131163f03a7).()->lengthcxx . . $ QTJSC/SourceProvider#length(455f465bc33b4cdf).(); |
| 97 | int start = expressionStart; |
| 98 | int stop = expressionStart; |
| 99 | // Get up to 20 characters of context to the left and right of the divot, clamping to the line. |
| 100 | // then strip whitespace. |
| 101 | while (start > 0 && (expressionStart - start < 20) && data[start - 1] != '\n') |
| 102 | start--; |
| 103 | while (start < (expressionStart - 1) && isStrWhiteSpacecxx . . $ QTJSC/isStrWhiteSpace(3c978dac0e5ee2ad).(data[start])) |
| 104 | start++; |
| 105 | while (stop < dataLength && (stop - expressionStart < 20) && data[stop] != '\n') |
| 106 | stop++; |
| 107 | while (stop > expressionStart && isStrWhiteSpacecxx . . $ QTJSC/isStrWhiteSpace(3c978dac0e5ee2ad).(data[stop])) |
| 108 | stop--; |
| 109 | return makeStringcxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).("Result of expression near '...", codeBlock->sourcecxx . . $ QTJSC/CodeBlock#source(387ae131163f03a7).()->getRangecxx . . $ QTJSC/SourceProvider#getRange(2aae7669e5263855).(start, stop), "...' [", value.toStringcxx . . $ QTJSC/JSValue#toString(9c94f5abb1995042).(exec), "] is ", error, "."); |
| 110 | } |
| 111 | |
| 112 | JSObjectcxx . . $ QTJSC/JSObject#* createInvalidParamErrorcxx . . $ QTJSC/createInvalidParamError(a88900e291ca5a51).(ExecStatecxx . . $ QTJSC/ExecState#* exec, const char* op, JSValuecxx . . $ QTJSC/JSValue# value, unsigned bytecodeOffset, CodeBlockcxx . . $ QTJSC/CodeBlock#* codeBlock) |
| 113 | { |
| 114 | int startOffset = 0; |
| 115 | int endOffset = 0; |
| 116 | int divotPoint = 0; |
| 117 | int line = codeBlock->expressionRangeForBytecodeOffsetcxx . . $ QTJSC/CodeBlock#expressionRangeForBytecodeOffset(285ee9e975c1f166).(exec, bytecodeOffset, divotPoint, startOffset, endOffset); |
| 118 | UStringcxx . . $ QTJSC/UString# errorMessage = createErrorMessagecxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).(exec, codeBlock, line, divotPoint, divotPoint + endOffset, value, makeStringcxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).("not a valid argument for '", op, "'")); |
| 119 | JSObjectcxx . . $ QTJSC/JSObject#* exception = Errorcxx . . $ QTJSC/Error#::createcxx . . $ QTJSC/Error#create(7b4507467ace1137).(exec, TypeErrorcxx . . $ QTJSC/TypeError., errorMessage, line, codeBlock->ownerExecutablecxx . . $ QTJSC/CodeBlock#ownerExecutable(536727ad2b3735a6).()->sourceIDcxx . . $ QTJSC/ScriptExecutable#sourceID(57a65ae535d7db84).(), codeBlock->ownerExecutablecxx . . $ QTJSC/CodeBlock#ownerExecutable(536727ad2b3735a6).()->sourceURLcxx . . $ QTJSC/ScriptExecutable#sourceURL(de21ee9ecbd506fd).()); |
| 120 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionBeginOffsetPropertyNamecxx . . $ QTJSC/expressionBeginOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint - startOffset), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 121 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionCaretOffsetPropertyNamecxx . . $ QTJSC/expressionCaretOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 122 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionEndOffsetPropertyNamecxx . . $ QTJSC/expressionEndOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint + endOffset), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 123 | return exception; |
| 124 | } |
| 125 | |
| 126 | JSObjectcxx . . $ QTJSC/JSObject#* createNotAConstructorErrorcxx . . $ QTJSC/createNotAConstructorError(3793ea03f177d60f).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSValuecxx . . $ QTJSC/JSValue# value, unsigned bytecodeOffset, CodeBlockcxx . . $ QTJSC/CodeBlock#* codeBlock) |
| 127 | { |
| 128 | int startOffset = 0; |
| 129 | int endOffset = 0; |
| 130 | int divotPoint = 0; |
| 131 | int line = codeBlock->expressionRangeForBytecodeOffsetcxx . . $ QTJSC/CodeBlock#expressionRangeForBytecodeOffset(285ee9e975c1f166).(exec, bytecodeOffset, divotPoint, startOffset, endOffset); |
| 132 | |
| 133 | // We're in a "new" expression, so we need to skip over the "new.." part |
| 134 | int startPoint = divotPoint - (startOffset ? startOffset - 4 : 0); // -4 for "new " |
| 135 | const UCharcxx . . $ UChar#* data = codeBlock->sourcecxx . . $ QTJSC/CodeBlock#source(387ae131163f03a7).()->datacxx . . $ QTJSC/SourceProvider#data(9865edf6270d80f8).(); |
| 136 | while (startPoint < divotPoint && isStrWhiteSpacecxx . . $ QTJSC/isStrWhiteSpace(3c978dac0e5ee2ad).(data[startPoint])) |
| 137 | startPoint++; |
| 138 | |
| 139 | UStringcxx . . $ QTJSC/UString# errorMessage = createErrorMessagecxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).(exec, codeBlock, line, startPoint, divotPoint, value, "not a constructor"cxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).); |
| 140 | JSObjectcxx . . $ QTJSC/JSObject#* exception = Errorcxx . . $ QTJSC/Error#::createcxx . . $ QTJSC/Error#create(7b4507467ace1137).(exec, TypeErrorcxx . . $ QTJSC/TypeError., errorMessage, line, codeBlock->ownerExecutablecxx . . $ QTJSC/CodeBlock#ownerExecutable(536727ad2b3735a6).()->sourceIDcxx . . $ QTJSC/ScriptExecutable#sourceID(57a65ae535d7db84).(), codeBlock->ownerExecutablecxx . . $ QTJSC/CodeBlock#ownerExecutable(536727ad2b3735a6).()->sourceURLcxx . . $ QTJSC/ScriptExecutable#sourceURL(de21ee9ecbd506fd).()); |
| 141 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionBeginOffsetPropertyNamecxx . . $ QTJSC/expressionBeginOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint - startOffset), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 142 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionCaretOffsetPropertyNamecxx . . $ QTJSC/expressionCaretOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 143 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionEndOffsetPropertyNamecxx . . $ QTJSC/expressionEndOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint + endOffset), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 144 | return exception; |
| 145 | } |
| 146 | |
| 147 | JSValuecxx . . $ QTJSC/JSValue# createNotAFunctionErrorcxx . . $ QTJSC/createNotAFunctionError(967d1010b6c0a863).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSValuecxx . . $ QTJSC/JSValue# value, unsigned bytecodeOffset, CodeBlockcxx . . $ QTJSC/CodeBlock#* codeBlock) |
| 148 | { |
| 149 | int startOffset = 0; |
| 150 | int endOffset = 0; |
| 151 | int divotPoint = 0; |
| 152 | int line = codeBlock->expressionRangeForBytecodeOffsetcxx . . $ QTJSC/CodeBlock#expressionRangeForBytecodeOffset(285ee9e975c1f166).(exec, bytecodeOffset, divotPoint, startOffset, endOffset); |
| 153 | UStringcxx . . $ QTJSC/UString# errorMessage = createErrorMessagecxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).(exec, codeBlock, line, divotPoint - startOffset, divotPoint, value, "not a function"cxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).); |
| 154 | JSObjectcxx . . $ QTJSC/JSObject#* exception = Errorcxx . . $ QTJSC/Error#::createcxx . . $ QTJSC/Error#create(7b4507467ace1137).(exec, TypeErrorcxx . . $ QTJSC/TypeError., errorMessage, line, codeBlock->ownerExecutablecxx . . $ QTJSC/CodeBlock#ownerExecutable(536727ad2b3735a6).()->sourceIDcxx . . $ QTJSC/ScriptExecutable#sourceID(57a65ae535d7db84).(), codeBlock->ownerExecutablecxx . . $ QTJSC/CodeBlock#ownerExecutable(536727ad2b3735a6).()->sourceURLcxx . . $ QTJSC/ScriptExecutable#sourceURL(de21ee9ecbd506fd).()); |
| 155 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionBeginOffsetPropertyNamecxx . . $ QTJSC/expressionBeginOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint - startOffset), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 156 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionCaretOffsetPropertyNamecxx . . $ QTJSC/expressionCaretOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 157 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionEndOffsetPropertyNamecxx . . $ QTJSC/expressionEndOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint + endOffset), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 158 | return exception; |
| 159 | } |
| 160 | |
| 161 | JSNotAnObjectErrorStubcxx . . $ QTJSC/JSNotAnObjectErrorStub#* createNotAnObjectErrorStubcxx . . $ QTJSC/createNotAnObjectErrorStub(c79170a29de2b061).(ExecStatecxx . . $ QTJSC/ExecState#* exec, bool isNull) |
| 162 | { |
| 163 | return new (exec) JSNotAnObjectErrorStubcxx . . $ QTJSC/JSNotAnObjectErrorStub#JSNotAnObjectErrorStub(8ab7e31759e06129).(exec, isNull); |
| 164 | } |
| 165 | |
| 166 | JSObjectcxx . . $ QTJSC/JSObject#* createNotAnObjectErrorcxx . . $ QTJSC/createNotAnObjectError(5464a2392d3a703b).(ExecStatecxx . . $ QTJSC/ExecState#* exec, JSNotAnObjectErrorStubcxx . . $ QTJSC/JSNotAnObjectErrorStub#* error, unsigned bytecodeOffset, CodeBlockcxx . . $ QTJSC/CodeBlock#* codeBlock) |
| 167 | { |
| 168 | // Both op_construct and op_instanceof require a use of op_get_by_id to get |
| 169 | // the prototype property from an object. The exception messages for exceptions |
| 170 | // thrown by these instances op_get_by_id need to reflect this. |
| 171 | OpcodeIDcxx . . $ QTJSC/OpcodeID# followingOpcodeID; |
| 172 | if (codeBlock->getByIdExceptionInfoForBytecodeOffsetcxx . . $ QTJSC/CodeBlock#getByIdExceptionInfoForBytecodeOffset(13c3b0a2dd87a831).(exec, bytecodeOffset, followingOpcodeID)) { |
| 173 | ASSERTcxx . . $ `src/3rdparty/javascriptcore/JavaScriptCore/wtf/Assertions.h:184:9`!(followingOpcodeID == op_construct || followingOpcodeID == op_instanceof); |
| 174 | if (followingOpcodeID == op_constructcxx . . $ QTJSC/op_construct.) |
| 175 | return createNotAConstructorErrorcxx . . $ QTJSC/createNotAConstructorError(3793ea03f177d60f).(exec, error->isNullcxx . . $ QTJSC/JSNotAnObjectErrorStub#isNull(50ce9a9e25b4a850).() ? jsNullcxx . . $ QTJSC/jsNull(ad9afe69d7bf6378).() : jsUndefinedcxx . . $ QTJSC/jsUndefined(ad9afe69d7bf6378).(), bytecodeOffset, codeBlock); |
| 176 | return createInvalidParamErrorcxx . . $ QTJSC/createInvalidParamError(a88900e291ca5a51).(exec, "instanceof", error->isNullcxx . . $ QTJSC/JSNotAnObjectErrorStub#isNull(50ce9a9e25b4a850).() ? jsNullcxx . . $ QTJSC/jsNull(ad9afe69d7bf6378).() : jsUndefinedcxx . . $ QTJSC/jsUndefined(ad9afe69d7bf6378).(), bytecodeOffset, codeBlock); |
| 177 | } |
| 178 | |
| 179 | int startOffset = 0; |
| 180 | int endOffset = 0; |
| 181 | int divotPoint = 0; |
| 182 | int line = codeBlock->expressionRangeForBytecodeOffsetcxx . . $ QTJSC/CodeBlock#expressionRangeForBytecodeOffset(285ee9e975c1f166).(exec, bytecodeOffset, divotPoint, startOffset, endOffset); |
| 183 | UStringcxx . . $ QTJSC/UString# errorMessage = createErrorMessagecxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).(exec, codeBlock, line, divotPoint - startOffset, divotPoint, error->isNullcxx . . $ QTJSC/JSNotAnObjectErrorStub#isNull(50ce9a9e25b4a850).() ? jsNullcxx . . $ QTJSC/jsNull(ad9afe69d7bf6378).() : jsUndefinedcxx . . $ QTJSC/jsUndefined(ad9afe69d7bf6378).(), "not an object"cxx . . $ QTJSC/UString#UString(e6bad6cb9b63b14d).); |
| 184 | JSObjectcxx . . $ QTJSC/JSObject#* exception = Errorcxx . . $ QTJSC/Error#::createcxx . . $ QTJSC/Error#create(7b4507467ace1137).(exec, TypeErrorcxx . . $ QTJSC/TypeError., errorMessage, line, codeBlock->ownerExecutablecxx . . $ QTJSC/CodeBlock#ownerExecutable(536727ad2b3735a6).()->sourceIDcxx . . $ QTJSC/ScriptExecutable#sourceID(57a65ae535d7db84).(), codeBlock->ownerExecutablecxx . . $ QTJSC/CodeBlock#ownerExecutable(536727ad2b3735a6).()->sourceURLcxx . . $ QTJSC/ScriptExecutable#sourceURL(de21ee9ecbd506fd).()); |
| 185 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionBeginOffsetPropertyNamecxx . . $ QTJSC/expressionBeginOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint - startOffset), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 186 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionCaretOffsetPropertyNamecxx . . $ QTJSC/expressionCaretOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 187 | exception->putWithAttributescxx . . $ QTJSC/JSObject#putWithAttributes(3dd2e6313723688d).(exec, Identifiercxx . . $ QTJSC/Identifier#Identifier(76b09fa744670831).(exec, expressionEndOffsetPropertyNamecxx . . $ QTJSC/expressionEndOffsetPropertyName.), jsNumbercxx . . $ QTJSC/jsNumber(1201607e1a2ad33d).(exec, divotPoint + endOffset), ReadOnlycxx . . $ QTJSC/ReadOnly. | DontDeletecxx . . $ QTJSC/DontDelete.); |
| 188 | return exception; |
| 189 | } |
| 190 | |
| 191 | } // namespace JSC |