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

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

Issue 2049163003: Fixes ASan crash for an embedded Blink-in-JS component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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/LayoutTests/bindings/blink-in-js-asan-crash-expected.txt ('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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 && v8Call(message->GetStartColumn(scriptState->context()), columnNumber) ) 138 && v8Call(message->GetStartColumn(scriptState->context()), columnNumber) )
139 ++columnNumber; 139 ++columnNumber;
140 return ErrorEvent::create(errorMessage, resourceName, lineNumber, columnNumb er, &scriptState->world()); 140 return ErrorEvent::create(errorMessage, resourceName, lineNumber, columnNumb er, &scriptState->world());
141 } 141 }
142 142
143 static void messageHandlerInMainThread(v8::Local<v8::Message> message, v8::Local <v8::Value> data) 143 static void messageHandlerInMainThread(v8::Local<v8::Message> message, v8::Local <v8::Value> data)
144 { 144 {
145 ASSERT(isMainThread()); 145 ASSERT(isMainThread());
146 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 146 v8::Isolate* isolate = v8::Isolate::GetCurrent();
147 147
148 if (isolate->GetEnteredContext().IsEmpty())
149 return;
150
148 // If called during context initialization, there will be no entered context . 151 // If called during context initialization, there will be no entered context .
149 ScriptState* scriptState = ScriptState::current(isolate); 152 ScriptState* scriptState = ScriptState::current(isolate);
150 if (!scriptState->contextIsValid()) 153 if (!scriptState->contextIsValid())
151 return; 154 return;
152 155
153 int scriptId = 0; 156 int scriptId = 0;
154 RefPtr<ScriptCallStack> callStack = extractCallStack(isolate, message, &scri ptId); 157 RefPtr<ScriptCallStack> callStack = extractCallStack(isolate, message, &scri ptId);
155 158
156 AccessControlStatus accessControlStatus = NotSharableCrossOrigin; 159 AccessControlStatus accessControlStatus = NotSharableCrossOrigin;
157 if (message->IsOpaque()) 160 if (message->IsOpaque())
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 473
471 isolate->AddMessageListener(messageHandlerInWorker); 474 isolate->AddMessageListener(messageHandlerInWorker);
472 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); 475 isolate->SetFatalErrorHandler(reportFatalErrorInWorker);
473 476
474 uint32_t here; 477 uint32_t here;
475 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*))); 478 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*)));
476 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); 479 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker);
477 } 480 }
478 481
479 } // namespace blink 482 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/bindings/blink-in-js-asan-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698