Closed Bug 1443835 Opened 6 years ago Closed 6 years ago

Prevent modifications to the root folder via PlacesUtils.bookmarks.insert and PlacesUtils.bookmarks.update

Categories

(Toolkit :: Places, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

(Whiteboard: [fxsearch])

Attachments

(2 files)

Currently PlacesUtils.bookmarks.insert/update allow insert bookmarks into the root folder, or moving them there.

We are attempting to prevent this, so that the only roots we have are the places routes, which will help sync to work correctly. Additionally in bug 1310295 we are removing all non-Places built-in items from the root, so we need to make sure we don't add any more.
Whiteboard: [fxsearch]
Note: some of the removals here, I've moved across from bug 1310295. I'm planning on landing both of these together, soon after 61 starts on nightly.
Status: NEW → ASSIGNED
Comment on attachment 8957198 [details]
Bug 1443835 - Stop using Netutil.newURI everywhere in test_async_transactions.js.

https://reviewboard.mozilla.org/r/226148/#review232320

::: toolkit/components/places/tests/unit/test_async_transactions.js:1222
(Diff revision 1)
>                           newValue: aCurrentKeyword
>                         });
>    }
>  
> -  await PlacesUtils.keywords.insert({ keyword: "kw1", url: bm_info.url.spec, postData: "postData1" });
> -  await PlacesUtils.keywords.insert({ keyword: "kw2", url: bm_info.url.spec, postData: "postData2" });
> +  await PlacesUtils.keywords.insert({ keyword: "kw1", url: bm_info.url, postData: "postData1" });
> +  await PlacesUtils.keywords.insert({ keyword: "kw2", url: bm_info.url, postData: "postData2" });

these may get some re-indentation
Attachment #8957198 - Flags: review?(mak77) → review+
Comment on attachment 8957196 [details]
Bug 1443835 - Prevent modifications to the root folder via PlacesUtils.bookmarks.insert and PlacesUtils.bookmarks.update.

https://reviewboard.mozilla.org/r/226146/#review232324

It looks great, I'm really happy to see this happening

::: toolkit/components/places/tests/bookmarks/test_bookmarks_update.js:313
(Diff revision 1)
> +  let folder = await PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
> +                                                    type: PlacesUtils.bookmarks.TYPE_FOLDER }) ;
> +  let bm = await PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
> +                                                url: "http://example.com/",
> +                                                type: PlacesUtils.bookmarks.TYPE_BOOKMARK }) ;
> +

both could be reindented

::: toolkit/components/places/tests/unit/test_async_transactions.js:1608
(Diff revision 1)
>    await PT.clearTransactionsHistory();
>  });
>  
>  add_task(async function test_copy() {
>    async function duplicate_and_test(aOriginalGuid) {
> -    let txn = PT.Copy({ guid: aOriginalGuid, newParentGuid: rootGuid });
> +    let txn = PT.Copy({ guid: aOriginalGuid, newParentGuid: PlacesUtils.bookmarks.unfiledGuid });

reindent
Attachment #8957196 - Flags: review?(mak77) → review+
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/8b66a34b972d
Prevent modifications to the root folder via PlacesUtils.bookmarks.insert and PlacesUtils.bookmarks.update. r=mak
https://hg.mozilla.org/integration/autoland/rev/2079fe4a3c8f
Stop using Netutil.newURI everywhere in test_async_transactions.js. r=mak
https://hg.mozilla.org/mozilla-central/rev/8b66a34b972d
https://hg.mozilla.org/mozilla-central/rev/2079fe4a3c8f
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: