OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 var parsedHref = href.asParsedURL(); | 1504 var parsedHref = href.asParsedURL(); |
1505 if (parsedHref && parsedHref.scheme) | 1505 if (parsedHref && parsedHref.scheme) |
1506 return href; | 1506 return href; |
1507 } | 1507 } |
1508 | 1508 |
1509 var parsedURL = baseURL.asParsedURL(); | 1509 var parsedURL = baseURL.asParsedURL(); |
1510 if (parsedURL) { | 1510 if (parsedURL) { |
1511 var path = href; | 1511 var path = href; |
1512 if (path.charAt(0) !== "/") { | 1512 if (path.charAt(0) !== "/") { |
1513 var basePath = parsedURL.path; | 1513 var basePath = parsedURL.path; |
1514 path = basePath.substring(0, basePath.lastIndexOf("/")) + "/" + path
; | 1514 // A href of "?foo=bar" implies "basePath?foo=bar". |
| 1515 // With "basePath?a=b" and "?foo=bar" we should get "basePath?foo=ba
r". |
| 1516 var prefix; |
| 1517 if (path.charAt(0) === "?") { |
| 1518 var basePathCutIndex = basePath.indexOf("?"); |
| 1519 if (basePathCutIndex !== -1) |
| 1520 prefix = basePath.substring(0, basePathCutIndex); |
| 1521 else |
| 1522 prefix = basePath; |
| 1523 } else |
| 1524 prefix = basePath.substring(0, basePath.lastIndexOf("/")) + "/"; |
| 1525 |
| 1526 path = prefix + path; |
1515 } else if (path.length > 1 && path.charAt(1) === "/") { | 1527 } else if (path.length > 1 && path.charAt(1) === "/") { |
1516 // href starts with "//" which is a full URL with the protocol dropp
ed (use the baseURL protocol). | 1528 // href starts with "//" which is a full URL with the protocol dropp
ed (use the baseURL protocol). |
1517 return parsedURL.scheme + ":" + path; | 1529 return parsedURL.scheme + ":" + path; |
1518 } | 1530 } |
1519 return parsedURL.scheme + "://" + parsedURL.host + (parsedURL.port ? (":
" + parsedURL.port) : "") + path; | 1531 return parsedURL.scheme + "://" + parsedURL.host + (parsedURL.port ? (":
" + parsedURL.port) : "") + path; |
1520 } | 1532 } |
1521 return null; | 1533 return null; |
1522 } | 1534 } |
1523 | 1535 |
1524 WebInspector.addMainEventListeners = function(doc) | 1536 WebInspector.addMainEventListeners = function(doc) |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1921 { | 1933 { |
1922 if (this._inHistory) | 1934 if (this._inHistory) |
1923 return; | 1935 return; |
1924 | 1936 |
1925 this._history.splice(this._historyIterator + 1, this._history.length - t
his._historyIterator - 1); | 1937 this._history.splice(this._historyIterator + 1, this._history.length - t
his._historyIterator - 1); |
1926 if (!this._history.length || this._history[this._history.length - 1] !==
panelName) | 1938 if (!this._history.length || this._history[this._history.length - 1] !==
panelName) |
1927 this._history.push(panelName); | 1939 this._history.push(panelName); |
1928 this._historyIterator = this._history.length - 1; | 1940 this._historyIterator = this._history.length - 1; |
1929 } | 1941 } |
1930 } | 1942 } |
OLD | NEW |