-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Conversation
CLAs look good, thanks! |
I'm curious why the polling/digest mechanism was utilized in the original code. As the |
@IgorMinar did you get a chance to look at the rest of the PR? |
I wonder if it would be best to have a super-light version that has the minimum to make |
Yeah, I mentioned that in the first "open issue" in my comment above. The cookie writing logic was originally added in Or are you saying that you want to move the cookie reading logic to |
@shahata finished the review of code as is now. some more changes to be done:
|
@IgorMinar per your comments:
|
Okay, I just talked with @IgorMinar about this, here are the conclusions:
|
These conclusions sound about right.
|
This PR is now updated with the conclusions listed above |
var cookiePath = $browser.baseHref(); | ||
var rawDocument = $document[0]; | ||
var lastCookies = {}; | ||
var lastCookieString = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 variables seem unused. Could be removed.
👍 👍 @shahata |
@gkalpak thanks for the comments! |
@shahata @petebacondarwin @IgorMinar we need to get this in before ng-conf, ideally before the next release. Are there any blocking points left? If so, what are those blocking points and who could help unblocking those? @shahata the one obvious thing is that the thing doesn't merge cleanly any more. Could you please rebase it? Do we want to squash commits before merging? |
@pkozlowski-opensource I've rebased this, thanks. Not sure regarding squashing, it is quite a big change and each commit is an incremental step towards it, so I think it is much easier to understand this way, but if anyone has a strong opinion about this, I don't mind squashing. @petebacondarwin WDYT? I think it is time to land this... (after travis is green obviously) |
ng-conf is 5 days, just saying :-) |
I'll look at this in the next two days. |
*/ | ||
factory('$cookieStore', ['$cookies', function($cookies) { | ||
|
||
return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should write a deprecation message to the console when this service is instantiated?
Nice work @shahata ! Just a bit of tweaking then we can merge this, eh? TO DO:
COMMITS refact( fix($cookies): move logic into The new API on
The DEPRECATION NOTICE:
BREAKING CHANGE: The The Closes #8324 fix($cookies): stop polling the browser's cookies values No longer poll the browser for changes to the cookies and no longer copy The polling is expensive and caused issues with the The reason the polling was originally added was to allow communication between BREAKING CHANGE:
This feature is generally only needed if a 3rd party library was programmatically feat($cookiesProvider): provide This change provides properties on fix($cookies): set the default path for $cookies from the This is important since if you load an app at refact( fix($browser): remove private polling mechanism The only feature of Angular using this mechanism was |
@petebacondarwin @IgorMinar - I fixed and pushed all comments. I'll try to finish squashing tomorrow night. |
Great! Thanks @shahata - if you don't have time to do the squashing I can do this today. |
* | ||
* Requires the {@link ngCookies `ngCookies`} module to be installed. | ||
* | ||
* <div class="alert alert-error"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want to add @deprecated
annotation to this service
Closing in favour of #11222 |
This is an initial suggestion for dealing with the current issues with angular cookies. The main things added by this:
options
parameter was added to$cookieStore.put()
which supports passingpath
,domain
,expires
andsecure
parameters.$cookieStore
was refactored so it will use$browser.cookies()
directly instead of going through$cookies
. This was in order to allow direct update/read of cookies instead of going through polling/digest mechanism.$cookies
was deprecated in order to stop using the polling/digest mechanism and insteadgetRaw
,getAll
andputRaw
methods were added to$cookieStore
in order to accommodate some of the stuff that were previously available only when using$cookies
This is obviously just my take on this and completely open for discussion.
Some open issues:
$browser
although it is not used internally by angular (angular only uses the cookie reading logic forXSRF-TOKEN
). It might be better to just move it intongCookies
. On the other hand maybe it should be left in$browser
for balance, I don't know.$cookies
alive and make its properties getters/setters usingObject.defineProperty
(assuming everyone else agrees that polling/digest mechanism is bad), but we would still need some sort of polling for learning about new cookies. I think we'd better just deprecate it.getRaw
/get
andputRaw
/put
duplication. Another option can be to use something likeisJsonLike
in$http
or add a flag toget
/put
or usetry
/catch
or maybe even configure this behavior in a$cookieStoreProvider
, but I don't like it very much. SincegetRaw
/putRaw
are consistent withgetAll
(which must be raw imo), I like this option best.$cookieStoreProvider
in order to give better defaults for options, I dunno.