<commit_before><html>
<head>
<script src="../inspector-test.js"></script>
<script src="service-workers-test.js"></script>
<script src="../resources-test.js"></script>
<script src="../console-test.js"></script>
<script>
function test()
{
    var scriptURL = "http://1172.16.31.10:8000/inspector/service-workers/resources/service-worker-empty.js";
    var scope1 = "http://127.0.0.1:8000/inspector/service-workers/resources/scope1/";
    var scope2 = "http://127.0.0.1:8000/inspector/service-workers/resources/scope2/";
    var registrationIDs = {};

    InspectorTest.addSniffer(WebInspector.ServiceWorkersView.prototype, "_registrationUpdated", registrationUpdated, true);
    function registrationUpdated(event)
    {
        var registration = event.data;
        registrationIDs[registration.scopeURL] = registration.registrationId;
    }

    InspectorTest.addSniffer(WebInspector.ServiceWorkersView.prototype, "_versionUpdated", versionUpdated, true);
    function dumpServiceWorkersView()
    {
        var swView = WebInspector.panels.resources.visibleView;
        InspectorTest.addResult("==== ServiceWorkersView ====");
        InspectorTest.addResult(swView.root.querySelector(".service-workers-origin-title").innerText);
        var registrationElements = swView.root.querySelectorAll(".service-workers-registration");
        for (var i = 0; i < registrationElements.length; i++) {
            InspectorTest.addResult(registrationElements[i].querySelector(".service-workers-registration-title").innerText);
            var versionElements = registrationElements[i].querySelectorAll(".service-workers-version-row");
            for (var j = 0; j < versionElements.length; j++)
                InspectorTest.addResult(versionElements[j].innerText);
        }
        InspectorTest.addResult("============================");
    }

    function versionUpdated(event)
    {
        var version = event.data;
        if (version.registrationId == registrationIDs[scope1] && version.status == "activated" && version.runningStatus == "running") {
            dumpServiceWorkersView();
            InspectorTest.addResult("Register ServiceWorker for scope2");<commit_msg>Fix flakyness of Layout Test http/tests/inspector/service-workers/service-workers-view.html<commit_after><html>
<head>
<script src="../inspector-test.js"></script>
<script src="service-workers-test.js"></script>
<script src="../resources-test.js"></script>
<script src="../console-test.js"></script>
<script>
function test()
{
    var scriptURL = "http://127.0.0.1:8000/inspector/service-workers/resources/service-worker-empty.js";
    var scope1 = "http://127.0.0.1:8000/inspector/service-workers/resources/scope1/";
    var scope2 = "http://127.0.0.1:8000/inspector/service-workers/resources/scope2/";
    var expectedTitle1 = "Scope: /inspector/service-workers/resources/scope1/";
    var expectedTitle2 = "Scope: /inspector/service-workers/resources/scope2/";
    var registrationIDs = {};

    InspectorTest.addSniffer(WebInspector.ServiceWorkersView.prototype, "_registrationUpdated", registrationUpdated, true);
    function registrationUpdated(event)
    {
        var registration = event.data;
        registrationIDs[registration.scopeURL] = registration.registrationId;
    }

    InspectorTest.addSniffer(WebInspector.ServiceWorkersView.prototype, "_versionUpdated", versionUpdated, true);
    function dumpServiceWorkersView()
    {
        var swView = WebInspector.panels.resources.visibleView;
        InspectorTest.addResult("==== ServiceWorkersView ====");
        InspectorTest.addResult(swView.root.querySelector(".service-workers-origin-title").innerText);
        var registrationElements = swView.root.querySelectorAll(".service-workers-registration");
        for (var i = 0; i < registrationElements.length; i++) {
            var registrationElement = registrationElements[i];
            var title = registrationElement.querySelector(".service-workers-registration-title").innerText;
            if (title.indexOf(expectedTitle1) == -1 && title.indexOf(expectedTitle2) == -1)
                continue;
            InspectorTest.addResult(title);
            var versionElements = registrationElement.querySelectorAll(".service-workers-version-row");
            for (var j = 0; j < versionElements.length; j++)
                InspectorTest.addResult(versionElements[j].innerText);
        }
        InspectorTest.addResult("============================");
    }

    function versionUpdated(event)
    {
        var version = event.data;
        if (version.registrationId == registrationIDs[scope1] && version.status == "activated" && version.runningStatus == "running") {
            dumpServiceWorkersView();
            InspectorTest.addResult("Register ServiceWorker for scope2");
{'fraction_non_alphanumeric': 0.14801670146137788, 'fraction_numerical': 0.01837160751565762, 'mean_word_length': 3.7671641791044777, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3404952', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1281, 'n_words': 198}