am 040221a9: am 1e03253b: Merge "docs: fix xss vulnerability bug 5008593" into honeycomb-mr2

* commit '040221a9949c9f158cb7fc20b70b065289fcbbb1':
  docs: fix xss vulnerability bug 5008593
This commit is contained in:
Scott Main
2011-07-08 17:45:38 -07:00
committed by Android Git Automerger

View File

@@ -255,23 +255,23 @@ function highlightNav(fullPageName) {
if (lastSlashPos == (fullPageName.length - 1)) { // if the url ends in slash (add 'index.html') if (lastSlashPos == (fullPageName.length - 1)) { // if the url ends in slash (add 'index.html')
fullPageName = fullPageName + "index.html"; fullPageName = fullPageName + "index.html";
} }
// First check if the exact URL, with query string and all, is in the navigation menu
var pathPageName = fullPageName.substr(firstSlashPos); // get the path and page name from the URL (such as 'guide/topics/graphics/index.html')
var htmlPos = fullPageName.indexOf(".html");
var pathPageName = fullPageName.slice(firstSlashPos, htmlPos + 5); // +5 advances past ".html"
// find instances of the page name in the side nav
var link = $("#devdoc-nav a[href$='"+ pathPageName+"']"); var link = $("#devdoc-nav a[href$='"+ pathPageName+"']");
if (link.length == 0) { // if there's no match, then let's backstep through the directory until we find an index.html
var htmlPos = fullPageName.lastIndexOf(".html", fullPageName.length); // page that matches our ancestor directories (only for dev guide and resources)
pathPageName = fullPageName.slice(firstSlashPos, htmlPos + 5); // +5 advances past ".html" if ((link.length == 0) && ((fullPageName.indexOf("/guide/") != -1) ||
link = $("#devdoc-nav a[href$='"+ pathPageName+"']"); (fullPageName.indexOf("/resources/") != -1))) {
if ((link.length == 0) && ((fullPageName.indexOf("/guide/") != -1) || (fullPageName.indexOf("/resources/") != -1))) { lastBackstep = pathPageName.lastIndexOf("/");
// if there's no match, then let's backstep through the directory until we find an index.html page while (link.length == 0) {
// that matches our ancestor directories (only for dev guide and resources) backstepDirectory = pathPageName.lastIndexOf("/", lastBackstep);
lastBackstep = pathPageName.lastIndexOf("/"); link = $("#devdoc-nav a[href$='"+ pathPageName.slice(0, backstepDirectory +
while (link.length == 0) { 1)+"index.html']");
backstepDirectory = pathPageName.lastIndexOf("/", lastBackstep); lastBackstep = pathPageName.lastIndexOf("/", lastBackstep - 1);
link = $("#devdoc-nav a[href$='"+ pathPageName.slice(0, backstepDirectory + 1)+"index.html']"); if (lastBackstep == 0) break;
lastBackstep = pathPageName.lastIndexOf("/", lastBackstep - 1);
if (lastBackstep == 0) break;
}
} }
} }