arnoudkooi / ServiceNow-Utils

Browser Extension to enhance experience and productivity in ServiceNow
https://arnoudkooi.com
249 stars 117 forks source link

A handful of Background.js new tab functions are missing cookiestoreid for firefox "Multi Account Containers" #473

Closed iwesselk closed 7 months ago

iwesselk commented 8 months ago

Within firefox, using the "Multi Account Containers" plugin, the following features are not working correctly, due to missing cookie store passed in. Looking at other issues raised, the fix is to pass in "cookieStoreId" into the new tab creation.

The "edit in monaco" editor function using "</>" next to a script. It opens in a new tab within the incorrect tab container group. It has has all the code, however "save" results in a 401 error.

The "[SN Utils Compare]" link when comparing versions. This freezes the SNUtils functionality injection until the tab is closed (/ does not work, and "</>" is not rendered anymore on scripts. The new tab for the diff is also not opened within the same tab container group.

Looking in background.js I notice that codeSearch() has if (cookieStoreId) createObj.cookieStoreId = cookieStoreId; //only FireFox. This function works correctly. createScriptSyncTab() has cookieStoreId passed in and used. This function works correctly. openCodeEditor() does not have cookieStoreId passed in. This function does not work correctly. openCodeDiff() does not have cookieStoreId passed in. This function does not seem to work correctly.

I do not feel comfortable with my ability to test this myself, since I am not familiar with browser plugins. So, I cannot make the PR for this, as well as it's asked that PR's are discussed first.

arnoudkooi commented 8 months ago

Will look at this in the near future :)

arnoudkooi commented 7 months ago

Can you see if it works in 7.4.0.7?

arnoudkooi commented 7 months ago

Did you check?

iwesselk commented 7 months ago

Sorry for the delay. I wasn't checking my email the best.

Just checked and its not working still. Looks like I am running 7.4.0.9 and it did not work. Looking at the commit, it looks like the variable isn't being passed into the function, so its always undefined.

arnoudkooi commented 7 months ago

That is a global variable, but I'll test it out and see what's missing.

arnoudkooi commented 7 months ago

Could you check if latest 7.4.1.5 version fixes it?

iwesselk commented 7 months ago

Both the code editor and the diff opened in the correct containers, and the code editor correctly saves now.

It does still seem that if the diff window is open, it blocks the extension from loading on other pages. However, that's a different lower priority issue. I can re report that in a different issue if you would like, but this one can be closed. I don't use the diff window enough to be worried about it blocking other snutils pages.

Much appreciated fixing these issues!

arnoudkooi commented 7 months ago

Do you have steps to reproduce for the new issue, I opened a diff without issues in a container.

iwesselk commented 7 months ago

Yeah there's no immediate issues on the diff view. The steps are as follows.

  1. Navigate to a page with changes for the update sets
  2. Duplicate the page (so there's 2)
  3. Open the servicenow update set diff
  4. Open the SNutils diff from the update set diff
  5. Without closing the SNutils diff, return to the original page & Refresh
  6. No SNUtils functionality will be loaded into the page. Slash commands don't work, and the buttons for opening scripts in SNUtils don't show
  7. Close the SNUtils diff and reload the original page again
  8. SNUtils functionality returns to the page.

Let me know if these steps were enough detail to reproduce it.

arnoudkooi commented 7 months ago

Not sure what you mean with Navigate to a page with changes for the update sets Can you share a sample URL?

arnoudkooi commented 7 months ago

I was not able to replicate this...

iwesselk commented 7 months ago

Sorry for the delay. It slipped my list.

What I had meant was any record you can click "compare" on the xml update list. IE, a record you have changed previously so there is something to compare.

I don't have an easy way right now to record a gif/video of what happens, but that might be best to demonstrate.

Regardless, it's a low priority issue to me personally, as I rarely use the diffs.

arnoudkooi commented 7 months ago

Ill close it for now, if you can post a video ill have a look