- Revision
- 233490
- Author
- [email protected]
- Date
- 2018-07-03 17:11:45 -0700 (Tue, 03 Jul 2018)
Log Message
performance-api/performance-observer-no-document-leak.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=186938
<rdar://problem/41379336>
Reviewed by Simon Fraser.
Source/WebCore:
Add internals API to get the identifier of a document and to ask if the document with
a given identifier is still alive. This is helpful to write tests for document leaking
fixes.
* testing/Internals.cpp:
(WebCore::Internals::documentIdentifier const):
(WebCore::Internals::isDocumentAlive const):
* testing/Internals.h:
* testing/Internals.idl:
LayoutTests:
Update test to stop relying on internals.numberOfLiveDocuments() and instead rely on the new
internals.documentIdentifier() / internals.isDocumentAlive(documentIdentifier) API in order
to address the flakiness. Relying on the number of live documents to check if a particular
document was destroyed is unreliable and flaky given that WebKit constructs documents for
various reasons.
* TestExpectations:
* performance-api/performance-observer-no-document-leak-expected.txt:
* performance-api/performance-observer-no-document-leak.html:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (233489 => 233490)
--- trunk/LayoutTests/ChangeLog 2018-07-04 00:06:32 UTC (rev 233489)
+++ trunk/LayoutTests/ChangeLog 2018-07-04 00:11:45 UTC (rev 233490)
@@ -1,3 +1,21 @@
+2018-07-03 Chris Dumez <[email protected]>
+
+ performance-api/performance-observer-no-document-leak.html is flaky
+ https://bugs.webkit.org/show_bug.cgi?id=186938
+ <rdar://problem/41379336>
+
+ Reviewed by Simon Fraser.
+
+ Update test to stop relying on internals.numberOfLiveDocuments() and instead rely on the new
+ internals.documentIdentifier() / internals.isDocumentAlive(documentIdentifier) API in order
+ to address the flakiness. Relying on the number of live documents to check if a particular
+ document was destroyed is unreliable and flaky given that WebKit constructs documents for
+ various reasons.
+
+ * TestExpectations:
+ * performance-api/performance-observer-no-document-leak-expected.txt:
+ * performance-api/performance-observer-no-document-leak.html:
+
2018-07-03 Truitt Savell <[email protected]>
Re-enabling canvas tests for canvas/philip/tests/initial.reset.gradient.html
Modified: trunk/LayoutTests/TestExpectations (233489 => 233490)
--- trunk/LayoutTests/TestExpectations 2018-07-04 00:06:32 UTC (rev 233489)
+++ trunk/LayoutTests/TestExpectations 2018-07-04 00:11:45 UTC (rev 233490)
@@ -2196,8 +2196,6 @@
imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/successes_RSA-OAEP.https.any.html [ Pass Failure ]
imported/w3c/web-platform-tests/WebCryptoAPI/generateKey/successes_RSA-OAEP.https.any.worker.html [ Pass Failure ]
-webkit.org/b/186938 performance-api/performance-observer-no-document-leak.html [ Skip ]
-
webkit.org/b/175609 imported/w3c/web-platform-tests/IndexedDB/idbobjectstore_getAll.html [ Pass Failure ]
webkit.org/b/186848 imported/w3c/web-platform-tests/FileAPI/blob/Blob-slice.html [ Pass Failure ]
Modified: trunk/LayoutTests/performance-api/performance-observer-no-document-leak-expected.txt (233489 => 233490)
--- trunk/LayoutTests/performance-api/performance-observer-no-document-leak-expected.txt 2018-07-04 00:06:32 UTC (rev 233489)
+++ trunk/LayoutTests/performance-api/performance-observer-no-document-leak-expected.txt 2018-07-04 00:11:45 UTC (rev 233490)
@@ -3,8 +3,6 @@
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-PASS Number of document is 2
-PASS Number of document is 1
PASS Document did not leak
PASS successfullyParsed is true
Modified: trunk/LayoutTests/performance-api/performance-observer-no-document-leak.html (233489 => 233490)
--- trunk/LayoutTests/performance-api/performance-observer-no-document-leak.html 2018-07-04 00:06:32 UTC (rev 233489)
+++ trunk/LayoutTests/performance-api/performance-observer-no-document-leak.html 2018-07-04 00:11:45 UTC (rev 233490)
@@ -9,13 +9,12 @@
description("Tests that using PerformanceObserver does not cause the document to get leaked.");
window.jsTestIsAsync = true;
-function numberOfDocumentsShouldBecome(count)
+function documentShouldDie(documentIdentifier)
{
return new Promise(function(resolve, reject) {
handle = setInterval(function() {
gc();
- if (internals.numberOfLiveDocuments() == count) {
- testPassed("Number of document is " + count);
+ if (!internals.isDocumentAlive(documentIdentifier)) {
clearInterval(handle);
resolve();
}
@@ -24,13 +23,14 @@
}
_onload_ = function() {
- numberOfDocumentsShouldBecome(2).then(function() {
+ setTimeout(function() {
+ let frameDocumentIdentifier = internals.documentIdentifier(testFrame.contentDocument);
testFrame.remove();
- numberOfDocumentsShouldBecome(1).then(function() {
+ documentShouldDie(frameDocumentIdentifier).then(function() {
testPassed("Document did not leak");
finishJSTest();
});
- });
+ }, 10);
}
</script>
<script src=""
Modified: trunk/Source/WebCore/ChangeLog (233489 => 233490)
--- trunk/Source/WebCore/ChangeLog 2018-07-04 00:06:32 UTC (rev 233489)
+++ trunk/Source/WebCore/ChangeLog 2018-07-04 00:11:45 UTC (rev 233490)
@@ -1,5 +1,23 @@
2018-07-03 Chris Dumez <[email protected]>
+ performance-api/performance-observer-no-document-leak.html is flaky
+ https://bugs.webkit.org/show_bug.cgi?id=186938
+ <rdar://problem/41379336>
+
+ Reviewed by Simon Fraser.
+
+ Add internals API to get the identifier of a document and to ask if the document with
+ a given identifier is still alive. This is helpful to write tests for document leaking
+ fixes.
+
+ * testing/Internals.cpp:
+ (WebCore::Internals::documentIdentifier const):
+ (WebCore::Internals::isDocumentAlive const):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
+2018-07-03 Chris Dumez <[email protected]>
+
Improve window.event compliance: Should not be set when target is in shadow tree
https://bugs.webkit.org/show_bug.cgi?id=186266
Modified: trunk/Source/WebCore/testing/Internals.cpp (233489 => 233490)
--- trunk/Source/WebCore/testing/Internals.cpp 2018-07-04 00:06:32 UTC (rev 233489)
+++ trunk/Source/WebCore/testing/Internals.cpp 2018-07-04 00:11:45 UTC (rev 233490)
@@ -2324,6 +2324,16 @@
return document.referencingNodeCount();
}
+uint64_t Internals::documentIdentifier(const Document& document) const
+{
+ return document.identifier().toUInt64();
+}
+
+bool Internals::isDocumentAlive(uint64_t documentIdentifier) const
+{
+ return Document::allDocumentsMap().contains(makeObjectIdentifier<DocumentIdentifierType>(documentIdentifier));
+}
+
RefPtr<WindowProxy> Internals::openDummyInspectorFrontend(const String& url)
{
auto* inspectedPage = contextDocument()->frame()->page();
Modified: trunk/Source/WebCore/testing/Internals.h (233489 => 233490)
--- trunk/Source/WebCore/testing/Internals.h 2018-07-04 00:06:32 UTC (rev 233489)
+++ trunk/Source/WebCore/testing/Internals.h 2018-07-04 00:11:45 UTC (rev 233490)
@@ -364,6 +364,9 @@
unsigned numberOfLiveDocuments() const;
unsigned referencingNodeCount(const Document&) const;
+ uint64_t documentIdentifier(const Document&) const;
+ bool isDocumentAlive(uint64_t documentIdentifier) const;
+
RefPtr<WindowProxy> openDummyInspectorFrontend(const String& url);
void closeDummyInspectorFrontend();
ExceptionOr<void> setInspectorIsUnderTest(bool);
Modified: trunk/Source/WebCore/testing/Internals.idl (233489 => 233490)
--- trunk/Source/WebCore/testing/Internals.idl 2018-07-04 00:06:32 UTC (rev 233489)
+++ trunk/Source/WebCore/testing/Internals.idl 2018-07-04 00:11:45 UTC (rev 233490)
@@ -613,6 +613,9 @@
[Conditional=MEDIA_STREAM] void simulateMediaStreamTrackCaptureSourceFailure(MediaStreamTrack track);
[Conditional=MEDIA_STREAM] void setMediaStreamTrackIdentifier(MediaStreamTrack track, DOMString identifier);
+ unsigned long long documentIdentifier(Document document);
+ boolean isDocumentAlive(unsigned long long documentIdentifier);
+
Promise<void> clearCacheStorageMemoryRepresentation();
Promise<DOMString> cacheStorageEngineRepresentation();
void setResponseSizeWithPadding(FetchResponse response, unsigned long long size);