diff options
| author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-05-26 12:35:12 +0200 |
|---|---|---|
| committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-05-26 12:00:45 +0000 |
| commit | 627e1cb38636f028f54ad7618477d021d6bc2083 (patch) | |
| tree | 7774ea5018990dcc0847d46d334bfe7bc29cdd18 | |
| parent | 6b708459d882a769dc5ac3e7a3d343dc7c8c3146 (diff) | |
| download | qtwebengine-chromium-627e1cb38636f028f54ad7618477d021d6bc2083.tar.gz | |
[Backport] Check the mime type of cross-origin CSS fetched via the Service Worker.
BUG=598077
Review URL: https://codereview.chromium.org/1861243002
(CVE-2016-1692)
Change-Id: I0a105a58cf589ad084915ec7efbefe41619b4313
Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
| -rw-r--r-- | chromium/third_party/WebKit/Source/core/css/StyleSheetContents.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/chromium/third_party/WebKit/Source/core/css/StyleSheetContents.cpp b/chromium/third_party/WebKit/Source/core/css/StyleSheetContents.cpp index 15645ca03bc..86c33bc722d 100644 --- a/chromium/third_party/WebKit/Source/core/css/StyleSheetContents.cpp +++ b/chromium/third_party/WebKit/Source/core/css/StyleSheetContents.cpp @@ -282,6 +282,16 @@ void StyleSheetContents::parseAuthorStyleSheet(const CSSStyleSheetResource* cach TRACE_EVENT1("blink,devtools.timeline", "ParseAuthorStyleSheet", "data", InspectorParseAuthorStyleSheetEvent::data(cachedStyleSheet)); bool isSameOriginRequest = securityOrigin && securityOrigin->canRequest(baseURL()); + + // When the response was fetched via the Service Worker, the original URL may not be same as the base URL. + // TODO(horo): When we will use the original URL as the base URL, we can remove this check. crbug.com/553535 + if (cachedStyleSheet->response().wasFetchedViaServiceWorker()) { + const KURL originalURL(cachedStyleSheet->response().originalURLViaServiceWorker()); + // |originalURL| is empty when the response is created in the SW. + if (!originalURL.isEmpty() && !securityOrigin->canRequest(originalURL)) + isSameOriginRequest = false; + } + CSSStyleSheetResource::MIMETypeCheck mimeTypeCheck = isQuirksModeBehavior(m_parserContext.mode()) && isSameOriginRequest ? CSSStyleSheetResource::MIMETypeCheck::Lax : CSSStyleSheetResource::MIMETypeCheck::Strict; String sheetText = cachedStyleSheet->sheetText(mimeTypeCheck); |
