本文整理汇总了C++中DOMWindow::isCurrentlyDisplayedInFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMWindow::isCurrentlyDisplayedInFrame方法的具体用法?C++ DOMWindow::isCurrentlyDisplayedInFrame怎么用?C++ DOMWindow::isCurrentlyDisplayedInFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMWindow
的用法示例。
在下文中一共展示了DOMWindow::isCurrentlyDisplayedInFrame方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: messageHandlerInMainThread
static void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data)
{
DOMWindow* firstWindow = firstDOMWindow();
if (!firstWindow->isCurrentlyDisplayedInFrame())
return;
String errorMessage = toWebCoreString(message->Get());
v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
RefPtr<ScriptCallStack> callStack;
// Currently stack trace is only collected when inspector is open.
if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture);
v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsString();
String resource = shouldUseDocumentURL ? firstWindow->document()->url() : toWebCoreString(resourceName);
RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, message->GetLineNumber(), message->GetStartColumn());
// messageHandlerInMainThread can be called while we're creating a new context.
// Since we cannot create a wrapper in the intermediate timing, we need to skip
// creating a wrapper for |event|.
DOMWrapperWorld* world = DOMWrapperWorld::current();
Frame* frame = firstWindow->document()->frame();
if (world && frame && frame->script()->existingWindowShell(world)) {
v8::Local<v8::Value> wrappedEvent = toV8(event.get(), v8::Handle<v8::Object>(), v8::Isolate::GetCurrent());
if (!wrappedEvent.IsEmpty()) {
ASSERT(wrappedEvent->IsObject());
v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenPropertyName::error(), data);
}
}
AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin;
firstWindow->document()->reportException(event.release(), callStack, corsStatus);
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:34,代码来源:V8Initializer.cpp
示例2: mainWorldContext
static v8::Local<v8::Context> toV8Context(NPP npp, NPObject* npObject)
{
V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
DOMWindow* window = object->rootObject;
if (!window || !window->isCurrentlyDisplayedInFrame())
return v8::Local<v8::Context>();
return ScriptController::mainWorldContext(object->rootObject->frame());
}
示例3: mainWorldContext
static v8::Local<v8::Context> mainWorldContext(v8::Isolate* isolate, NPP npp, NPObject* npObject)
{
ASSERT(npObject->_class == &V8NPObjectClass);
V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject);
DOMWindow* window = object->rootObject;
if (!window || !window->isCurrentlyDisplayedInFrame())
return v8::Local<v8::Context>();
return toV8Context(isolate, object->rootObject->frame(), DOMWrapperWorld::mainWorld());
}
示例4: toFrameIfNotDetached
Frame* toFrameIfNotDetached(v8::Handle<v8::Context> context)
{
DOMWindow* window = toDOMWindow(context);
if (window->isCurrentlyDisplayedInFrame())
return window->frame();
// We return 0 here because |context| is detached from the Frame. If we
// did return |frame| we could get in trouble because the frame could be
// navigated to another security origin.
return 0;
}
示例5: ASSERT
RefPtr<Database> DOMWindowWebDatabase::openDatabase(DOMWindow& window, const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback> creationCallback, ExceptionCode& ec)
{
if (!window.isCurrentlyDisplayedInFrame())
return nullptr;
RefPtr<Database> database = nullptr;
DatabaseManager& dbManager = DatabaseManager::singleton();
DatabaseError error = DatabaseError::None;
if (dbManager.isAvailable() && window.document()->securityOrigin()->canAccessDatabase(window.document()->topOrigin())) {
database = dbManager.openDatabase(window.document(), name, version, displayName, estimatedSize, creationCallback, error);
ASSERT(database || error != DatabaseError::None);
ec = DatabaseManager::exceptionCodeForDatabaseError(error);
} else
ec = SECURITY_ERR;
return database;
}
示例6: reportUncaughtException
static void reportUncaughtException(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data)
{
DOMWindow* firstWindow = firstDOMWindow(BindingState::instance());
if (!firstWindow->isCurrentlyDisplayedInFrame())
return;
String errorMessage = toWebCoreString(message->Get());
v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace();
RefPtr<ScriptCallStack> callStack;
// Currently stack trace is only collected when inspector is open.
if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0)
callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture);
v8::Handle<v8::Value> resourceName = message->GetScriptResourceName();
bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsString();
String resource = shouldUseDocumentURL ? firstWindow->document()->url() : toWebCoreString(resourceName);
firstWindow->document()->reportException(errorMessage, message->GetLineNumber(), resource, callStack);
}
示例7: ASSERT
PassRefPtr<Database> DOMWindowWebDatabase::openDatabase(DOMWindow& window, const String& name, const String& version, const String& displayName, unsigned long estimatedSize, PassOwnPtr<DatabaseCallback> creationCallback, ExceptionState& exceptionState)
{
if (!window.isCurrentlyDisplayedInFrame())
return nullptr;
RefPtr<Database> database = nullptr;
DatabaseManager& dbManager = DatabaseManager::manager();
DatabaseError error = DatabaseError::None;
if (RuntimeEnabledFeatures::databaseEnabled() && window.document()->securityOrigin()->canAccessDatabase()) {
String errorMessage;
database = dbManager.openDatabase(window.document(), name, version, displayName, estimatedSize, creationCallback, error, errorMessage);
ASSERT(database || error != DatabaseError::None);
if (error != DatabaseError::None)
DatabaseManager::throwExceptionForDatabaseError(error, errorMessage, exceptionState);
} else {
exceptionState.throwSecurityError("Access to the WebDatabase API is denied in this context.");
}
return database;
}
示例8: WTFMove
ExceptionOr<RefPtr<Database>> DOMWindowWebDatabase::openDatabase(DOMWindow& window, const String& name, const String& version, const String& displayName, unsigned estimatedSize, RefPtr<DatabaseCallback>&& creationCallback)
{
if (!window.isCurrentlyDisplayedInFrame())
return RefPtr<Database> { nullptr };
auto& manager = DatabaseManager::singleton();
if (!manager.isAvailable())
return Exception { SecurityError };
auto* document = window.document();
if (!document)
return Exception { SecurityError };
document->addConsoleMessage(MessageSource::Storage, MessageLevel::Warning, "Web SQL is deprecated. Please use IndexedDB instead.");
auto& securityOrigin = document->securityOrigin();
if (!securityOrigin.canAccessDatabase(document->topOrigin()))
return Exception { SecurityError };
auto result = manager.openDatabase(*window.document(), name, version, displayName, estimatedSize, WTFMove(creationCallback));
if (result.hasException()) {
// FIXME: To preserve our past behavior, this discards the error string in the exception.
// At a later time we may decide that we want to use the error strings, and if so we can just return the exception as is.
return Exception { result.releaseException().code() };
}
return RefPtr<Database> { result.releaseReturnValue() };
}