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

fix($browser): Cache location.href only during page reload phase #9455

Closed
wants to merge 1 commit into from

Conversation

tbosch
Copy link
Contributor

@tbosch tbosch commented Oct 7, 2014

Adds caching for url changes after a reload happens

Removes unnecessary caching from $browser, as IE-IE9 all allow to change location.href synchronously, i.e. after changing it (via property write or `location.replace) it can be read out immediately with the up to date value.
There was a wrong assumption in the previous version of this code
introduced by dca2317 and d707114.

Adds more tests for #6976
Fixes #9235

@tbosch
Copy link
Contributor Author

tbosch commented Oct 7, 2014

@IgorMinar Here is the change to $browser that changes when we cache location.href, also adds more tests to it. I also tested this against the problem described in #9235 and it fixes their bug as well.

The initial solution for #9235 was wrong as the added tests for #6976 show.

Will add another commit tomorrow to move this code into $browser: https://github.com/angular/angular.js/blob/master/src/ng/location.js#L294 (in essence: handle urls without trailing hashes...)

});

it('should not reload the page multiple times when the page will be reloaded due to url rewrite on load', function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you mention why we digest many times?

Adds caching for url changes while a reload is happening,
as browsers do not allow to read out the new location the browser
is navigating to.

Removes unnecessary caching from $browser, as IE7-IE9 all 
have the new hash value in `location.href` after changing it.
There was a wrong assumption in the previous version of this code
introduced by dca2317 and d707114.

Adds more tests for angular#6976
Fixes angular#9235
@tbosch tbosch closed this Oct 7, 2014
@tbosch tbosch deleted the fix/browser branch October 7, 2014 18:20
@btford btford removed the In Progress label Oct 7, 2014
tbosch added a commit to tbosch/angular.js that referenced this pull request Oct 7, 2014
Adds caching for url changes while a reload is happening,
as browsers do not allow to read out the new location the browser
is navigating to.

Removes unnecessary caching from $browser, as IE7-IE9 all
have the new hash value in `location.href` after changing it.
There was a wrong assumption in the previous version of this code
introduced by dca2317 and d707114.

Adds more tests for angular#6976
Fixes angular#9235
Closes angular#9455
bullgare pushed a commit to bullgare/angular.js that referenced this pull request Oct 9, 2014
Adds caching for url changes while a reload is happening,
as browsers do not allow to read out the new location the browser
is navigating to.

Removes unnecessary caching from $browser, as IE7-IE9 all
have the new hash value in `location.href` after changing it.
There was a wrong assumption in the previous version of this code
introduced by dca2317 and d707114.

Adds more tests for angular#6976
Fixes angular#9235
Closes angular#9455
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

html5mode on IE9 leads to redirect loop behavior on every digest during initial page load
4 participants