pub fn add_head(&self, url: &PathMaybeWithLocale, head: String, is_widget: bool) {
        let mut map = self.map.borrow_mut();
        // We want to modify any existing entries to avoid wiping out state
        if let Some(entry) = map.get_mut(url) {
            entry.set_head(head);
        } else {
            let mut new_entry = PssEntry::default();
            new_entry.set_head(head);
            map.insert(url.clone(), new_entry);
        }
        let mut order = self.order.borrow_mut();
        // If we haven't been told to keep this page, enter it in the order list so it
        // can be evicted later (unless it's a widget)
        if !self.keep_list.borrow().iter().any(|x| x == url) && !is_widget {
            // Get rid of any previous mentions of this page in the order list
            order.retain(|stored_url| stored_url != url);
            order.push(url.clone());
            // If we've used up the maximum size yet, we should get rid of the oldest pages
            drop(order);
            drop(map);
            self.evict_page_if_needed();
        }
    }
Adds document metadata to the entry in the store for the given URL,
creating it if it doesn't exist.

This will be added to the end of the `order` property, and any previous
entries of it in that list will be removed.

This will accept widgets adding empty heads, since they do still need
to be registered.
packages/perseus/src/state/state_store.rs