Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: sky/engine/bindings/core/v8/ScriptController.cpp

Issue 688033003: Fix line numbers in JavaScript stack traces (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Remove unnecessary Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 evaluationResult = v8::Local<v8::Value>::New(m_isolate, v8::Undefine d(m_isolate)); 322 evaluationResult = v8::Local<v8::Value>::New(m_isolate, v8::Undefine d(m_isolate));
323 resultArray->Set(i, evaluationResult); 323 resultArray->Set(i, evaluationResult);
324 } 324 }
325 325
326 if (results) { 326 if (results) {
327 for (size_t i = 0; i < resultArray->Length(); ++i) 327 for (size_t i = 0; i < resultArray->Length(); ++i)
328 results->append(handleScope.Escape(resultArray->Get(i))); 328 results->append(handleScope.Escape(resultArray->Get(i)));
329 } 329 }
330 } 330 }
331 331
332 void ScriptController::executeModuleScript(Document& document, const String& sou rce) 332 void ScriptController::executeModuleScript(Document& document, const String& sou rce, const TextPosition& textPosition)
333 { 333 {
334 v8::HandleScope handleScope(m_isolate); 334 v8::HandleScope handleScope(m_isolate);
335 v8::Handle<v8::Context> context = toV8Context(m_frame, DOMWrapperWorld::main World()); 335 v8::Handle<v8::Context> context = toV8Context(m_frame, DOMWrapperWorld::main World());
336 if (context.IsEmpty()) 336 if (context.IsEmpty())
337 return; 337 return;
338 338
339 ScriptState* scriptState = ScriptState::from(context); 339 ScriptState* scriptState = ScriptState::from(context);
340 ScriptState::Scope scope(scriptState); 340 ScriptState::Scope scope(scriptState);
341 341
342 RefPtr<LocalFrame> protect(m_frame); 342 RefPtr<LocalFrame> protect(m_frame);
343 343
344 v8::TryCatch tryCatch; 344 v8::TryCatch tryCatch;
345 tryCatch.SetVerbose(true); 345 tryCatch.SetVerbose(true);
346 346
347 V8ScriptModule module; 347 V8ScriptModule module;
348 module.resourceName = document.url().string();
349 module.textPosition = textPosition;
348 module.receiver = toV8(&document, context->Global(), m_isolate); 350 module.receiver = toV8(&document, context->Global(), m_isolate);
351 module.source = source;
349 352
350 if (HTMLImport* parent = document.import()) { 353 if (HTMLImport* parent = document.import()) {
351 for (HTMLImport* child = parent->firstChild(); child; child = child->nex t()) { 354 for (HTMLImport* child = parent->firstChild(); child; child = child->nex t()) {
352 if (HTMLLinkElement* link = static_cast<HTMLImportChild*>(child)->li nk()) { 355 if (HTMLLinkElement* link = static_cast<HTMLImportChild*>(child)->li nk()) {
353 String name = link->as(); 356 String name = link->as();
354 if (!name.isEmpty()) { 357 if (!name.isEmpty()) {
355 module.formalDependenciesAndSource.append(v8String(m_isolate , name)); 358 module.formalDependencies.append(name);
356 v8::Handle<v8::Value> actual; 359 v8::Handle<v8::Value> actual;
357 if (child->document()) 360 if (child->document())
358 actual = child->document()->exports().v8Value(); 361 actual = child->document()->exports().v8Value();
359 if (actual.IsEmpty()) 362 if (actual.IsEmpty())
360 actual = v8::Undefined(m_isolate); 363 actual = v8::Undefined(m_isolate);
361 module.resolvedDependencies.append(actual); 364 module.resolvedDependencies.append(actual);
362 } 365 }
363 } 366 }
364 } 367 }
365 } 368 }
366 369
367 module.formalDependenciesAndSource.append(v8String(m_isolate, source));
368 V8ScriptRunner::runModule(m_isolate, m_frame->document(), module); 370 V8ScriptRunner::runModule(m_isolate, m_frame->document(), module);
369 } 371 }
370 372
371 } // namespace blink 373 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/bindings/core/v8/ScriptController.h ('k') | sky/engine/bindings/core/v8/V8PerContextData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698