I tried the new URL() method and, unfortunately, it doesn’t work because the resolvedUrl is still a priveleged URL and doesn’t get treated as a relative URL as in window.open(), and tabs.create() fails to execute.
The tabs.duplicate() method will open a new tab with the URL of the same local html page without any problem. The window.open() method, with a relative path as its parameter, will open a new tab/window relative to the window.location.href even for a local html page. If tabs.create() is provided a relative path, the browser makes it relative to the extension rather than the window.location.href.
I tried using the base tag to change the base href but that appears to change only for elements within the page and not methods.
It appears that tabs.create() and tabs.update() are more strict, relative to opening local html pages, than are tabs.duplicate() and window.open(). Unless there is a way to set the base used in tabs.create() to the window.location.href rather than the extension location, it doesn’t appear that tabs.create() can be used to open a local html page even with a relative path, as can be done with window.open().
I got around the problem by duplicating the current tab and then injecting a script that uses window.open() with the desired relative path to the window.location.href and target = ‘_self’.
ADDED LATER:
I forgot to include a link to one piece of MDN documentation concerning the same-origin policy for local html files that I came across awhile back and which is also consistent with the comments of NiklasG. https://developer.mozilla.org/en-US/docs/Archive/Misc_top_level/Same-origin_policy_for_file:_URIs
I’d like to understand how this policy relates to accessing indexedDB databases in local html pages, such as whether or not each local html page get its own database for which access is determined under this same same-origin policy. My interest is that I’d like to divide the data generated by the extension between two separate indexedDB databases by using two local pages (not the extension’s database) and allow each page to read/write to the other page’s database, if possible. This will be controlled through the extension code but this really isn’t an extension question; so, I won’t start a new topic here. But if you could point me to some good information, thank you.