示例#1
0
WorkerGlobalScope::WorkerGlobalScope(
    const KURL& url,
    const String& userAgent,
    WorkerThread* thread,
    double timeOrigin,
    std::unique_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilageData,
    WorkerClients* workerClients)
    : ActiveScriptWrappable(this),
      m_url(url),
      m_userAgent(userAgent),
      m_v8CacheOptions(V8CacheOptionsDefault),
      m_deprecationWarningBits(UseCounter::NumberOfFeatures),
      m_scriptController(
          WorkerOrWorkletScriptController::create(this, thread->isolate())),
      m_thread(thread),
      m_closing(false),
      m_eventQueue(WorkerEventQueue::create(this)),
      m_workerClients(workerClients),
      m_timers(Platform::current()
                   ->currentThread()
                   ->scheduler()
                   ->timerTaskRunner()
                   ->clone()),
      m_timeOrigin(timeOrigin),
      m_lastPendingErrorEventId(0) {
  InstanceCounters::incrementCounter(
      InstanceCounters::WorkerGlobalScopeCounter);
  setSecurityOrigin(SecurityOrigin::create(url));
  if (starterOriginPrivilageData)
    getSecurityOrigin()->transferPrivilegesFrom(
        std::move(starterOriginPrivilageData));

  if (m_workerClients)
    m_workerClients->reattachThread();
}
示例#2
0
void SecurityContext::enforceSandboxFlags(SandboxFlags mask)
{
    m_sandboxFlags |= mask;

    // The SandboxOrigin is stored redundantly in the security origin.
    if (isSandboxed(SandboxOrigin) && securityOrigin() && !securityOrigin()->isUnique())
        setSecurityOrigin(SecurityOrigin::createUnique());
}
WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThread* thread)
    : m_url(url)
    , m_userAgent(userAgent)
    , m_script(new WorkerScriptController(this))
    , m_thread(thread)
    , m_closing(false)
{
    setSecurityOrigin(SecurityOrigin::create(url));
}
示例#4
0
void SecurityContext::applySandboxFlags(SandboxFlags mask) {
  m_sandboxFlags |= mask;

  if (isSandboxed(SandboxOrigin) && getSecurityOrigin() &&
      !getSecurityOrigin()->isUnique()) {
    setSecurityOrigin(SecurityOrigin::createUnique());
    didUpdateSecurityOrigin();
  }
}
WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThread* thread)
    : m_url(url)
    , m_userAgent(userAgent)
    , m_script(new WorkerScriptController(this))
    , m_thread(thread)
#if ENABLE(INSPECTOR)
    , m_workerInspectorController(new WorkerInspectorController(this))
#endif
    , m_closing(false)
{
    setSecurityOrigin(SecurityOrigin::create(url));
}
示例#6
0
WorkerContext::WorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, WorkerThread* thread, PassRefPtr<SecurityOrigin> topOrigin)
    : m_url(url)
    , m_userAgent(userAgent)
    , m_groupSettings(settings)
    , m_script(adoptPtr(new WorkerScriptController(this)))
    , m_thread(thread)
    , m_workerInspectorController(adoptPtr(new WorkerInspectorController(this)))
    , m_closing(false)
    , m_eventQueue(WorkerEventQueue::create(this))
    , m_topOrigin(topOrigin)
{
    ScriptWrappable::init(this);
    setSecurityOrigin(SecurityOrigin::create(url));
}
示例#7
0
WorkerContext::WorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, WorkerThread* thread)
    : m_url(url)
    , m_userAgent(userAgent)
    , m_groupSettings(settings)
    , m_script(adoptPtr(new WorkerScriptController(this)))
    , m_thread(thread)
#if ENABLE(INSPECTOR)
    , m_workerInspectorController(adoptPtr(new WorkerInspectorController(this)))
#endif
    , m_closing(false)
    , m_eventQueue(WorkerEventQueue::create(this))
{
    setSecurityOrigin(SecurityOrigin::create(url));
}
示例#8
0
WorkerGlobalScope::WorkerGlobalScope(const URL& url, const String& userAgent, std::unique_ptr<GroupSettings> settings, WorkerThread& thread, PassRefPtr<SecurityOrigin> topOrigin)
    : m_url(url)
    , m_userAgent(userAgent)
    , m_groupSettings(WTF::move(settings))
//    , m_script(std::make_unique<WorkerScriptController>(this)) //CMP_ERROR_UNCLEAR
    , m_thread(thread)
#if ENABLE(INSPECTOR)
    , m_workerInspectorController(std::make_unique<WorkerInspectorController>(*this))
#endif
    , m_closing(false)
    , m_eventQueue(*this)
    , m_topOrigin(topOrigin)
{
    setSecurityOrigin(SecurityOrigin::create(url));
}
示例#9
0
WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThread* thread, const String& policy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType)
    : m_url(url)
    , m_userAgent(userAgent)
    , m_script(adoptPtr(new WorkerScriptController(this)))
    , m_thread(thread)
#if ENABLE(INSPECTOR)
    , m_workerInspectorController(adoptPtr(new WorkerInspectorController(this)))
#endif
    , m_closing(false)
    , m_eventQueue(WorkerEventQueue::create(this))
{
    setSecurityOrigin(SecurityOrigin::create(url));
    setContentSecurityPolicy(ContentSecurityPolicy::create(this));
    contentSecurityPolicy()->didReceiveHeader(policy, contentSecurityPolicyType);
}
WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, WorkerThread* thread, double timeOrigin, PassOwnPtr<WorkerClients> workerClients)
    : m_url(url)
    , m_userAgent(userAgent)
    , m_script(adoptPtr(new WorkerScriptController(*this)))
    , m_thread(thread)
    , m_workerInspectorController(adoptPtr(new WorkerInspectorController(this)))
    , m_closing(false)
    , m_eventQueue(WorkerEventQueue::create(this))
    , m_workerClients(workerClients)
    , m_timeOrigin(timeOrigin)
{
    ScriptWrappable::init(this);
    setClient(this);
    setSecurityOrigin(SecurityOrigin::create(url));
    m_workerClients->reattachThread();
}
示例#11
0
WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, WorkerThread* thread, double timeOrigin, const SecurityOrigin* starterOrigin, PassOwnPtrWillBeRawPtr<WorkerClients> workerClients)
    : m_url(url)
    , m_userAgent(userAgent)
    , m_script(adoptPtr(new WorkerScriptController(*this)))
    , m_thread(thread)
    , m_workerInspectorController(adoptRefWillBeNoop(new WorkerInspectorController(this)))
    , m_closing(false)
    , m_eventQueue(WorkerEventQueue::create(this))
    , m_workerClients(workerClients)
    , m_timeOrigin(timeOrigin)
    , m_messageStorage(ConsoleMessageStorage::createForWorker(this))
    , m_workerExceptionUniqueIdentifier(0)
{
    setSecurityOrigin(SecurityOrigin::create(url));
    if (starterOrigin)
        securityOrigin()->transferPrivilegesFrom(*starterOrigin);

    m_workerClients->reattachThread();
    m_thread->setWorkerInspectorController(m_workerInspectorController.get());
}
WorkerGlobalScope::WorkerGlobalScope(const KURL& url, const String& userAgent, WorkerThread* thread, double timeOrigin, PassOwnPtr<SecurityOrigin::PrivilegeData> starterOriginPrivilageData, RawPtr<WorkerClients> workerClients)
    : m_url(url)
    , m_userAgent(userAgent)
    , m_v8CacheOptions(V8CacheOptionsDefault)
    , m_scriptController(WorkerOrWorkletScriptController::create(this, thread->isolate()))
    , m_thread(thread)
    , m_workerInspectorController(WorkerInspectorController::create(this))
    , m_closing(false)
    , m_eventQueue(WorkerEventQueue::create(this))
    , m_workerClients(workerClients)
    , m_timers(Platform::current()->currentThread()->scheduler()->timerTaskRunner()->adoptClone())
    , m_timeOrigin(timeOrigin)
    , m_messageStorage(ConsoleMessageStorage::create())
    , m_workerExceptionUniqueIdentifier(0)
{
    setSecurityOrigin(SecurityOrigin::create(url));
    if (starterOriginPrivilageData)
        getSecurityOrigin()->transferPrivilegesFrom(starterOriginPrivilageData);

    if (m_workerClients)
        m_workerClients->reattachThread();
}
示例#13
0
void RemoteSecurityContext::setReplicatedOrigin(
    PassRefPtr<SecurityOrigin> origin) {
  DCHECK(origin);
  setSecurityOrigin(std::move(origin));
  contentSecurityPolicy()->setupSelf(*getSecurityOrigin());
}