Bug 1767724 Comment 139 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

`findConsoleAPIMessage` is based on `findMessagesByType`, which looks for the matching string __in the whole message__, which includes the location https://searchfox.org/mozilla-central/rev/8867630d67bfe76f6065df08d60381d45d73c439/devtools/client/webconsole/test/browser/shared-head.js#397,405-411
```js
function findMessagesByType(hud, text, typeSelector) {
...
  const selector = ".message" + typeSelector;
  const messages = hud.ui.outputNode.querySelectorAll(selector);
  const elements = Array.from(messages).filter(el =>
    el.textContent.includes(text)
  );
  return elements;
}
```

the test uses a data url worker https://searchfox.org/mozilla-central/rev/8867630d67bfe76f6065df08d60381d45d73c439/devtools/client/webconsole/test/browser/test-console-workers.html#14-15
```html
const worker = new Worker(`data:application/javascript,
  console.log("initial-message-from-worker", {foo: "bar"}, globalThis);
```

which means the `initial-message-from-worker` will be included in the location, which can break some assumptions in the test

I moved the data url worker to a proper file to avoid such thing; I'm still waiting for more TV results, but it seems promising so far: https://treeherder.mozilla.org/jobs?repo=try&revision=943a3e23ff2d0bcf601669185f121adeac81696b
`findConsoleAPIMessage` is based on `findMessagesByType`, which looks for the matching string __in the whole message__, which includes the location https://searchfox.org/mozilla-central/rev/8867630d67bfe76f6065df08d60381d45d73c439/devtools/client/webconsole/test/browser/shared-head.js#397,405-411
```js
function findMessagesByType(hud, text, typeSelector) {
...
  const selector = ".message" + typeSelector;
  const messages = hud.ui.outputNode.querySelectorAll(selector);
  const elements = Array.from(messages).filter(el =>
    el.textContent.includes(text)
  );
  return elements;
}
```

the test uses a data url worker https://searchfox.org/mozilla-central/rev/8867630d67bfe76f6065df08d60381d45d73c439/devtools/client/webconsole/test/browser/test-console-workers.html#14-15
```html
const worker = new Worker(`data:application/javascript,
  console.log("initial-message-from-worker", {foo: "bar"}, globalThis);
```

which means the `initial-message-from-worker` will be included in the location, which can break some assumptions in the test

I moved the data url worker to a proper file to avoid such thing; I'm still waiting for more TV results, but it seems promising so far: https://treeherder.mozilla.org/jobs?repo=try&revision=943a3e23ff2d0bcf601669185f121adeac81696b

EDIT: the test is still failing, so this isn't enough https://treeherder.mozilla.org/jobs?repo=try&revision=943a3e23ff2d0bcf601669185f121adeac81696b&selectedTaskRun=E_rfsz-wRuqycondSt1sHg.0

Back to Bug 1767724 Comment 139