Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

fix(Angular.js): use cookie instead of window.name to load with debug… #13036

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

klaascuvelier
Copy link

… info

Use cookie to store a check if the application needs to be loaded with debug info, instead of using window.name. As window.name can be used alread (and be overwritten on page load)
Fixes issue #13031

@klaascuvelier
Copy link
Author

Apparently SauceLabs complains about page reload, which indeed happens.
I was not able to spy on window.location.reload which indeed triggers a page reload when calling the reloadWithDebugInfo(). I am not sure how to fix this.

  • Don't test the calling of reloadWithDebugInfo()? (it was not tested before)
  • Stub window somehow? (I've seen some article talking about doing it with sinon)
  • Other options?

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

… info

Use cookie to store a check if the application needs to be loaded with debug info, instead of using window.name. As window.name can be used alread (and be overwritten on page load)
Fixes issue angular#13031
… info

Use cookie to store a check if the application needs to be loaded with debug info, instead of using window.name. As window.name can be used alread (and be overwritten on page load)
Fixes issue angular#13031
@googlebot
Copy link

CLAs look good, thanks!

@petebacondarwin
Copy link
Contributor

@juliemr do you remember why we used window.name rather than a cookie?

@juliemr
Copy link
Member

juliemr commented Jan 25, 2016

If I recall correctly, we can't set a cookie on the site without navigating to a different site on its domain first. So, if we would like to be able to mock out modules before they are ever loaded, we need a different strategy.

@klaascuvelier
Copy link
Author

Oh, I missed the updates on this PR, my apologies.
Other options would be a query string parameter or localstorage. But those are not optimal either.
Can you let me know if you'd want me to do something here, @petebacondarwin @juliemr

@petebacondarwin
Copy link
Contributor

I don't think that localStorage would work either, since it is locked to a domain, right?

@petebacondarwin
Copy link
Contributor

Any other ideas @juliemr ?

@klaascuvelier
Copy link
Author

So what's left is a query string parameter, @petebacondarwin?
Or would there be any other solutions?

cc @juliemr

@juliemr
Copy link
Member

juliemr commented Mar 18, 2016

Sorry for the slow response here. I'll think about it more, but when we first designed this it was a toss-up between query string and window.name and we decided that window.name looked cleaner to the user and had less chance of interfering with something custom. Before changing to query params we would have to think carefully about what that could possibly break.

@klaascuvelier
Copy link
Author

It might look cleaner, but it can break some functionality (like it did for me).
Not sure if having it look cleaner is a real selling point here, it's something that is only visible when a developer reloads the page to do some debugging ...

Anyway looking forward to some possible solution. Happy to contribute if I can.

@petebacondarwin
Copy link
Contributor

@klaascuvelier - of course changing the query string could break apps too. It is a bit of a stone or a hard place. Perhaps the idea solution would be for it to be configurable in the projector config. That way, the default would continue to be changing the window name (no BC) but developers could explicitly choose a query parameter to use instead if they wished?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants