Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Runtime feature flag for Server-Timing
https://bugs.webkit.org/show_bug.cgi?id=184758 Patch by Charles Vazac <cvazac@gmail.com> on 2018-05-11 Reviewed by Youenn Fablet. Source/WebCore: * Source/WebCore/CMakeLists.txt: Added reference to PerformanceServerTiming.idl. * Source/WebCore/DerivedSources.make: Added reference to PerformanceServerTiming.idl. * Source/WebCore/Sources.txt: Added reference to PerformanceServerTiming.cpp and JSPerformanceServerTiming.cpp. * Source/WebCore/WebCore.xcodeproj/project.pbxproj: Added references to PerformanceServerTiming.cpp, PerformanceServerTiming.h, and PerformanceServerTiming.idl. * Source/WebCore/bindings/js/WebCoreBuiltinNames.h: Added PerformanceServerTiming. * Source/WebCore/page/PerformanceResourceTiming.h: Added serverTiming member. * Source/WebCore/page/PerformanceResourceTiming.idl: Added serverTiming attribute. * Source/WebCore/page/PerformanceServerTiming.cpp: Added. * Source/WebCore/page/PerformanceServerTiming.h: Added. * Source/WebCore/page/PerformanceServerTiming.idl: Added. Source/WebKit: * Shared/WebPreferences.yaml: Added ServerTimingEnabled. * UIProcess/API/C/WKPreferences.cpp: (WKPreferencesGetServerTimingEnabled): * UIProcess/API/C/WKPreferencesRefPrivate.h: WK_EXPORT for WKPreferencesSetServerTimingEnabled. * WebProcess/Storage/WebSWContextManagerConnection.cpp: Call setServerTimingEnabled. Source/WebKitLegacy: * mac/WebView/WebPreferenceKeysPrivate.h: Added server-timing preference. * mac/WebView/WebPreferences.mm: (WebKit::WebPreferences::serverTimingEnabled): (WebKit::WebPreferences::setServerTimingEnabled): * mac/WebView/WebPreferencesPrivate.h: (WebKit::WebPreferences::setServerTimingEnabled): (WebKit::WebPreferences::serverTimingEnabled): * mac/WebView/WebView.mm: Set runtime enabled feature based on preference. * win/Interfaces/IWebPreferencesPrivate.idl: define serverTimingEnabled and setServerTimingEnabled. * win/WebPreferenceKeysPrivate.h: Added server-timing preference. * win/WebPreferences.cpp: Initialize server-timing as false and define setter and getter. (WebKit::WebPreferences::serverTimingEnabled): (WebKit::WebPreferences::setServerTimingEnabled): * win/WebPreferences.h: Define serverTimingEnabled and setServerTimingEnabled. * win/WebView.cpp: Set runtime enabled feature based on preference. Tools: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: added ENABLE_SERVER_TIMING. * DumpRenderTree/win/DumpRenderTree.cpp: enable Server Timing LayoutTests: * imported/w3c/resources/import-expectations.json: Import server-timing tests. * imported/w3c/web-platform-tests/server-timing/resource_timing_idl.html: Added. * imported/w3c/web-platform-tests/server-timing/resource_timing_idl-expected.txt: Added. * platform/ios-wk1/TestExpectations: Skip service-worker test. * platform/mac-wk1/TestExpectations: Skip service-worker test. * platform/win/TestExpectations: Skip service-worker test. Canonical link: https://commits.webkit.org/201041@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231709 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
359 additions
and 2 deletions.
- +14 −0 LayoutTests/ChangeLog
- +1 −1 LayoutTests/imported/w3c/resources/import-expectations.json
- +3 −0 LayoutTests/imported/w3c/web-platform-tests/server-timing/resource_timing_idl-expected.txt
- +14 −0 LayoutTests/imported/w3c/web-platform-tests/server-timing/resource_timing_idl.html
- +3 −0 LayoutTests/imported/w3c/web-platform-tests/server-timing/service_worker_idl-expected.txt
- +18 −0 LayoutTests/imported/w3c/web-platform-tests/server-timing/service_worker_idl.html
- +12 −0 LayoutTests/imported/w3c/web-platform-tests/server-timing/sw.js
- +1 −0 LayoutTests/platform/ios-wk1/TestExpectations
- +1 −0 LayoutTests/platform/mac-wk1/TestExpectations
- +1 −0 LayoutTests/platform/win/TestExpectations
- +1 −0 Source/WebCore/CMakeLists.txt
- +18 −0 Source/WebCore/ChangeLog
- +1 −0 Source/WebCore/DerivedSources.make
- +2 −0 Source/WebCore/Sources.txt
- +6 −0 Source/WebCore/WebCore.xcodeproj/project.pbxproj
- +1 −0 Source/WebCore/bindings/js/WebCoreBuiltinNames.h
- +3 −0 Source/WebCore/page/PerformanceResourceTiming.h
- +1 −0 Source/WebCore/page/PerformanceResourceTiming.idl
- +46 −0 Source/WebCore/page/PerformanceServerTiming.cpp
- +50 −0 Source/WebCore/page/PerformanceServerTiming.h
- +40 −0 Source/WebCore/page/PerformanceServerTiming.idl
- +6 −1 Source/WebCore/page/RuntimeEnabledFeatures.h
- +13 −0 Source/WebKit/ChangeLog
- +9 −0 Source/WebKit/Shared/WebPreferences.yaml
- +10 −0 Source/WebKit/UIProcess/API/C/WKPreferences.cpp
- +4 −0 Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
- +1 −0 Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
- +23 −0 Source/WebKitLegacy/ChangeLog
- +1 −0 Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
- +11 −0 Source/WebKitLegacy/mac/WebView/WebPreferences.mm
- +3 −0 Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
- +2 −0 Source/WebKitLegacy/mac/WebView/WebView.mm
- +2 −0 Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl
- +2 −0 Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h
- +14 −0 Source/WebKitLegacy/win/WebPreferences.cpp
- +2 −0 Source/WebKitLegacy/win/WebPreferences.h
- +5 −0 Source/WebKitLegacy/win/WebView.cpp
- +10 −0 Tools/ChangeLog
- +1 −0 Tools/DumpRenderTree/mac/DumpRenderTree.mm
- +1 −0 Tools/DumpRenderTree/win/DumpRenderTree.cpp
- +2 −0 Tools/WebKitTestRunner/TestController.cpp
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,3 @@ | ||
|
||
PASS Untitled | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<head> | ||
<meta charset='utf-8' /> | ||
<script src="/resources/testharness.js"></script> | ||
<script src='/resources/testharnessreport.js'></script> | ||
<script> | ||
setup({explicit_done: true}) | ||
window.addEventListener('load', function(){ | ||
assert_not_equals(typeof performance.getEntriesByType('resource')[0].serverTiming, 'undefined', | ||
'An instance of `PerformanceResourceTiming` should have a `serverTiming` attribute.') | ||
done() | ||
}) | ||
</script> | ||
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,3 @@ | ||
|
||
PASS Untitled | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<head> | ||
<meta charset='utf-8' /> | ||
<script src="/resources/testharness.js"></script> | ||
<script src='/resources/testharnessreport.js'></script> | ||
<script> | ||
(async () => { | ||
const scope = 'does/not/exist' | ||
|
||
let registration = await navigator.serviceWorker.getRegistration(scope) | ||
if (registration) | ||
await registration.unregister() | ||
registration = await navigator.serviceWorker.register('./sw.js', {scope}) | ||
|
||
fetch_tests_from_worker(registration.installing) | ||
})() | ||
</script> | ||
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,12 @@ | ||
importScripts('/resources/testharness.js') | ||
|
||
promise_test(async (test) => { | ||
return fetch('./sw.js').then(function(response) { | ||
setTimeout(() => { | ||
assert_not_equals(typeof performance.getEntriesByName(response.url)[0].serverTiming, | ||
'undefined', | ||
'An instance of `PerformanceResourceTiming` should have a `serverTiming` attribute in the Service Worker context.') | ||
done() | ||
}, 100) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright 2017 The Chromium Authors. All rights reserved. | ||
* Copyright (C) 2018 Akamai Technologies Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include "config.h" | ||
#include "PerformanceServerTiming.h" | ||
|
||
namespace WebCore { | ||
|
||
Ref<PerformanceServerTiming> PerformanceServerTiming::create(String&& name, double duration, String&& description) | ||
{ | ||
return adoptRef(*new PerformanceServerTiming(WTFMove(name), duration, WTFMove(description))); | ||
} | ||
|
||
PerformanceServerTiming::PerformanceServerTiming(String&& name, double duration, String&& description) | ||
: m_name(WTFMove(name)) | ||
, m_duration(duration) | ||
, m_description(WTFMove(description)) | ||
{ | ||
} | ||
|
||
PerformanceServerTiming::~PerformanceServerTiming() = default; | ||
|
||
} // namespace WebCore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright 2017 The Chromium Authors. All rights reserved. | ||
* Copyright (C) 2018 Akamai Technologies Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <wtf/RefCounted.h> | ||
#include <wtf/text/WTFString.h> | ||
|
||
namespace WebCore { | ||
|
||
class PerformanceServerTiming : public RefCounted<PerformanceServerTiming> { | ||
public: | ||
static Ref<PerformanceServerTiming> create(String&& name, double duration, String&& description); | ||
~PerformanceServerTiming(); | ||
|
||
const String& name() const { return m_name; } | ||
double duration() const { return m_duration; } | ||
const String& description() const { return m_description; } | ||
|
||
private: | ||
PerformanceServerTiming(String&& name, double duration, String&& description); | ||
String m_name; | ||
double m_duration; | ||
String m_description; | ||
}; | ||
|
||
} // namespace WebCore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2017 The Chromium Authors. All rights reserved. | ||
* Copyright (C) 2018 Akamai Technologies Inc. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
// https://w3c.github.io/server-timing/#dom-performanceservertiming | ||
|
||
typedef double DOMHighResTimeStamp; | ||
|
||
[ | ||
Exposed=(Window,Worker), | ||
ImplementationLacksVTable, | ||
EnabledAtRuntime=ServerTiming | ||
] interface PerformanceServerTiming { | ||
readonly attribute DOMString name; | ||
readonly attribute DOMHighResTimeStamp duration; | ||
readonly attribute DOMString description; | ||
serializer = {attribute}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.