Commit a5669ac0 authored by tapted@chromium.org's avatar tapted@chromium.org

Revert of ServiceWorker: Prevent worker script with incorrect MIME type to be...

Revert of ServiceWorker: Prevent worker script with incorrect MIME type to be registered. (https://codereview.chromium.org/446323002/)

Reason for revert:
Suspected for breakage on Mac waterfall bots (10.6/10.7)

test ServiceWorkerBrowserTest.ImportsBustMemcache failing since

http://build.chromium.org/p/chromium.mac/builders/Mac10.6%20Tests%20%281%29/builds/54624
http://build.chromium.org/p/chromium.mac/builders/Mac10.7%20Tests%20%281%29/builds/25141

Times out. errors like

[ RUN      ] ServiceWorkerBrowserTest.ImportsBustMemcache
[16435:263:0812/001516:2160051331590:INFO:CONSOLE(13)] "initial unregistration done", source: http://127.0.0.1:58683/service_worker/imports_bust_memcache.html (13)
BrowserTestBase signal handler received SIGTERM. Backtrace:
0   content_browsertests                0x6249bcaa base::debug::StackTrace::StackTrace() + 26
..
11  AppKit                              0x96eeddd6 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 156
12  AppKit                              0x96eb01f3 -[NSApplication run] + 821
..
19  content_browsertests                0x6228bf46 content::TitleWatcher::WaitAndGetTitle() + 118
20  content_browsertests                0x61ed5252 content::ServiceWorkerBrowserTest_ImportsBustMemcache_Test::RunTestOnMainThread() + 530
[649/649] ServiceWorkerBrowserTest.ImportsBustMemcache (TIMED OUT)

Original issue's description:
> ServiceWorker: Prevent worker script with incorrect MIME type to be registered.
> 
> Fix for spec update: https://github.com/slightlyoff/ServiceWorker/issues/380.
> A valid worker script MIME type should be one of below:
> application/x-javascript
> text/javascript
> application/javascript
> 
> BUG=400604
> TEST=https://codereview.chromium.org/448063002/
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=288922

TBR=falken@chromium.org,michaeln@chromium.org,thestig@chromium.org,xiang.long@intel.com
NOTREECHECKS=true
NOTRY=true
BUG=400604

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

Cr-Commit-Position: refs/heads/master@{#288927}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288927 0039d316-1c4b-4281-b951-d872f2087c98
parent 8d08e647
......@@ -49,8 +49,6 @@ static void ExpectResultAndRun(bool expected,
IN_PROC_BROWSER_TEST_F(ChromeServiceWorkerTest,
CanShutDownWithRegisteredServiceWorker) {
WriteFile(FILE_PATH_LITERAL("service_worker.js"), "");
WriteFile(FILE_PATH_LITERAL("service_worker.js.mock-http-headers"),
"HTTP/1.1 200 OK\nContent-Type: text/javascript");
embedded_test_server()->ServeFilesFromDirectory(service_worker_dir_.path());
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
......
......@@ -301,18 +301,6 @@ void ServiceWorkerWriteToCacheJob::OnResponseStarted(
// response to our consumer, just don't cache it?
return;
}
// To prevent most user-uploaded content from being used as a serviceworker.
if (version_->script_url() == url_) {
std::string mime_type;
request->GetMimeType(&mime_type);
if (mime_type != "application/x-javascript" &&
mime_type != "text/javascript" &&
mime_type != "application/javascript") {
AsyncNotifyDoneHelper(net::URLRequestStatus(
net::URLRequestStatus::FAILED, net::ERR_FAILED));
return;
}
}
WriteHeadersToCache();
}
......
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