{
}
- virtual ScriptValue call(ScriptValue arg) OVERRIDE
+ virtual ScriptValue call(ScriptValue arg) override
{
m_owner.m_arg = arg;
m_owner.m_callCount++;
{
}
- virtual ~ExpectDOMException() OVERRIDE { }
+ virtual ~ExpectDOMException() override { }
- virtual void operator()(ScriptValue value) const OVERRIDE
+ virtual void operator()(ScriptValue value) const override
{
DOMException* exception = V8DOMException::toImplWithTypeCheck(value.isolate(), value.v8Value());
EXPECT_TRUE(exception) << "the value should be a DOMException";
class NotReachedWebServiceWorkerProvider : public WebServiceWorkerProvider {
public:
- virtual ~NotReachedWebServiceWorkerProvider() OVERRIDE { }
+ virtual ~NotReachedWebServiceWorkerProvider() override { }
- virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scriptURL, WebServiceWorkerRegistrationCallbacks* callbacks) OVERRIDE
+ virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scriptURL, WebServiceWorkerRegistrationCallbacks* callbacks) override
{
ADD_FAILURE() << "the provider should not be called to register a Service Worker";
delete callbacks;
ServiceWorkerContainer* container = ServiceWorkerContainer::create(executionContext());
ScriptState::Scope scriptScope(scriptState());
- RegistrationOptionList* options = RegistrationOptionList::create();
- options->setScope(scope);
- ScriptPromise promise = container->registerServiceWorker(scriptState(), scriptURL, *options);
+ RegistrationOptions options;
+ options.setScope(scope);
+ ScriptPromise promise = container->registerServiceWorker(scriptState(), scriptURL, options);
expectRejected(scriptState(), promise, valueTest);
container->willBeDetachedFromFrame();
ExpectDOMException("SecurityError", "The scope must match the current origin."));
}
+TEST_F(ServiceWorkerContainerTest, Register_DifferentDirectoryThanScript)
+{
+ setPageURL("https://www.example.com/");
+ testRegisterRejected(
+ "https://www.example.com/js/worker.js",
+ "https://www.example.com/",
+ ExpectDOMException("SecurityError", "The scope must be under the directory of the script URL."));
+}
+
TEST_F(ServiceWorkerContainerTest, GetRegistration_NonSecureOriginIsRejected)
{
setPageURL("http://www.example.com/");
{
}
- virtual ~WebServiceWorkerProviderImpl() OVERRIDE { }
+ virtual ~WebServiceWorkerProviderImpl() override { }
- virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scriptURL, WebServiceWorkerRegistrationCallbacks* callbacks) OVERRIDE
+ virtual void registerServiceWorker(const WebURL& pattern, const WebURL& scriptURL, WebServiceWorkerRegistrationCallbacks* callbacks) override
{
m_owner.m_registerCallCount++;
m_owner.m_registerScope = pattern;
m_registrationCallbacksToDelete.append(adoptPtr(callbacks));
}
- virtual void getRegistration(const WebURL& documentURL, WebServiceWorkerGetRegistrationCallbacks* callbacks) OVERRIDE
+ virtual void getRegistration(const WebURL& documentURL, WebServiceWorkerGetRegistrationCallbacks* callbacks) override
{
m_owner.m_getRegistrationCallCount++;
m_owner.m_getRegistrationURL = documentURL;
// register
{
ScriptState::Scope scriptScope(scriptState());
- RegistrationOptionList* options = RegistrationOptionList::create();
- options->setScope("y/");
- container->registerServiceWorker(scriptState(), "/z/worker.js", *options);
+ RegistrationOptions options;
+ options.setScope("y/");
+ container->registerServiceWorker(scriptState(), "/x/y/worker.js", options);
EXPECT_EQ(1ul, stubProvider.registerCallCount());
EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/y/")), stubProvider.registerScope());
- EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/z/worker.js")), stubProvider.registerScriptURL());
+ EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/y/worker.js")), stubProvider.registerScriptURL());
}
container->willBeDetachedFromFrame();