Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 m_windowShell->updateSecurityOrigin(); | 146 m_windowShell->updateSecurityOrigin(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun ction, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> info[]) | 149 v8::Local<v8::Value> ScriptController::callFunction(v8::Handle<v8::Function> fun ction, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> info[]) |
| 150 { | 150 { |
| 151 // Keep Frame (and therefore ScriptController) alive. | 151 // Keep Frame (and therefore ScriptController) alive. |
| 152 RefPtr<Frame> protect(m_frame); | 152 RefPtr<Frame> protect(m_frame); |
| 153 return ScriptController::callFunction(m_frame->document(), function, receive r, argc, info, m_isolate); | 153 return ScriptController::callFunction(m_frame->document(), function, receive r, argc, info, m_isolate); |
| 154 } | 154 } |
| 155 | 155 |
| 156 static void resourceInfo(const v8::Handle<v8::Function> function, String& resour ceName, int& lineNumber) | 156 static bool resourceInfo(const v8::Handle<v8::Function> function, String& resour ceName, int& lineNumber) |
| 157 { | 157 { |
| 158 v8::ScriptOrigin origin = function->GetScriptOrigin(); | 158 v8::ScriptOrigin origin = function->GetScriptOrigin(); |
| 159 if (origin.ResourceName().IsEmpty()) { | 159 if (origin.ResourceName().IsEmpty()) { |
| 160 resourceName = "undefined"; | 160 resourceName = "undefined"; |
| 161 lineNumber = 1; | 161 lineNumber = 1; |
| 162 } else { | 162 } else { |
| 163 resourceName = toWebCoreString(origin.ResourceName()); | 163 V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<>, stringResourc eName, origin.ResourceName(), false); |
|
haraken
2013/11/15 16:23:11
Is there any code that wants to return other than
Inactive
2013/11/15 16:28:49
Yes, some call sites want to return something else
| |
| 164 resourceName = stringResourceName; | |
| 164 lineNumber = function->GetScriptLineNumber() + 1; | 165 lineNumber = function->GetScriptLineNumber() + 1; |
| 165 } | 166 } |
| 167 return true; | |
| 166 } | 168 } |
| 167 | 169 |
| 168 v8::Local<v8::Value> ScriptController::callFunction(ExecutionContext* context, v 8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8: :Handle<v8::Value> info[], v8::Isolate* isolate) | 170 v8::Local<v8::Value> ScriptController::callFunction(ExecutionContext* context, v 8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8: :Handle<v8::Value> info[], v8::Isolate* isolate) |
| 169 { | 171 { |
| 170 InspectorInstrumentationCookie cookie; | 172 InspectorInstrumentationCookie cookie; |
| 171 if (InspectorInstrumentation::timelineAgentEnabled(context)) { | 173 if (InspectorInstrumentation::timelineAgentEnabled(context)) { |
| 172 String resourceName; | 174 String resourceName; |
| 173 int lineNumber; | 175 int lineNumber; |
| 174 resourceInfo(function, resourceName, lineNumber); | 176 if (!resourceInfo(function, resourceName, lineNumber)) |
| 177 return v8::Local<v8::Value>(); | |
| 175 cookie = InspectorInstrumentation::willCallFunction(context, resourceNam e, lineNumber); | 178 cookie = InspectorInstrumentation::willCallFunction(context, resourceNam e, lineNumber); |
| 176 } | 179 } |
| 177 | 180 |
| 178 v8::Local<v8::Value> result = V8ScriptRunner::callFunction(function, context , receiver, argc, info, isolate); | 181 v8::Local<v8::Value> result = V8ScriptRunner::callFunction(function, context , receiver, argc, info, isolate); |
| 179 | 182 |
| 180 InspectorInstrumentation::didCallFunction(cookie); | 183 InspectorInstrumentation::didCallFunction(cookie); |
| 181 return result; | 184 return result; |
| 182 } | 185 } |
| 183 | 186 |
| 184 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8 ::Context> context, const ScriptSourceCode& source, AccessControlStatus corsStat us) | 187 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8 ::Context> context, const ScriptSourceCode& source, AccessControlStatus corsStat us) |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 687 v8Results = evaluateHandleScope.Close(resultArray); | 690 v8Results = evaluateHandleScope.Close(resultArray); |
| 688 } | 691 } |
| 689 | 692 |
| 690 if (results && !v8Results.IsEmpty()) { | 693 if (results && !v8Results.IsEmpty()) { |
| 691 for (size_t i = 0; i < v8Results->Length(); ++i) | 694 for (size_t i = 0; i < v8Results->Length(); ++i) |
| 692 results->append(ScriptValue(v8Results->Get(i), m_isolate)); | 695 results->append(ScriptValue(v8Results->Get(i), m_isolate)); |
| 693 } | 696 } |
| 694 } | 697 } |
| 695 | 698 |
| 696 } // namespace WebCore | 699 } // namespace WebCore |
| OLD | NEW |