Add url::Origin::CanBeDerivedFrom method to allow verifying URLs.

In various areas of the code, we should be able to perform sanity checks
whether an URL and an origin are compatible. What that means is that
when a document is committed from an URL, the resulting origin can
only be one of:
* origin based on the URL
* opaque origin with precursor information based on an URL
* opaque unique origin

The CanBeDerivedFrom method is added to url::Origin to allow such
checks to be performed. It will return false in cases where the origin
cannot have come from the supplied URL. An example is http://foo.com
origin with data:text/html,foo URL. URLs with data: schemes always
commit in an unique origin, so they are not compatible with valid
tuple origins.

Bug: 882053
Change-Id: I681d28526c09e8672b0381e8d93a914cedd1a075
Reviewed-on: https://chromium-review.googlesource.com/c/1388182
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620167}
3 files changed