(baseUrl, newUrl, flexAppUrl)
| 213 | * flexAppUrl: the portion of the location following the '#' only |
| 214 | */ |
| 215 | function addHistoryEntry(baseUrl, newUrl, flexAppUrl) { |
| 216 | |
| 217 | //delete all the history entries |
| 218 | forwardStack = []; |
| 219 | |
| 220 | if (browser.ie) { |
| 221 | //Check to see if we are being asked to do a navigate for the first |
| 222 | //history entry, and if so ignore, because it's coming from the creation |
| 223 | //of the history iframe |
| 224 | if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) { |
| 225 | currentHref = initialHref; |
| 226 | return; |
| 227 | } |
| 228 | if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) { |
| 229 | newUrl = baseUrl + '#' + defaultHash; |
| 230 | flexAppUrl = defaultHash; |
| 231 | } else { |
| 232 | // for IE, tell the history frame to go somewhere without a '#' |
| 233 | // in order to get this entry into the browser history. |
| 234 | getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl; |
| 235 | } |
| 236 | setHash(flexAppUrl); |
| 237 | } else { |
| 238 | |
| 239 | //ADR |
| 240 | if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) { |
| 241 | initialState = createState(baseUrl, newUrl, flexAppUrl); |
| 242 | } else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) { |
| 243 | backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl); |
| 244 | } |
| 245 | |
| 246 | if (browser.safari && !browserHasHashChange) { |
| 247 | // for Safari, submit a form whose action points to the desired URL |
| 248 | if (browser.version <= 419.3) { |
| 249 | var file = window.location.pathname.toString(); |
| 250 | file = file.substring(file.lastIndexOf("/")+1); |
| 251 | getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>'; |
| 252 | //get the current elements and add them to the form |
| 253 | var qs = window.location.search.substring(1); |
| 254 | var qs_arr = qs.split("&"); |
| 255 | for (var i = 0; i < qs_arr.length; i++) { |
| 256 | var tmp = qs_arr[i].split("="); |
| 257 | var elem = document.createElement("input"); |
| 258 | elem.type = "hidden"; |
| 259 | elem.name = tmp[0]; |
| 260 | elem.value = tmp[1]; |
| 261 | document.forms.historyForm.appendChild(elem); |
| 262 | } |
| 263 | document.forms.historyForm.submit(); |
| 264 | } else { |
| 265 | top.location.hash = flexAppUrl; |
| 266 | } |
| 267 | // We also have to maintain the history by hand for Safari |
| 268 | historyHash[history.length] = flexAppUrl; |
| 269 | _storeStates(); |
| 270 | } else { |
| 271 | // Otherwise, just tell the browser to go there |
| 272 | setHash(flexAppUrl); |
no test coverage detected
searching dependent graphs…