Пример #1
0
bool StorageArea::canAccessStorage(LocalFrame* frame)
{
    if (!frame || !frame->page())
        return false;

    // LocalFrameLifecycleObserver is used to safely keep the cached
    // reference to the LocalFrame. Should the LocalFrame die before
    // this StorageArea does, that cached reference will be cleared.
    if (this->frame() == frame)
        return m_canAccessStorageCachedResult;
    StorageNamespaceController* controller = StorageNamespaceController::from(frame->page());
    if (!controller)
        return false;
    bool result = controller->storageClient()->canAccessStorage(frame, m_storageType);
    // Move attention to the new LocalFrame.
    LocalFrameLifecycleObserver::setContext(frame);
    m_canAccessStorageCachedResult = result;
    return result;
}
Пример #2
0
bool StorageArea::canAccessStorage(LocalFrame* frame) {
  if (!frame || !frame->page())
    return false;

  // Should the LocalFrame die before this StorageArea does,
  // that cached reference will be cleared.
  if (m_frameUsedForCanAccessStorage == frame)
    return m_canAccessStorageCachedResult;
  StorageNamespaceController* controller =
      StorageNamespaceController::from(frame->page());
  if (!controller)
    return false;
  bool result =
      controller->getStorageClient()->canAccessStorage(frame, m_storageType);
  // Move attention to the new LocalFrame.
  m_frameUsedForCanAccessStorage = frame;
  m_canAccessStorageCachedResult = result;
  return result;
}