Closed Bug 1380570 Opened 4 years ago Closed 4 years ago

browser_bookmark_titles.js fails with async Places Transactions turned on

Categories

(Toolkit :: Places, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

(Whiteboard: [fxsearch])

Attachments

(3 files)

I spotted this during a try run for async places transactions. I've a fix in progress.

FAIL | browser/base/content/test/general/browser_bookmark_titles.js | Bookmark got a good default title.
Got , expected https://untrusted.example.com/somepage.html
Stack trace:
chrome://mochikit/content/browser-test.js:test_is:967
chrome://mochitests/content/browser/browser/base/content/test/general/browser_bookmark_titles.js:checkBookmark:82
Here's a try run with async transactions turned on and the changes here pushed as well:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=7b71c8e774f46124becb0097c1501660fc7a150d
Comment on attachment 8886042 [details]
Bug 1380570 - Fix indentation of browser_bookmark_titles.js.

https://reviewboard.mozilla.org/r/156830/#review162204
Attachment #8886042 - Flags: review?(mak77) → review+
Comment on attachment 8886043 [details]
Bug 1380570 - Update browser_bookmark_titles.js to use newer APIs and utility functions.

https://reviewboard.mozilla.org/r/156832/#review162206

::: browser/base/content/test/general/browser_bookmark_titles.js:32
(Diff revision 1)
>    for (let i = 0; i < tests.length; ++i) {
> -    let [uri, title] = tests[i];
> +    let [url, title] = tests[i];
>  
>      let promiseLoaded = promisePageLoaded(browser);
> -    BrowserTestUtils.loadURI(browser, uri);
> +    BrowserTestUtils.loadURI(browser, url);
>      await promiseLoaded;

Should probably use await BrowserTestUtils.browserLoaded instead of a custom function.

::: browser/base/content/test/general/browser_bookmark_titles.js:57
(Diff revision 1)
>  
> -  let [uri, title] = tests[0];
> +  let [url, title] = tests[0];
>  
>    let promiseLoaded = promisePageLoaded(browser);
> -  BrowserTestUtils.loadURI(browser, uri);
> +  BrowserTestUtils.loadURI(browser, url);
>    await promiseLoaded;

ditto

::: browser/base/content/test/general/browser_bookmark_titles.js:76
(Diff revision 1)
> -async function checkBookmark(uri, expected_title) {
> -  is(gBrowser.selectedBrowser.currentURI.spec, uri,
> +async function checkBookmark(url, expected_title) {
> +  Assert.equal(gBrowser.selectedBrowser.currentURI.spec, url,
> -     "Trying to bookmark the expected uri");
> +    "Trying to bookmark the expected uri");
>  
> -  let promiseBookmark = promiseOnBookmarkItemAdded(gBrowser.selectedBrowser.currentURI);
> +  let promiseBookmark = PlacesTestUtils.waitForNotification("onItemAdded",
> +    (id, parentId, index, type, itemUrl) => itemUrl.spec == gBrowser.selectedBrowser.currentURI.spec);

itemURI.equals(gBrowser.selectedBrowser.currentURI)
Attachment #8886043 - Flags: review?(mak77) → review+
Comment on attachment 8886044 [details]
Bug 1380570 - Fix setting the title when bookmarking a url from an error page when the url is not found in the history.

https://reviewboard.mozilla.org/r/156834/#review162214
Attachment #8886044 - Flags: review?(mak77) → review+
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e4fb58ba50e5
Fix indentation of browser_bookmark_titles.js. r=mak
https://hg.mozilla.org/integration/autoland/rev/e664a64cb729
Update browser_bookmark_titles.js to use newer APIs and utility functions. r=mak
https://hg.mozilla.org/integration/autoland/rev/c3beaef116ef
Fix setting the title when bookmarking a url from an error page when the url is not found in the history. r=mak
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/e4fb58ba50e5
https://hg.mozilla.org/mozilla-central/rev/e664a64cb729
https://hg.mozilla.org/mozilla-central/rev/c3beaef116ef
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.