mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Further reduction of CFURL creation and caching of method values.
Reviewed by me.
This commit is contained in:
@@ -110,6 +110,9 @@ if (typeof OBJJ_AUTO_BOOTSTRAP === "undefined" || OBJJ_AUTO_BOOTSTRAP)
|
||||
|
||||
function makeAbsoluteURL(/*CFURL|String*/ aURL)
|
||||
{
|
||||
if (aURL instanceof CFURL && aURL.scheme())
|
||||
return aURL;
|
||||
|
||||
return new CFURL(aURL, mainBundleURL);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,5 @@ var ObjectiveJ = { };
|
||||
|
||||
(function (global, exports)
|
||||
{
|
||||
var global = (function() { return this; })();
|
||||
#include "Includes.js"
|
||||
})(window, ObjectiveJ);
|
||||
|
||||
@@ -46,7 +46,7 @@ GLOBAL(CFBundle) = function(/*CFURL|String*/ aURL)
|
||||
CFBundlesForURLStrings[URLString] = this;
|
||||
|
||||
this._bundleURL = aURL;
|
||||
this._resourcesDirectoryURL = CFURL("Resources/", aURL);
|
||||
this._resourcesDirectoryURL = new CFURL("Resources/", aURL);
|
||||
|
||||
this._staticResource = NULL;
|
||||
|
||||
@@ -66,7 +66,7 @@ CFBundle.environments = function()
|
||||
|
||||
CFBundle.bundleContainingURL = function(/*CFURL|String*/ aURL)
|
||||
{
|
||||
aURL = CFURL(".", makeAbsoluteURL(aURL));
|
||||
aURL = new CFURL(".", makeAbsoluteURL(aURL));
|
||||
|
||||
while (aURL.path() !== "/")
|
||||
{
|
||||
@@ -75,7 +75,7 @@ CFBundle.bundleContainingURL = function(/*CFURL|String*/ aURL)
|
||||
if (bundle)
|
||||
return bundle;
|
||||
|
||||
aURL = CFURL("..", aURL);
|
||||
aURL = new CFURL("..", aURL);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -115,7 +115,7 @@ CFBundle.prototype.resourceURL = function(/*String*/ aResourceName, /*String*/ a
|
||||
if (aSubDirectory)
|
||||
aResourceName = aSubDirectory + "/" + aResourceName;
|
||||
|
||||
var resourceURL = CFURL(aResourceName, this.resourcesDirectoryURL()).mappedURL();
|
||||
var resourceURL = (new CFURL(aResourceName, this.resourcesDirectoryURL())).mappedURL();
|
||||
|
||||
return resourceURL.absoluteURL();
|
||||
}
|
||||
@@ -123,7 +123,7 @@ CFBundle.prototype.resourceURL = function(/*String*/ aResourceName, /*String*/ a
|
||||
CFBundle.prototype.mostEligibleEnvironmentURL = function()
|
||||
{
|
||||
if (this._mostEligibleEnvironmentURL === undefined)
|
||||
this._mostEligibleEnvironmentURL = CFURL(this.mostEligibleEnvironment() + ".environment/", this.bundleURL());
|
||||
this._mostEligibleEnvironmentURL = new CFURL(this.mostEligibleEnvironment() + ".environment/", this.bundleURL());
|
||||
|
||||
return this._mostEligibleEnvironmentURL;
|
||||
}
|
||||
@@ -137,7 +137,7 @@ CFBundle.prototype.executableURL = function()
|
||||
if (!executableSubPath)
|
||||
this._executableURL = NULL;
|
||||
else
|
||||
this._executableURL = CFURL(executableSubPath, this.mostEligibleEnvironmentURL());
|
||||
this._executableURL = new CFURL(executableSubPath, this.mostEligibleEnvironmentURL());
|
||||
}
|
||||
|
||||
return this._executableURL;
|
||||
|
||||
+14
-5
@@ -537,14 +537,23 @@ CFURL.prototype.queryString = function()
|
||||
|
||||
CFURL.prototype.scheme = function()
|
||||
{
|
||||
var scheme = PARTS(this).scheme;
|
||||
var scheme = this._scheme;
|
||||
|
||||
if (scheme)
|
||||
return scheme;
|
||||
if (scheme === undefined)
|
||||
{
|
||||
scheme = PARTS(this).scheme;
|
||||
|
||||
var baseURL = this.baseURL();
|
||||
if (!scheme)
|
||||
{
|
||||
var baseURL = this.baseURL();
|
||||
|
||||
return baseURL && baseURL.scheme();
|
||||
scheme = baseURL && baseURL.scheme();
|
||||
}
|
||||
|
||||
this._scheme = scheme;
|
||||
}
|
||||
|
||||
return scheme;
|
||||
}
|
||||
|
||||
CFURL.prototype.user = function()
|
||||
|
||||
Reference in New Issue
Block a user