Fossil SCM
merged in trunk [11abffbb497d67a], added a test script to check a th1 memleak case.
Commit
13b0e0b4d4edb91926c22a2e74cc9fb9b74ac76b
Parent
bee00366812f437…
10 files changed
+1
-1
+7
-9
+2
-2
+2
-3
+1
-1
+19
-2
+19
-2
+5
-5
+10
+10
+1
-1
| --- src/browse.c | ||
| +++ src/browse.c | ||
| @@ -120,11 +120,11 @@ | ||
| 120 | 120 | Blob dirname; |
| 121 | 121 | Manifest *pM = 0; |
| 122 | 122 | const char *zSubdirLink; |
| 123 | 123 | |
| 124 | 124 | login_check_credentials(); |
| 125 | - if( !g.perm.Hyperlink ){ login_needed(); return; } | |
| 125 | + if( !g.perm.Read ){ login_needed(); return; } | |
| 126 | 126 | while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } |
| 127 | 127 | style_header("File List"); |
| 128 | 128 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| 129 | 129 | pathelementFunc, 0, 0); |
| 130 | 130 | |
| 131 | 131 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -120,11 +120,11 @@ | |
| 120 | Blob dirname; |
| 121 | Manifest *pM = 0; |
| 122 | const char *zSubdirLink; |
| 123 | |
| 124 | login_check_credentials(); |
| 125 | if( !g.perm.Hyperlink ){ login_needed(); return; } |
| 126 | while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } |
| 127 | style_header("File List"); |
| 128 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| 129 | pathelementFunc, 0, 0); |
| 130 | |
| 131 |
| --- src/browse.c | |
| +++ src/browse.c | |
| @@ -120,11 +120,11 @@ | |
| 120 | Blob dirname; |
| 121 | Manifest *pM = 0; |
| 122 | const char *zSubdirLink; |
| 123 | |
| 124 | login_check_credentials(); |
| 125 | if( !g.perm.Read ){ login_needed(); return; } |
| 126 | while( nD>1 && zD[nD-2]=='/' ){ zD[(--nD)-1] = 0; } |
| 127 | style_header("File List"); |
| 128 | sqlite3_create_function(g.db, "pathelement", 2, SQLITE_UTF8, 0, |
| 129 | pathelementFunc, 0, 0); |
| 130 | |
| 131 |
+7
-9
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -1388,15 +1388,11 @@ | ||
| 1388 | 1388 | if( z[0]=='\n' ) z++; |
| 1389 | 1389 | } |
| 1390 | 1390 | if( n<iEnd ) cgi_printf("</div>"); |
| 1391 | 1391 | @ </pre> |
| 1392 | 1392 | if( iStart ){ |
| 1393 | - @ <script type="text/JavaScript"> | |
| 1394 | - @ /* <![CDATA[ */ | |
| 1395 | - @ document.getElementById('topln').scrollIntoView(true); | |
| 1396 | - @ /* ]]> */ | |
| 1397 | - @ </script> | |
| 1393 | + @ <script>gebi('topln').scrollIntoView(true);</script> | |
| 1398 | 1394 | } |
| 1399 | 1395 | } |
| 1400 | 1396 | |
| 1401 | 1397 | |
| 1402 | 1398 | /* |
| @@ -2005,13 +2001,14 @@ | ||
| 2005 | 2001 | render_color_chooser(fNewPropagateColor, zNewColor, "pclr", "clr", "clrcust"); |
| 2006 | 2002 | @ </td></tr> |
| 2007 | 2003 | |
| 2008 | 2004 | @ <tr><td align="right" valign="top"><b>Tags:</b></td> |
| 2009 | 2005 | @ <td valign="top"> |
| 2010 | - @ <input type="checkbox" name="newtag"%s(zNewTagFlag) /> | |
| 2006 | + @ <input type="checkbox" id="newtag" name="newtag"%s(zNewTagFlag) /> | |
| 2011 | 2007 | @ Add the following new tag name to this check-in: |
| 2012 | - @ <input type="text" style="width:15;" name="tagname" value="%h(zNewTag)" /> | |
| 2008 | + @ <input type="text" style="width:15;" name="tagname" value="%h(zNewTag)" | |
| 2009 | + @ onkeyup="gebi('newtag').checked=!!this.value" /> | |
| 2013 | 2010 | db_prepare(&q, |
| 2014 | 2011 | "SELECT tag.tagid, tagname FROM tagxref, tag" |
| 2015 | 2012 | " WHERE tagxref.rid=%d AND tagtype>0 AND tagxref.tagid=tag.tagid" |
| 2016 | 2013 | " ORDER BY CASE WHEN tagname GLOB 'sym-*' THEN substr(tagname,5)" |
| 2017 | 2014 | " ELSE tagname END /*sort*/", |
| @@ -2036,13 +2033,14 @@ | ||
| 2036 | 2033 | db_finalize(&q); |
| 2037 | 2034 | @ </td></tr> |
| 2038 | 2035 | |
| 2039 | 2036 | @ <tr><td align="right" valign="top"><b>Branching:</b></td> |
| 2040 | 2037 | @ <td valign="top"> |
| 2041 | - @ <input type="checkbox" name="newbr"%s(zNewBrFlag) /> | |
| 2038 | + @ <input id="newbr" type="checkbox" name="newbr"%s(zNewBrFlag) /> | |
| 2042 | 2039 | @ Make this check-in the start of a new branch named: |
| 2043 | - @ <input type="text" style="width:15;" name="brname" value="%h(zNewBranch)" /> | |
| 2040 | + @ <input type="text" style="width:15;" name="brname" value="%h(zNewBranch)" | |
| 2041 | + @ onkeyup="gebi('newbr').checked=!!this.value" /> | |
| 2044 | 2042 | @ </td></tr> |
| 2045 | 2043 | |
| 2046 | 2044 | if( is_a_leaf(rid) |
| 2047 | 2045 | && !db_exists("SELECT 1 FROM tagxref " |
| 2048 | 2046 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 2049 | 2047 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -1388,15 +1388,11 @@ | |
| 1388 | if( z[0]=='\n' ) z++; |
| 1389 | } |
| 1390 | if( n<iEnd ) cgi_printf("</div>"); |
| 1391 | @ </pre> |
| 1392 | if( iStart ){ |
| 1393 | @ <script type="text/JavaScript"> |
| 1394 | @ /* <![CDATA[ */ |
| 1395 | @ document.getElementById('topln').scrollIntoView(true); |
| 1396 | @ /* ]]> */ |
| 1397 | @ </script> |
| 1398 | } |
| 1399 | } |
| 1400 | |
| 1401 | |
| 1402 | /* |
| @@ -2005,13 +2001,14 @@ | |
| 2005 | render_color_chooser(fNewPropagateColor, zNewColor, "pclr", "clr", "clrcust"); |
| 2006 | @ </td></tr> |
| 2007 | |
| 2008 | @ <tr><td align="right" valign="top"><b>Tags:</b></td> |
| 2009 | @ <td valign="top"> |
| 2010 | @ <input type="checkbox" name="newtag"%s(zNewTagFlag) /> |
| 2011 | @ Add the following new tag name to this check-in: |
| 2012 | @ <input type="text" style="width:15;" name="tagname" value="%h(zNewTag)" /> |
| 2013 | db_prepare(&q, |
| 2014 | "SELECT tag.tagid, tagname FROM tagxref, tag" |
| 2015 | " WHERE tagxref.rid=%d AND tagtype>0 AND tagxref.tagid=tag.tagid" |
| 2016 | " ORDER BY CASE WHEN tagname GLOB 'sym-*' THEN substr(tagname,5)" |
| 2017 | " ELSE tagname END /*sort*/", |
| @@ -2036,13 +2033,14 @@ | |
| 2036 | db_finalize(&q); |
| 2037 | @ </td></tr> |
| 2038 | |
| 2039 | @ <tr><td align="right" valign="top"><b>Branching:</b></td> |
| 2040 | @ <td valign="top"> |
| 2041 | @ <input type="checkbox" name="newbr"%s(zNewBrFlag) /> |
| 2042 | @ Make this check-in the start of a new branch named: |
| 2043 | @ <input type="text" style="width:15;" name="brname" value="%h(zNewBranch)" /> |
| 2044 | @ </td></tr> |
| 2045 | |
| 2046 | if( is_a_leaf(rid) |
| 2047 | && !db_exists("SELECT 1 FROM tagxref " |
| 2048 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 2049 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -1388,15 +1388,11 @@ | |
| 1388 | if( z[0]=='\n' ) z++; |
| 1389 | } |
| 1390 | if( n<iEnd ) cgi_printf("</div>"); |
| 1391 | @ </pre> |
| 1392 | if( iStart ){ |
| 1393 | @ <script>gebi('topln').scrollIntoView(true);</script> |
| 1394 | } |
| 1395 | } |
| 1396 | |
| 1397 | |
| 1398 | /* |
| @@ -2005,13 +2001,14 @@ | |
| 2001 | render_color_chooser(fNewPropagateColor, zNewColor, "pclr", "clr", "clrcust"); |
| 2002 | @ </td></tr> |
| 2003 | |
| 2004 | @ <tr><td align="right" valign="top"><b>Tags:</b></td> |
| 2005 | @ <td valign="top"> |
| 2006 | @ <input type="checkbox" id="newtag" name="newtag"%s(zNewTagFlag) /> |
| 2007 | @ Add the following new tag name to this check-in: |
| 2008 | @ <input type="text" style="width:15;" name="tagname" value="%h(zNewTag)" |
| 2009 | @ onkeyup="gebi('newtag').checked=!!this.value" /> |
| 2010 | db_prepare(&q, |
| 2011 | "SELECT tag.tagid, tagname FROM tagxref, tag" |
| 2012 | " WHERE tagxref.rid=%d AND tagtype>0 AND tagxref.tagid=tag.tagid" |
| 2013 | " ORDER BY CASE WHEN tagname GLOB 'sym-*' THEN substr(tagname,5)" |
| 2014 | " ELSE tagname END /*sort*/", |
| @@ -2036,13 +2033,14 @@ | |
| 2033 | db_finalize(&q); |
| 2034 | @ </td></tr> |
| 2035 | |
| 2036 | @ <tr><td align="right" valign="top"><b>Branching:</b></td> |
| 2037 | @ <td valign="top"> |
| 2038 | @ <input id="newbr" type="checkbox" name="newbr"%s(zNewBrFlag) /> |
| 2039 | @ Make this check-in the start of a new branch named: |
| 2040 | @ <input type="text" style="width:15;" name="brname" value="%h(zNewBranch)" |
| 2041 | @ onkeyup="gebi('newbr').checked=!!this.value" /> |
| 2042 | @ </td></tr> |
| 2043 | |
| 2044 | if( is_a_leaf(rid) |
| 2045 | && !db_exists("SELECT 1 FROM tagxref " |
| 2046 | " WHERE tagid=%d AND rid=%d AND tagtype>0", |
| 2047 |
+2
-2
| --- src/json_dir.c | ||
| +++ src/json_dir.c | ||
| @@ -66,12 +66,12 @@ | ||
| 66 | 66 | char * zUuid = NULL; |
| 67 | 67 | char const * zCI = NULL; |
| 68 | 68 | Manifest * pM = NULL; |
| 69 | 69 | Stmt q = empty_Stmt; |
| 70 | 70 | int rid = 0; |
| 71 | - if( !g.perm.Hyperlink ){ | |
| 72 | - json_set_err(FSL_JSON_E_DENIED, "Requires 'h' permissions."); | |
| 71 | + if( !g.perm.Read ){ | |
| 72 | + json_set_err(FSL_JSON_E_DENIED, "Requires 'o' permissions."); | |
| 73 | 73 | return NULL; |
| 74 | 74 | } |
| 75 | 75 | zCI = json_find_option_cstr("checkin",NULL,"ci" ); |
| 76 | 76 | |
| 77 | 77 | /* If a specific check-in is requested, fetch and parse it. If the |
| 78 | 78 |
| --- src/json_dir.c | |
| +++ src/json_dir.c | |
| @@ -66,12 +66,12 @@ | |
| 66 | char * zUuid = NULL; |
| 67 | char const * zCI = NULL; |
| 68 | Manifest * pM = NULL; |
| 69 | Stmt q = empty_Stmt; |
| 70 | int rid = 0; |
| 71 | if( !g.perm.Hyperlink ){ |
| 72 | json_set_err(FSL_JSON_E_DENIED, "Requires 'h' permissions."); |
| 73 | return NULL; |
| 74 | } |
| 75 | zCI = json_find_option_cstr("checkin",NULL,"ci" ); |
| 76 | |
| 77 | /* If a specific check-in is requested, fetch and parse it. If the |
| 78 |
| --- src/json_dir.c | |
| +++ src/json_dir.c | |
| @@ -66,12 +66,12 @@ | |
| 66 | char * zUuid = NULL; |
| 67 | char const * zCI = NULL; |
| 68 | Manifest * pM = NULL; |
| 69 | Stmt q = empty_Stmt; |
| 70 | int rid = 0; |
| 71 | if( !g.perm.Read ){ |
| 72 | json_set_err(FSL_JSON_E_DENIED, "Requires 'o' permissions."); |
| 73 | return NULL; |
| 74 | } |
| 75 | zCI = json_find_option_cstr("checkin",NULL,"ci" ); |
| 76 | |
| 77 | /* If a specific check-in is requested, fetch and parse it. If the |
| 78 |
+2
-3
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -594,11 +594,11 @@ | ||
| 594 | 594 | @ <td><input type="submit" name="in" value="Login" |
| 595 | 595 | @ onClick="chngAction(this.form)" /></td> |
| 596 | 596 | @ </tr> |
| 597 | 597 | @ </table> |
| 598 | 598 | @ <script type="text/JavaScript"> |
| 599 | - @ document.getElementById('u').focus() | |
| 599 | + @ gebi('u').focus() | |
| 600 | 600 | @ function chngAction(form){ |
| 601 | 601 | if( g.sslNotAvailable==0 |
| 602 | 602 | && memcmp(g.zBaseURL,"https:",6)!=0 |
| 603 | 603 | && db_get_boolean("https-login",0) |
| 604 | 604 | ){ |
| @@ -635,12 +635,11 @@ | ||
| 635 | 635 | @ <div class="captcha"><table class="captcha"><tr><td><pre> |
| 636 | 636 | @ %s(zCaptcha) |
| 637 | 637 | @ </pre></td></tr></table> |
| 638 | 638 | if( bAutoCaptcha ) { |
| 639 | 639 | @ <input type="button" value="Fill out captcha" |
| 640 | - @ onclick="document.getElementById('u').value='anonymous'; | |
| 641 | - @ document.getElementById('p').value='%s(zDecoded)';" /> | |
| 640 | + @ onclick="gebi('u').value='anonymous'; gebi('p').value='%s(zDecoded)';" /> | |
| 642 | 641 | } |
| 643 | 642 | @ </div> |
| 644 | 643 | free(zCaptcha); |
| 645 | 644 | } |
| 646 | 645 | if( g.zLogin ){ |
| 647 | 646 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -594,11 +594,11 @@ | |
| 594 | @ <td><input type="submit" name="in" value="Login" |
| 595 | @ onClick="chngAction(this.form)" /></td> |
| 596 | @ </tr> |
| 597 | @ </table> |
| 598 | @ <script type="text/JavaScript"> |
| 599 | @ document.getElementById('u').focus() |
| 600 | @ function chngAction(form){ |
| 601 | if( g.sslNotAvailable==0 |
| 602 | && memcmp(g.zBaseURL,"https:",6)!=0 |
| 603 | && db_get_boolean("https-login",0) |
| 604 | ){ |
| @@ -635,12 +635,11 @@ | |
| 635 | @ <div class="captcha"><table class="captcha"><tr><td><pre> |
| 636 | @ %s(zCaptcha) |
| 637 | @ </pre></td></tr></table> |
| 638 | if( bAutoCaptcha ) { |
| 639 | @ <input type="button" value="Fill out captcha" |
| 640 | @ onclick="document.getElementById('u').value='anonymous'; |
| 641 | @ document.getElementById('p').value='%s(zDecoded)';" /> |
| 642 | } |
| 643 | @ </div> |
| 644 | free(zCaptcha); |
| 645 | } |
| 646 | if( g.zLogin ){ |
| 647 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -594,11 +594,11 @@ | |
| 594 | @ <td><input type="submit" name="in" value="Login" |
| 595 | @ onClick="chngAction(this.form)" /></td> |
| 596 | @ </tr> |
| 597 | @ </table> |
| 598 | @ <script type="text/JavaScript"> |
| 599 | @ gebi('u').focus() |
| 600 | @ function chngAction(form){ |
| 601 | if( g.sslNotAvailable==0 |
| 602 | && memcmp(g.zBaseURL,"https:",6)!=0 |
| 603 | && db_get_boolean("https-login",0) |
| 604 | ){ |
| @@ -635,12 +635,11 @@ | |
| 635 | @ <div class="captcha"><table class="captcha"><tr><td><pre> |
| 636 | @ %s(zCaptcha) |
| 637 | @ </pre></td></tr></table> |
| 638 | if( bAutoCaptcha ) { |
| 639 | @ <input type="button" value="Fill out captcha" |
| 640 | @ onclick="gebi('u').value='anonymous'; gebi('p').value='%s(zDecoded)';" /> |
| 641 | } |
| 642 | @ </div> |
| 643 | free(zCaptcha); |
| 644 | } |
| 645 | if( g.zLogin ){ |
| 646 |
+1
-1
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -1166,11 +1166,11 @@ | ||
| 1166 | 1166 | } else { |
| 1167 | 1167 | @ <br /> |
| 1168 | 1168 | } |
| 1169 | 1169 | } |
| 1170 | 1170 | } |
| 1171 | - @ </td><td style="width: 30;"></td><td valign="top"> | |
| 1171 | + @ </td><td style="width:50px;"></td><td valign="top"> | |
| 1172 | 1172 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1173 | 1173 | if( pSet->width!=0 ){ |
| 1174 | 1174 | entry_attribute(pSet->name, /*pSet->width*/ 40, pSet->name, |
| 1175 | 1175 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1176 | 1176 | (char*)pSet->def); |
| 1177 | 1177 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -1166,11 +1166,11 @@ | |
| 1166 | } else { |
| 1167 | @ <br /> |
| 1168 | } |
| 1169 | } |
| 1170 | } |
| 1171 | @ </td><td style="width: 30;"></td><td valign="top"> |
| 1172 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1173 | if( pSet->width!=0 ){ |
| 1174 | entry_attribute(pSet->name, /*pSet->width*/ 40, pSet->name, |
| 1175 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1176 | (char*)pSet->def); |
| 1177 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -1166,11 +1166,11 @@ | |
| 1166 | } else { |
| 1167 | @ <br /> |
| 1168 | } |
| 1169 | } |
| 1170 | } |
| 1171 | @ </td><td style="width:50px;"></td><td valign="top"> |
| 1172 | for(pSet=ctrlSettings; pSet->name!=0; pSet++){ |
| 1173 | if( pSet->width!=0 ){ |
| 1174 | entry_attribute(pSet->name, /*pSet->width*/ 40, pSet->name, |
| 1175 | pSet->var!=0 ? pSet->var : pSet->name, |
| 1176 | (char*)pSet->def); |
| 1177 |
+19
-2
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -123,11 +123,11 @@ | ||
| 123 | 123 | void style_resolve_href(void){ |
| 124 | 124 | int i; |
| 125 | 125 | if( !g.perm.Hyperlink || !g.javascriptHyperlink || nHref==0 ) return; |
| 126 | 126 | @ <script type="text/JavaScript"> |
| 127 | 127 | @ /* <![CDATA[ */ |
| 128 | - @ function u(i,h){ document.getElementById(i).href=h; } | |
| 128 | + @ function u(i,h){gebi(i).href=h;} | |
| 129 | 129 | for(i=0; i<nHref; i++){ |
| 130 | 130 | @ u(%d(i+1),"%s(aHref[i])"); |
| 131 | 131 | } |
| 132 | 132 | @ /* ]]> */ |
| 133 | 133 | @ </script> |
| @@ -173,11 +173,12 @@ | ||
| 173 | 173 | va_start(ap, zTitleFormat); |
| 174 | 174 | zTitle = vmprintf(zTitleFormat, ap); |
| 175 | 175 | va_end(ap); |
| 176 | 176 | |
| 177 | 177 | cgi_destination(CGI_HEADER); |
| 178 | - cgi_printf("%s","<!DOCTYPE html>"); | |
| 178 | + | |
| 179 | + @ <!DOCTYPE html> | |
| 179 | 180 | |
| 180 | 181 | if( g.thTrace ) Th_Trace("BEGIN_HEADER<br />\n", -1); |
| 181 | 182 | |
| 182 | 183 | /* Generate the header up through the main menu */ |
| 183 | 184 | Th_Store("project_name", db_get("project-name","Unnamed Fossil Project")); |
| @@ -199,10 +200,26 @@ | ||
| 199 | 200 | Th_Unstore("title"); /* Avoid collisions with ticket field names */ |
| 200 | 201 | cgi_destination(CGI_BODY); |
| 201 | 202 | g.cgiOutput = 1; |
| 202 | 203 | headerHasBeenGenerated = 1; |
| 203 | 204 | sideboxUsed = 0; |
| 205 | + | |
| 206 | + /* Make the gebi(x) function available as an almost-alias for | |
| 207 | + ** document.getElementById(x) (except that it throws if the element is not found). | |
| 208 | + ** | |
| 209 | + ** Maintenance note: this function must of course be available | |
| 210 | + ** before it is called. It "should" go in the HEAD so that client | |
| 211 | + ** HEAD code can make use of it, but because the client can replace | |
| 212 | + ** the HEAD, and some fossil pages rely on gebi(), we put it here. | |
| 213 | + */ | |
| 214 | + @ <script> | |
| 215 | + @ function gebi(x){ | |
| 216 | + @ if(/^#/.test(x)) x = x.substr(1); | |
| 217 | + @ var e = document.getElementById(x); | |
| 218 | + @ if(!e) throw new Error("Expecting element with ID "+x); | |
| 219 | + @ else return e;} | |
| 220 | + @ </script> | |
| 204 | 221 | } |
| 205 | 222 | |
| 206 | 223 | /* |
| 207 | 224 | ** Append ad unit text if appropriate. |
| 208 | 225 | */ |
| 209 | 226 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -123,11 +123,11 @@ | |
| 123 | void style_resolve_href(void){ |
| 124 | int i; |
| 125 | if( !g.perm.Hyperlink || !g.javascriptHyperlink || nHref==0 ) return; |
| 126 | @ <script type="text/JavaScript"> |
| 127 | @ /* <![CDATA[ */ |
| 128 | @ function u(i,h){ document.getElementById(i).href=h; } |
| 129 | for(i=0; i<nHref; i++){ |
| 130 | @ u(%d(i+1),"%s(aHref[i])"); |
| 131 | } |
| 132 | @ /* ]]> */ |
| 133 | @ </script> |
| @@ -173,11 +173,12 @@ | |
| 173 | va_start(ap, zTitleFormat); |
| 174 | zTitle = vmprintf(zTitleFormat, ap); |
| 175 | va_end(ap); |
| 176 | |
| 177 | cgi_destination(CGI_HEADER); |
| 178 | cgi_printf("%s","<!DOCTYPE html>"); |
| 179 | |
| 180 | if( g.thTrace ) Th_Trace("BEGIN_HEADER<br />\n", -1); |
| 181 | |
| 182 | /* Generate the header up through the main menu */ |
| 183 | Th_Store("project_name", db_get("project-name","Unnamed Fossil Project")); |
| @@ -199,10 +200,26 @@ | |
| 199 | Th_Unstore("title"); /* Avoid collisions with ticket field names */ |
| 200 | cgi_destination(CGI_BODY); |
| 201 | g.cgiOutput = 1; |
| 202 | headerHasBeenGenerated = 1; |
| 203 | sideboxUsed = 0; |
| 204 | } |
| 205 | |
| 206 | /* |
| 207 | ** Append ad unit text if appropriate. |
| 208 | */ |
| 209 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -123,11 +123,11 @@ | |
| 123 | void style_resolve_href(void){ |
| 124 | int i; |
| 125 | if( !g.perm.Hyperlink || !g.javascriptHyperlink || nHref==0 ) return; |
| 126 | @ <script type="text/JavaScript"> |
| 127 | @ /* <![CDATA[ */ |
| 128 | @ function u(i,h){gebi(i).href=h;} |
| 129 | for(i=0; i<nHref; i++){ |
| 130 | @ u(%d(i+1),"%s(aHref[i])"); |
| 131 | } |
| 132 | @ /* ]]> */ |
| 133 | @ </script> |
| @@ -173,11 +173,12 @@ | |
| 173 | va_start(ap, zTitleFormat); |
| 174 | zTitle = vmprintf(zTitleFormat, ap); |
| 175 | va_end(ap); |
| 176 | |
| 177 | cgi_destination(CGI_HEADER); |
| 178 | |
| 179 | @ <!DOCTYPE html> |
| 180 | |
| 181 | if( g.thTrace ) Th_Trace("BEGIN_HEADER<br />\n", -1); |
| 182 | |
| 183 | /* Generate the header up through the main menu */ |
| 184 | Th_Store("project_name", db_get("project-name","Unnamed Fossil Project")); |
| @@ -199,10 +200,26 @@ | |
| 200 | Th_Unstore("title"); /* Avoid collisions with ticket field names */ |
| 201 | cgi_destination(CGI_BODY); |
| 202 | g.cgiOutput = 1; |
| 203 | headerHasBeenGenerated = 1; |
| 204 | sideboxUsed = 0; |
| 205 | |
| 206 | /* Make the gebi(x) function available as an almost-alias for |
| 207 | ** document.getElementById(x) (except that it throws if the element is not found). |
| 208 | ** |
| 209 | ** Maintenance note: this function must of course be available |
| 210 | ** before it is called. It "should" go in the HEAD so that client |
| 211 | ** HEAD code can make use of it, but because the client can replace |
| 212 | ** the HEAD, and some fossil pages rely on gebi(), we put it here. |
| 213 | */ |
| 214 | @ <script> |
| 215 | @ function gebi(x){ |
| 216 | @ if(/^#/.test(x)) x = x.substr(1); |
| 217 | @ var e = document.getElementById(x); |
| 218 | @ if(!e) throw new Error("Expecting element with ID "+x); |
| 219 | @ else return e;} |
| 220 | @ </script> |
| 221 | } |
| 222 | |
| 223 | /* |
| 224 | ** Append ad unit text if appropriate. |
| 225 | */ |
| 226 |
+19
-2
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -123,11 +123,11 @@ | ||
| 123 | 123 | void style_resolve_href(void){ |
| 124 | 124 | int i; |
| 125 | 125 | if( !g.perm.Hyperlink || !g.javascriptHyperlink || nHref==0 ) return; |
| 126 | 126 | @ <script type="text/JavaScript"> |
| 127 | 127 | @ /* <![CDATA[ */ |
| 128 | - @ function u(i,h){ document.getElementById(i).href=h; } | |
| 128 | + @ function u(i,h){gebi(i).href=h;} | |
| 129 | 129 | for(i=0; i<nHref; i++){ |
| 130 | 130 | @ u(%d(i+1),"%s(aHref[i])"); |
| 131 | 131 | } |
| 132 | 132 | @ /* ]]> */ |
| 133 | 133 | @ </script> |
| @@ -173,11 +173,12 @@ | ||
| 173 | 173 | va_start(ap, zTitleFormat); |
| 174 | 174 | zTitle = vmprintf(zTitleFormat, ap); |
| 175 | 175 | va_end(ap); |
| 176 | 176 | |
| 177 | 177 | cgi_destination(CGI_HEADER); |
| 178 | - cgi_printf("%s","<!DOCTYPE html>"); | |
| 178 | + | |
| 179 | + @ <!DOCTYPE html> | |
| 179 | 180 | |
| 180 | 181 | if( g.thTrace ) Th_Trace("BEGIN_HEADER<br />\n", -1); |
| 181 | 182 | |
| 182 | 183 | /* Generate the header up through the main menu */ |
| 183 | 184 | Th_Store("project_name", db_get("project-name","Unnamed Fossil Project")); |
| @@ -199,10 +200,26 @@ | ||
| 199 | 200 | Th_Unstore("title"); /* Avoid collisions with ticket field names */ |
| 200 | 201 | cgi_destination(CGI_BODY); |
| 201 | 202 | g.cgiOutput = 1; |
| 202 | 203 | headerHasBeenGenerated = 1; |
| 203 | 204 | sideboxUsed = 0; |
| 205 | + | |
| 206 | + /* Make the gebi(x) function available as an almost-alias for | |
| 207 | + ** document.getElementById(x) (except that it throws if the element is not found). | |
| 208 | + ** | |
| 209 | + ** Maintenance note: this function must of course be available | |
| 210 | + ** before it is called. It "should" go in the HEAD so that client | |
| 211 | + ** HEAD code can make use of it, but because the client can replace | |
| 212 | + ** the HEAD, and some fossil pages rely on gebi(), we put it here. | |
| 213 | + */ | |
| 214 | + @ <script> | |
| 215 | + @ function gebi(x){ | |
| 216 | + @ if(/^#/.test(x)) x = x.substr(1); | |
| 217 | + @ var e = document.getElementById(x); | |
| 218 | + @ if(!e) throw new Error("Expecting element with ID "+x); | |
| 219 | + @ else return e;} | |
| 220 | + @ </script> | |
| 204 | 221 | } |
| 205 | 222 | |
| 206 | 223 | /* |
| 207 | 224 | ** Append ad unit text if appropriate. |
| 208 | 225 | */ |
| 209 | 226 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -123,11 +123,11 @@ | |
| 123 | void style_resolve_href(void){ |
| 124 | int i; |
| 125 | if( !g.perm.Hyperlink || !g.javascriptHyperlink || nHref==0 ) return; |
| 126 | @ <script type="text/JavaScript"> |
| 127 | @ /* <![CDATA[ */ |
| 128 | @ function u(i,h){ document.getElementById(i).href=h; } |
| 129 | for(i=0; i<nHref; i++){ |
| 130 | @ u(%d(i+1),"%s(aHref[i])"); |
| 131 | } |
| 132 | @ /* ]]> */ |
| 133 | @ </script> |
| @@ -173,11 +173,12 @@ | |
| 173 | va_start(ap, zTitleFormat); |
| 174 | zTitle = vmprintf(zTitleFormat, ap); |
| 175 | va_end(ap); |
| 176 | |
| 177 | cgi_destination(CGI_HEADER); |
| 178 | cgi_printf("%s","<!DOCTYPE html>"); |
| 179 | |
| 180 | if( g.thTrace ) Th_Trace("BEGIN_HEADER<br />\n", -1); |
| 181 | |
| 182 | /* Generate the header up through the main menu */ |
| 183 | Th_Store("project_name", db_get("project-name","Unnamed Fossil Project")); |
| @@ -199,10 +200,26 @@ | |
| 199 | Th_Unstore("title"); /* Avoid collisions with ticket field names */ |
| 200 | cgi_destination(CGI_BODY); |
| 201 | g.cgiOutput = 1; |
| 202 | headerHasBeenGenerated = 1; |
| 203 | sideboxUsed = 0; |
| 204 | } |
| 205 | |
| 206 | /* |
| 207 | ** Append ad unit text if appropriate. |
| 208 | */ |
| 209 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -123,11 +123,11 @@ | |
| 123 | void style_resolve_href(void){ |
| 124 | int i; |
| 125 | if( !g.perm.Hyperlink || !g.javascriptHyperlink || nHref==0 ) return; |
| 126 | @ <script type="text/JavaScript"> |
| 127 | @ /* <![CDATA[ */ |
| 128 | @ function u(i,h){gebi(i).href=h;} |
| 129 | for(i=0; i<nHref; i++){ |
| 130 | @ u(%d(i+1),"%s(aHref[i])"); |
| 131 | } |
| 132 | @ /* ]]> */ |
| 133 | @ </script> |
| @@ -173,11 +173,12 @@ | |
| 173 | va_start(ap, zTitleFormat); |
| 174 | zTitle = vmprintf(zTitleFormat, ap); |
| 175 | va_end(ap); |
| 176 | |
| 177 | cgi_destination(CGI_HEADER); |
| 178 | |
| 179 | @ <!DOCTYPE html> |
| 180 | |
| 181 | if( g.thTrace ) Th_Trace("BEGIN_HEADER<br />\n", -1); |
| 182 | |
| 183 | /* Generate the header up through the main menu */ |
| 184 | Th_Store("project_name", db_get("project-name","Unnamed Fossil Project")); |
| @@ -199,10 +200,26 @@ | |
| 200 | Th_Unstore("title"); /* Avoid collisions with ticket field names */ |
| 201 | cgi_destination(CGI_BODY); |
| 202 | g.cgiOutput = 1; |
| 203 | headerHasBeenGenerated = 1; |
| 204 | sideboxUsed = 0; |
| 205 | |
| 206 | /* Make the gebi(x) function available as an almost-alias for |
| 207 | ** document.getElementById(x) (except that it throws if the element is not found). |
| 208 | ** |
| 209 | ** Maintenance note: this function must of course be available |
| 210 | ** before it is called. It "should" go in the HEAD so that client |
| 211 | ** HEAD code can make use of it, but because the client can replace |
| 212 | ** the HEAD, and some fossil pages rely on gebi(), we put it here. |
| 213 | */ |
| 214 | @ <script> |
| 215 | @ function gebi(x){ |
| 216 | @ if(/^#/.test(x)) x = x.substr(1); |
| 217 | @ var e = document.getElementById(x); |
| 218 | @ if(!e) throw new Error("Expecting element with ID "+x); |
| 219 | @ else return e;} |
| 220 | @ </script> |
| 221 | } |
| 222 | |
| 223 | /* |
| 224 | ** Append ad unit text if appropriate. |
| 225 | */ |
| 226 |
+5
-5
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -567,11 +567,11 @@ | ||
| 567 | 567 | if( cSep=='[' ) cgi_printf("["); |
| 568 | 568 | cgi_printf("]}%s", pRow->pNext ? ",\n" : "];\n"); |
| 569 | 569 | } |
| 570 | 570 | cgi_printf("var nrail = %d\n", pGraph->mxRail+1); |
| 571 | 571 | graph_free(pGraph); |
| 572 | - @ var canvasDiv = document.getElementById("canvas"); | |
| 572 | + @ var canvasDiv = gebi("canvas"); | |
| 573 | 573 | #if 0 |
| 574 | 574 | @ var realCanvas = null; |
| 575 | 575 | #endif |
| 576 | 576 | @ function drawBox(color,x0,y0,x1,y1){ |
| 577 | 577 | @ var n = document.createElement("div"); |
| @@ -587,11 +587,11 @@ | ||
| 587 | 587 | @ n.style.height = h+"px"; |
| 588 | 588 | @ n.style.backgroundColor = color; |
| 589 | 589 | @ canvasDiv.appendChild(n); |
| 590 | 590 | @ } |
| 591 | 591 | @ function absoluteY(id){ |
| 592 | - @ var obj = document.getElementById(id); | |
| 592 | + @ var obj = gebi(id); | |
| 593 | 593 | @ if( !obj ) return; |
| 594 | 594 | @ var top = 0; |
| 595 | 595 | @ if( obj.offsetParent ){ |
| 596 | 596 | @ do{ |
| 597 | 597 | @ top += obj.offsetTop; |
| @@ -598,11 +598,11 @@ | ||
| 598 | 598 | @ }while( obj = obj.offsetParent ); |
| 599 | 599 | @ } |
| 600 | 600 | @ return top; |
| 601 | 601 | @ } |
| 602 | 602 | @ function absoluteX(id){ |
| 603 | - @ var obj = document.getElementById(id); | |
| 603 | + @ var obj = gebi(id); | |
| 604 | 604 | @ if( !obj ) return; |
| 605 | 605 | @ var left = 0; |
| 606 | 606 | @ if( obj.offsetParent ){ |
| 607 | 607 | @ do{ |
| 608 | 608 | @ left += obj.offsetLeft; |
| @@ -687,11 +687,11 @@ | ||
| 687 | 687 | @ drawThinArrow(y0,mx,p.x-5); |
| 688 | 688 | @ } |
| 689 | 689 | @ } |
| 690 | 690 | @ } |
| 691 | 691 | @ function renderGraph(){ |
| 692 | - @ var canvasDiv = document.getElementById("canvas"); | |
| 692 | + @ var canvasDiv = gebi("canvas"); | |
| 693 | 693 | @ while( canvasDiv.hasChildNodes() ){ |
| 694 | 694 | @ canvasDiv.removeChild(canvasDiv.firstChild); |
| 695 | 695 | @ } |
| 696 | 696 | @ var canvasY = absoluteY("timelineTable"); |
| 697 | 697 | @ var left = absoluteX("m"+rowinfo[0].id) - absoluteX("canvas") + 15; |
| @@ -704,11 +704,11 @@ | ||
| 704 | 704 | #if 0 |
| 705 | 705 | @ if( btm<32768 ){ |
| 706 | 706 | @ canvasDiv.innerHTML = '<canvas id="timeline-canvas" '+ |
| 707 | 707 | @ 'style="position:absolute;left:'+(left-5)+'px;"' + |
| 708 | 708 | @ ' width="'+width+'" height="'+btm+'"><'+'/canvas>'; |
| 709 | - @ realCanvas = document.getElementById('timeline-canvas'); | |
| 709 | + @ realCanvas = gebi('timeline-canvas'); | |
| 710 | 710 | @ }else{ |
| 711 | 711 | @ realCanvas = 0; |
| 712 | 712 | @ } |
| 713 | 713 | @ var context; |
| 714 | 714 | @ if( realCanvas && realCanvas.getContext |
| 715 | 715 | |
| 716 | 716 | ADDED test/th1-variadic-proc.th1 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -567,11 +567,11 @@ | |
| 567 | if( cSep=='[' ) cgi_printf("["); |
| 568 | cgi_printf("]}%s", pRow->pNext ? ",\n" : "];\n"); |
| 569 | } |
| 570 | cgi_printf("var nrail = %d\n", pGraph->mxRail+1); |
| 571 | graph_free(pGraph); |
| 572 | @ var canvasDiv = document.getElementById("canvas"); |
| 573 | #if 0 |
| 574 | @ var realCanvas = null; |
| 575 | #endif |
| 576 | @ function drawBox(color,x0,y0,x1,y1){ |
| 577 | @ var n = document.createElement("div"); |
| @@ -587,11 +587,11 @@ | |
| 587 | @ n.style.height = h+"px"; |
| 588 | @ n.style.backgroundColor = color; |
| 589 | @ canvasDiv.appendChild(n); |
| 590 | @ } |
| 591 | @ function absoluteY(id){ |
| 592 | @ var obj = document.getElementById(id); |
| 593 | @ if( !obj ) return; |
| 594 | @ var top = 0; |
| 595 | @ if( obj.offsetParent ){ |
| 596 | @ do{ |
| 597 | @ top += obj.offsetTop; |
| @@ -598,11 +598,11 @@ | |
| 598 | @ }while( obj = obj.offsetParent ); |
| 599 | @ } |
| 600 | @ return top; |
| 601 | @ } |
| 602 | @ function absoluteX(id){ |
| 603 | @ var obj = document.getElementById(id); |
| 604 | @ if( !obj ) return; |
| 605 | @ var left = 0; |
| 606 | @ if( obj.offsetParent ){ |
| 607 | @ do{ |
| 608 | @ left += obj.offsetLeft; |
| @@ -687,11 +687,11 @@ | |
| 687 | @ drawThinArrow(y0,mx,p.x-5); |
| 688 | @ } |
| 689 | @ } |
| 690 | @ } |
| 691 | @ function renderGraph(){ |
| 692 | @ var canvasDiv = document.getElementById("canvas"); |
| 693 | @ while( canvasDiv.hasChildNodes() ){ |
| 694 | @ canvasDiv.removeChild(canvasDiv.firstChild); |
| 695 | @ } |
| 696 | @ var canvasY = absoluteY("timelineTable"); |
| 697 | @ var left = absoluteX("m"+rowinfo[0].id) - absoluteX("canvas") + 15; |
| @@ -704,11 +704,11 @@ | |
| 704 | #if 0 |
| 705 | @ if( btm<32768 ){ |
| 706 | @ canvasDiv.innerHTML = '<canvas id="timeline-canvas" '+ |
| 707 | @ 'style="position:absolute;left:'+(left-5)+'px;"' + |
| 708 | @ ' width="'+width+'" height="'+btm+'"><'+'/canvas>'; |
| 709 | @ realCanvas = document.getElementById('timeline-canvas'); |
| 710 | @ }else{ |
| 711 | @ realCanvas = 0; |
| 712 | @ } |
| 713 | @ var context; |
| 714 | @ if( realCanvas && realCanvas.getContext |
| 715 | |
| 716 | DDED test/th1-variadic-proc.th1 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -567,11 +567,11 @@ | |
| 567 | if( cSep=='[' ) cgi_printf("["); |
| 568 | cgi_printf("]}%s", pRow->pNext ? ",\n" : "];\n"); |
| 569 | } |
| 570 | cgi_printf("var nrail = %d\n", pGraph->mxRail+1); |
| 571 | graph_free(pGraph); |
| 572 | @ var canvasDiv = gebi("canvas"); |
| 573 | #if 0 |
| 574 | @ var realCanvas = null; |
| 575 | #endif |
| 576 | @ function drawBox(color,x0,y0,x1,y1){ |
| 577 | @ var n = document.createElement("div"); |
| @@ -587,11 +587,11 @@ | |
| 587 | @ n.style.height = h+"px"; |
| 588 | @ n.style.backgroundColor = color; |
| 589 | @ canvasDiv.appendChild(n); |
| 590 | @ } |
| 591 | @ function absoluteY(id){ |
| 592 | @ var obj = gebi(id); |
| 593 | @ if( !obj ) return; |
| 594 | @ var top = 0; |
| 595 | @ if( obj.offsetParent ){ |
| 596 | @ do{ |
| 597 | @ top += obj.offsetTop; |
| @@ -598,11 +598,11 @@ | |
| 598 | @ }while( obj = obj.offsetParent ); |
| 599 | @ } |
| 600 | @ return top; |
| 601 | @ } |
| 602 | @ function absoluteX(id){ |
| 603 | @ var obj = gebi(id); |
| 604 | @ if( !obj ) return; |
| 605 | @ var left = 0; |
| 606 | @ if( obj.offsetParent ){ |
| 607 | @ do{ |
| 608 | @ left += obj.offsetLeft; |
| @@ -687,11 +687,11 @@ | |
| 687 | @ drawThinArrow(y0,mx,p.x-5); |
| 688 | @ } |
| 689 | @ } |
| 690 | @ } |
| 691 | @ function renderGraph(){ |
| 692 | @ var canvasDiv = gebi("canvas"); |
| 693 | @ while( canvasDiv.hasChildNodes() ){ |
| 694 | @ canvasDiv.removeChild(canvasDiv.firstChild); |
| 695 | @ } |
| 696 | @ var canvasY = absoluteY("timelineTable"); |
| 697 | @ var left = absoluteX("m"+rowinfo[0].id) - absoluteX("canvas") + 15; |
| @@ -704,11 +704,11 @@ | |
| 704 | #if 0 |
| 705 | @ if( btm<32768 ){ |
| 706 | @ canvasDiv.innerHTML = '<canvas id="timeline-canvas" '+ |
| 707 | @ 'style="position:absolute;left:'+(left-5)+'px;"' + |
| 708 | @ ' width="'+width+'" height="'+btm+'"><'+'/canvas>'; |
| 709 | @ realCanvas = gebi('timeline-canvas'); |
| 710 | @ }else{ |
| 711 | @ realCanvas = 0; |
| 712 | @ } |
| 713 | @ var context; |
| 714 | @ if( realCanvas && realCanvas.getContext |
| 715 | |
| 716 | DDED test/th1-variadic-proc.th1 |
| --- a/test/th1-variadic-proc.th1 | ||
| +++ b/test/th1-variadic-proc.th1 | ||
| @@ -0,0 +1,10 @@ | ||
| 1 | +<th1> | |
| 2 | +proc vfunc {args} { | |
| 3 | + set argc [llength $args] | |
| 4 | + puts "argc=$argc Check this for a memleak when args length > 0\n" | |
| 5 | +} | |
| 6 | +vfunc | |
| 7 | +vfunc 1 | |
| 8 | +vfunc 1 2 | |
| 9 | +vfunc 1 2 3 | |
| 10 | +</th1> |
| --- a/test/th1-variadic-proc.th1 | |
| +++ b/test/th1-variadic-proc.th1 | |
| @@ -0,0 +1,10 @@ | |
| --- a/test/th1-variadic-proc.th1 | |
| +++ b/test/th1-variadic-proc.th1 | |
| @@ -0,0 +1,10 @@ | |
| 1 | <th1> |
| 2 | proc vfunc {args} { |
| 3 | set argc [llength $args] |
| 4 | puts "argc=$argc Check this for a memleak when args length > 0\n" |
| 5 | } |
| 6 | vfunc |
| 7 | vfunc 1 |
| 8 | vfunc 1 2 |
| 9 | vfunc 1 2 3 |
| 10 | </th1> |
| --- a/test/th1-variadic-proc.th1 | ||
| +++ b/test/th1-variadic-proc.th1 | ||
| @@ -0,0 +1,10 @@ | ||
| 1 | +<th1> | |
| 2 | +proc vfunc {args} { | |
| 3 | + set argc [llength $args] | |
| 4 | + puts "argc=$argc Check this for a memleak when args length > 0\n" | |
| 5 | +} | |
| 6 | +vfunc | |
| 7 | +vfunc 1 | |
| 8 | +vfunc 1 2 | |
| 9 | +vfunc 1 2 3 | |
| 10 | +</th1> |
| --- a/test/th1-variadic-proc.th1 | |
| +++ b/test/th1-variadic-proc.th1 | |
| @@ -0,0 +1,10 @@ | |
| --- a/test/th1-variadic-proc.th1 | |
| +++ b/test/th1-variadic-proc.th1 | |
| @@ -0,0 +1,10 @@ | |
| 1 | <th1> |
| 2 | proc vfunc {args} { |
| 3 | set argc [llength $args] |
| 4 | puts "argc=$argc Check this for a memleak when args length > 0\n" |
| 5 | } |
| 6 | vfunc |
| 7 | vfunc 1 |
| 8 | vfunc 1 2 |
| 9 | vfunc 1 2 3 |
| 10 | </th1> |