Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
javascript
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
4 Feb 2012 at 16:28 UTC
Updated:
29 Jul 2014 at 20:22 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
nod_tag
Comment #2
tim.plunkettComment #3
nod_Here it is,
There were minor issues with cookie values and the progressbar, other than that I think I went trough everything and still working fine.
Comment #4
sunWouldn't it make more sense to globally introduce
undefinedas a undefined variable in our closures?I.e.:
That would make more sense to me, since, AFAIK, that's a JS best practice either way. Separate issue, of course.
I don't really see how a type-agnostic comparison makes the code more robust or more valid in this and other cases.
Drupal.ajax.progress.type defaults to a string and is expected to be a string. If you pass something else (i.e., a different data type), then your code is broken. In general, we don't babysit broken code.
Comment #5
nod_It could be useful to introduce undefined, on the other hand with typeof you can't have any surprise and you don't have to introduce anything to foolproof your code. I don't feel comfortable checking against undefined as a variable.
It doesn't make the code more robust or valid, it makes it consistent. It's not about babysitting, it's about maintainability. I don't want to have to think about stupid mistakes, following strict code standards removes a whole class of bugs.
Comment #6
nod_Comment #7
droplet commenteddo you sure 'progress' is a string, not the number.
Comment #8
nod_indeed, it's explicitly formated as a string on the php side.
http://drupalcode.org/project/drupal.git/blob/refs/heads/8.x:/core/inclu...
Comment #9
pounardWhich is weird, PHP should probably return the rightful types?
EDIT: Some other problems may happen, such as a float casted as int or getting out of language granularity returning 100 while it's 99.999999999999999999999999 which could break a very long batch to break before the end, got this kind of errors in some use cases. The right way to fix that is to introduce a boolean "finished" into the server response and test that. While I agree in this particular case sending it as a string would do the trick, it doesn't help for people that tries to understand the code by reading it (it's not explicit). This may need another issue for this specific behavior.
Comment #10
damien tournoud commentedI already suggested to introduce a finished boolean in a another issue. This js code is definitely sloppy.
Comment #11
pounardOh good to ear that.
Comment #12
nod_Issue number?
Comment #13
nod_Anyhow, this is out of scope.
Reroll.
Comment #15
nod_Forgot about ajax.js somehow.
Also, test failures?
Comment #16
nod_tag + probably need reroll
Comment #17
nod_reroll I missed a few files, that should be all of them.
Comment #18
droplet commentedCode part looks fine.
Comment #19
nod_Seriously, this needs to get in, two months without a review (thanks droplet!) is just too long for a clean-up patch like this.
I've tested things thoroughly while making the patch as #8 can attest. It all works fine.
I'm worried we'll have conflicts between patches if this gets too long to get in. There is a lot of work that needs to be done on JS, I could live with not having to reroll big patches like this one.
Comment #20
dries commentedCommitted to 8.x. Thanks!
Comment #21
nod_wow! thanks a lot Dries.
Comment #22
damienmckennaIs this backportable or is D7 being left as-is with these logic glitches?
Comment #23
nod_You tell me :)
So the current patch breaks overlay and need work. It was a bit of a PITA to backport because of selectors changes bewteen D8/7. At least this patch will apply and spare quite some backport time.
Needs a full testing of everything for D7 though, we should assume it's totally different from D8.
Comment #24
droplet commentedOverlay is borken.
Comment #25
andypostThis fixes overlay
Comment #26
webchickThanks for the fix! Committed and pushed to 8.x. Moving back to 7.x since that's where it was, but I don't really think that this is a good idea for D7, as demonstrated by the fact that we just broke major user-facing functionality in 8.x without knowing it. :P
Comment #27
nod_Agreed I think it's time D8 moves on to speed things up. A patch sharing the same fate: #1419968: Replace $('selector', domelement) with $(domelement).find('selector').
Comment #28
webchickGreat. Kicking back to 8.x and fixed.
Comment #29.0
(not verified) commentedremove jsperf link