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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp

Issue 2244203002: Fix "report the exception" in Custom Elements V1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: haraken/yukishiino reviews Created 4 years, 3 months 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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 581
582 // Store a timestamp to the cache as hint. 582 // Store a timestamp to the cache as hint.
583 void V8ScriptRunner::setCacheTimeStamp(CachedMetadataHandler* cacheHandler) 583 void V8ScriptRunner::setCacheTimeStamp(CachedMetadataHandler* cacheHandler)
584 { 584 {
585 double now = WTF::currentTime(); 585 double now = WTF::currentTime();
586 unsigned tag = cacheTag(CacheTagTimeStamp, cacheHandler); 586 unsigned tag = cacheTag(CacheTagTimeStamp, cacheHandler);
587 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally); 587 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally);
588 cacheHandler->setCachedMetadata(tag, reinterpret_cast<char*>(&now), sizeof(n ow), CachedMetadataHandler::SendToPlatform); 588 cacheHandler->setCachedMetadata(tag, reinterpret_cast<char*>(&now), sizeof(n ow), CachedMetadataHandler::SendToPlatform);
589 } 589 }
590 590
591 void V8ScriptRunner::throwException(v8::Isolate* isolate, v8::Local<v8::Value> e xception, const v8::ScriptOrigin& origin)
592 {
593 // In order for the current TryCatch to catch this exception and
594 // call MessageCallback when SetVerbose(true), create a v8::Function
595 // that calls isolate->throwException().
596 // Unlike throwStackOverflowExceptionIfNeeded(), create a temporary Script
597 // with the specified ScriptOrigin. When the exception was created but not
598 // thrown yet, the ScriptOrigin of the thrower is set to the exception.
599 // v8::Function::New() has empty ScriptOrigin, and thus the exception will
600 // be "muted" (sanitized in our terminology) if CORS does not allow.
601 // https://html.spec.whatwg.org/multipage/webappapis.html#report-the-error
602 // Avoid compile and run scripts when API is available: crbug.com/639739
603 v8::Local<v8::Script> script = compileWithoutOptions(
604 V8CompileHistogram::Cacheability::Noncacheable, isolate,
605 v8AtomicString(isolate, "((e) => { throw e; })"), origin)
606 .ToLocalChecked();
607 v8::Local<v8::Function> thrower = runCompiledInternalScript(isolate, script)
608 .ToLocalChecked().As<v8::Function>();
609 v8::Local<v8::Value> args[] = { exception };
610 callInternalFunction(thrower, thrower, WTF_ARRAY_LENGTH(args), args, isolate );
611 }
612
591 } // namespace blink 613 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698