Commit 7ee89772 authored by horo@chromium.org's avatar horo@chromium.org

Add ASSERT() to avoid accidental leaking ServiceWorkerContainer to cross origin context.

BUG=522791

Review URL: https://codereview.chromium.org/1305903007

git-svn-id: svn://svn.chromium.org/blink/trunk@201889 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b81d81a7
...@@ -54,8 +54,9 @@ const char* NavigatorServiceWorker::supplementName() ...@@ -54,8 +54,9 @@ const char* NavigatorServiceWorker::supplementName()
return "NavigatorServiceWorker"; return "NavigatorServiceWorker";
} }
ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(Navigator& navigator, ExceptionState& exceptionState) ServiceWorkerContainer* NavigatorServiceWorker::serviceWorker(ExecutionContext* executionContext, Navigator& navigator, ExceptionState& exceptionState)
{ {
ASSERT(!navigator.frame() || executionContext->securityOrigin()->canAccessCheckSuborigins(navigator.frame()->securityContext()->securityOrigin()));
return NavigatorServiceWorker::from(navigator).serviceWorker(exceptionState); return NavigatorServiceWorker::from(navigator).serviceWorker(exceptionState);
} }
......
...@@ -26,7 +26,7 @@ public: ...@@ -26,7 +26,7 @@ public:
virtual ~NavigatorServiceWorker(); virtual ~NavigatorServiceWorker();
static ServiceWorkerContainer* serviceWorker(Navigator&, ExceptionState&); static ServiceWorkerContainer* serviceWorker(ExecutionContext*, Navigator&, ExceptionState&);
DECLARE_VIRTUAL_TRACE(); DECLARE_VIRTUAL_TRACE();
......
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#navigator-service-worker // https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#navigator-service-worker
partial interface Navigator { partial interface Navigator {
[RaisesException] readonly attribute ServiceWorkerContainer serviceWorker; [RaisesException, CallWith=ExecutionContext] readonly attribute ServiceWorkerContainer serviceWorker;
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment