Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Unified Diff: third_party/WebKit/Source/core/html/HTMLLinkElement.cpp

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: Move API change to another patch and address comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLLinkElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp b/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp
index d7c296d5ff41a0f409326dc1c4d7b1729f323c9b..20994908b8bc876374d81b8b76daa54784936cd0 100644
--- a/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp
@@ -45,6 +45,19 @@
namespace blink {
+namespace {
+WebServiceWorkerUpdateViaCache ParseUpdateViaCache(const AtomicString& value) {
+ if (value == "imports")
+ return WebServiceWorkerUpdateViaCache::kImports;
+ if (value == "all")
+ return WebServiceWorkerUpdateViaCache::kAll;
+ if (value == "none")
+ return WebServiceWorkerUpdateViaCache::kNone;
+ // Default value
+ return WebServiceWorkerUpdateViaCache::kImports;
+}
+} // namespace
+
using namespace HTMLNames;
inline HTMLLinkElement::HTMLLinkElement(Document& document,
@@ -102,6 +115,9 @@ void HTMLLinkElement::ParseAttribute(
} else if (name == scopeAttr) {
scope_ = value;
Process();
+ } else if (name == updateviacacheAttr) {
+ update_via_cache_ = ParseUpdateViaCache(value);
+ Process();
} else if (name == disabledAttr) {
UseCounter::Count(GetDocument(), WebFeature::kHTMLLinkElementDisabled);
if (LinkStyle* link = GetLinkStyle())

Powered by Google App Engine
This is Rietveld 408576698