Bug 2043439 Comment 0 Edit History

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

I noticed a test failure in a try run that seemed worth filing -- some test code seems to be inadvertently initiating a non-local connection to www.google.com, which triggers a fatal error.

Log:
https://treeherder.mozilla.org/logviewer?job_id=569331934&repo=try&task=TxDI3kobRLCmp02RjF87DA.0&lineNumber=2173
```
TEST-START | browser/components/aiwindow/ui/test/browser/browser_aichat_content_message_event.js
GECKO(1526) | [Parent 1526: Main Thread]: I/SlowChromeEvent Please do not use mouseenter/leave events in chrome. They are slower than mouseover/out! chrome://browser/content/tabbrowser/tabs.js:53:12
GECKO(1526) | console.error: ChatStore: "Failed to get AIChatContent actor:" (new NotSupportedError("WindowGlobalParent.getActor: Window protocol 'AIChatContent' doesn't match uri about:blank", (void 0), 1844))
GECKO(1526) | [Parent 1526: Main Thread]: I/SlowChromeEvent Please do not use mouseenter/leave events in chrome. They are slower than mouseover/out! chrome://global/content/vendor/lit.all.mjs:2024:26
GECKO(1526) | [Parent 1526: Main Thread]: I/SlowChromeEvent Please do not use mouseenter/leave events in chrome. They are slower than mouseover/out! chrome://global/content/vendor/lit.all.mjs:2024:26
GECKO(1526) | [Parent 1526: Main Thread]: I/SlowChromeEvent Please do not use mouseenter/leave events in chrome. They are slower than mouseover/out! chrome://global/content/vendor/lit.all.mjs:2024:26
GECKO(1526) | FATAL ERROR: Non-local network connections are disabled and a connection attempt to www.google.com (2001:4860:4826:7700::) was made.
GECKO(1526) | You should only access hostnames available via the test networking proxy (if running mochitests) or from a test-specific httpd.js server (if running xpcshell tests). Browser services should be disabled or redirected to a local server.
GECKO(1526) | FATAL ERROR: Non-local network connections are disabled and a connection attempt to www.google.com (142.251.150.119) was made.
GECKO(1526) | You should only access hostnames available via the test networking proxy (if running mochitests) or from a test-specific httpd.js server (if running xpcshell tests). Browser services should be disabled or redirected to a local server.
GECKO(1526) | [1526] Hit MOZ_CRASH(Attempting to connect to non-local address! opener is [chrome://browser/content/tabbrowser/tabbrowser.js:9976:33], uri is [https://www.google.com/search?client=firefox-b-1-d&q=Hello]) at checkouts/gecko/netwerk/protocol/http/nsHttpChannel.cpp:9065
```

One important clue from the error:
> uri is [https://www.google.com/search?client=firefox-b-1-d&q=Hello

That's a google search URL for the query `"Hello"`.

As it happens, **the test that we were running at the time (`browser_aichat_content_message_event.js`) does seem to do something that might result in that specific search query** -- it opens an AI window, types `"Hello"` in the smart bar, and then submits that entry:

https://searchfox.org/firefox-main/rev/e28b34ab33dbf49364999070168cbb7e11e8e5bd/browser/components/aiwindow/ui/test/browser/browser_aichat_content_message_event.js#147-151
```js
win = await openAIWindow();
const browser = win.gBrowser.selectedBrowser;

await typeInSmartbar(browser, "Hello");
await submitSmartbar(browser);
```

Notably, the log does show "Failed to get AIChatContent actor" before things go wrong.  Maybe something timed out, and when that happens, we gracefully fall back to a search with the default search engine, which in this case results in a non-local connection which is a fatal error?

In any case - I'm marking this as depending on bug 2028676 which added the test in question (`browser_aichat_content_message_event.js`) though I don't know if this is specific to that test or whether it could theoretically happen with any test that uses this `typeInSmartbar` test API...  Ideally it'd be good to handle this with a more graceful
I noticed a test failure in a try run that seemed worth filing -- some test code seems to be inadvertently initiating a non-local connection to www.google.com, which triggers a fatal error.

Log:
https://treeherder.mozilla.org/logviewer?job_id=569331934&repo=try&task=TxDI3kobRLCmp02RjF87DA.0&lineNumber=2173
```
TEST-START | browser/components/aiwindow/ui/test/browser/browser_aichat_content_message_event.js
GECKO(1526) | [Parent 1526: Main Thread]: I/SlowChromeEvent Please do not use mouseenter/leave events in chrome. They are slower than mouseover/out! chrome://browser/content/tabbrowser/tabs.js:53:12
GECKO(1526) | console.error: ChatStore: "Failed to get AIChatContent actor:" (new NotSupportedError("WindowGlobalParent.getActor: Window protocol 'AIChatContent' doesn't match uri about:blank", (void 0), 1844))
GECKO(1526) | [Parent 1526: Main Thread]: I/SlowChromeEvent Please do not use mouseenter/leave events in chrome. They are slower than mouseover/out! chrome://global/content/vendor/lit.all.mjs:2024:26
GECKO(1526) | [Parent 1526: Main Thread]: I/SlowChromeEvent Please do not use mouseenter/leave events in chrome. They are slower than mouseover/out! chrome://global/content/vendor/lit.all.mjs:2024:26
GECKO(1526) | [Parent 1526: Main Thread]: I/SlowChromeEvent Please do not use mouseenter/leave events in chrome. They are slower than mouseover/out! chrome://global/content/vendor/lit.all.mjs:2024:26
GECKO(1526) | FATAL ERROR: Non-local network connections are disabled and a connection attempt to www.google.com (2001:4860:4826:7700::) was made.
GECKO(1526) | You should only access hostnames available via the test networking proxy (if running mochitests) or from a test-specific httpd.js server (if running xpcshell tests). Browser services should be disabled or redirected to a local server.
GECKO(1526) | FATAL ERROR: Non-local network connections are disabled and a connection attempt to www.google.com (142.251.150.119) was made.
GECKO(1526) | You should only access hostnames available via the test networking proxy (if running mochitests) or from a test-specific httpd.js server (if running xpcshell tests). Browser services should be disabled or redirected to a local server.
GECKO(1526) | [1526] Hit MOZ_CRASH(Attempting to connect to non-local address! opener is [chrome://browser/content/tabbrowser/tabbrowser.js:9976:33], uri is [https://www.google.com/search?client=firefox-b-1-d&q=Hello]) at checkouts/gecko/netwerk/protocol/http/nsHttpChannel.cpp:9065
```

One important clue from the error:
> uri is [https://www.google.com/search?client=firefox-b-1-d&q=Hello

That's a google search URL for the query `"Hello"`.

As it happens, **the test that we were running at the time (`browser_aichat_content_message_event.js`) does seem to do something that might result in that specific search query** -- it opens an AI window, types `"Hello"` in the smart bar, and then submits that entry:

https://searchfox.org/firefox-main/rev/e28b34ab33dbf49364999070168cbb7e11e8e5bd/browser/components/aiwindow/ui/test/browser/browser_aichat_content_message_event.js#147-151
```js
win = await openAIWindow();
const browser = win.gBrowser.selectedBrowser;

await typeInSmartbar(browser, "Hello");
await submitSmartbar(browser);
```

Notably, the log does show "Failed to get AIChatContent actor" before things go wrong.  Maybe something timed out, and when that happens, we gracefully fall back to a search with the default search engine, which in this case results in a non-local connection which is a fatal error?

In any case - I'm marking this as depending on bug 2028676 which added the test in question (`browser_aichat_content_message_event.js`) though I don't know if this is specific to that test or whether it could theoretically happen with any test that uses this `typeInSmartbar` test API...  If this is just fallout from something timing out, it'd be good to handle this more gracefully and avoid the non-local connection.

Back to Bug 2043439 Comment 0