I am using 2.16. I cannot use a snapshot easily because at work access to snapshots is restricted. But I do not think that an empty implementation is sufficient.
My scenario is very complex, so I won't be able to provide a test. Would the patch probably be related to only a few classes (e.g. both classes named History)?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Minimal test case for angular-ui-router:
- $locationProvider.html5Mode(false); aka hashbangMode works fine -> no JS exception, both routes rendered correctly
- $locationProvider.html5Mode(true); -> mode utilizing html5 history api -> JS exceptions, first route displayed, second route (after goToPage2 anchor click) throws JS exception, but stays on previous route.
Some info that I have gathered:
- pushState have some similarities to "hash-driven routes" (see: https://developer.mozilla.org/en-US/docs/Web/API/History_API)
- if HU will use naive pushState implementation setting location to passed url and will angular will have disabled throwing infdig through for example ScriptPreProcessor:
public String preProcess(HtmlPage htmlPage, String sourceCode, String sourceName, int lineNumber,
HtmlElement htmlElement) {
int infdigIdx = sourceCode.indexOf("'infdig'");
if (infdigIdx != -1) {
int throwIdx = sourceCode.substring(0, infdigIdx).lastIndexOf("throw ");
if (throwIdx != -1) {
StringBuilder sb = new StringBuilder(sourceCode);
sb.insert(throwIdx, "alert('angular infdig occured - ignoring exception');break;");
sourceCode = sb.toString();
}
}
return sourceCode;
}
second test case works. Although this is just workaround, maybe it will let someone to prepare fix.
Please note they are defined with empty implementation in latest snapshot [1].
Are you using it, or 2.16? and is the empty implementation sufficient? If not, please provide a test case.
[1] https://ci.canoo.com/teamcity/viewLog.html?buildTypeId=HtmlUnit_QuickBuild&buildId=lastSuccessful&tab=artifacts
I am using 2.16. I cannot use a snapshot easily because at work access to snapshots is restricted. But I do not think that an empty implementation is sufficient.
My scenario is very complex, so I won't be able to provide a test. Would the patch probably be related to only a few classes (e.g. both classes named History)?
Minimal test case for angular-ui-router:
- $locationProvider.html5Mode(false); aka hashbangMode works fine -> no JS exception, both routes rendered correctly
- $locationProvider.html5Mode(true); -> mode utilizing html5 history api -> JS exceptions, first route displayed, second route (after goToPage2 anchor click) throws JS exception, but stays on previous route.
Some info that I have gathered:
- pushState have some similarities to "hash-driven routes" (see: https://developer.mozilla.org/en-US/docs/Web/API/History_API)
- if HU will use naive pushState implementation setting location to passed url and will angular will have disabled throwing infdig through for example ScriptPreProcessor:
second test case works. Although this is just workaround, maybe it will let someone to prepare fix.
Last edit: Ahmed Ashour 2015-09-06
Please find in attachment html5 history api implementation (history.pushState, history.replaceState, history.state) and unit tests.
Sorry, but no time at the moment to merge in this stuff. Hopefully someone else can jump in...
Any possibility to go forward with this issue?
just back from vacation, will work on media queries the next days and then i like to finish this one
Changes are in SVN now. Many thanks for the patch (and youre patience).