Skip to content

Commit

Permalink
Initial work to support PS3 Netfront browser. Thanks to Chris Warren …
Browse files Browse the repository at this point in the history
…for investigating the load behavior and finding the need to modify the readyRegExp. Getting some test failures, but many work. Need to figure out why the other failures happen. Skip some tests in the PS3 case since it does not have a usable Function.protoype.toString, so anon and package tests will fail.
  • Loading branch information
jrburke committed Oct 26, 2010
1 parent 96b192a commit bd2e031
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
8 changes: 6 additions & 2 deletions require.js
Expand Up @@ -17,12 +17,16 @@ var require, define;
empty = {}, s,
i, defContextName = "_", contextLoads = [],
scripts, script, rePkg, src, m, dataMain, cfg = {}, setReadyState,
readyRegExp = /^(complete|loaded)$/,
commentRegExp = /(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,
cjsRequireRegExp = /require\(["']([\w-_\.\/]+)["']\)/g,
cjsRequireRegExp = /require\(["']([\w\-_\.\/]+)["']\)/g,
main,
isBrowser = !!(typeof window !== "undefined" && navigator && document),
isWebWorker = !isBrowser && typeof importScripts !== "undefined",
//PS3 indicates loaded and complete, but need to wait for complete
//specifically. Sequence is "loading", "loaded", execution,
// then "complete". The UA check is unfortunate, but not sure how
//to feature test w/o causing perf issues.
readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ? /^complete$/ : /^(complete|loaded)$/,
ostring = Object.prototype.toString,
ap = Array.prototype,
aps = ap.slice, scrollIntervalId, req, baseElement,
Expand Down
3 changes: 3 additions & 0 deletions tasks.txt
@@ -1,3 +1,6 @@
- Allow factory function storage per-url, to reuse across contexts. Hmm, what
to do with modules in an optimized layer.

- get rid of pragma for page load logic exclusion?

- Calculate baseUrl relative to data-main if it is available.
Expand Down
2 changes: 1 addition & 1 deletion testBaseUrl.js
@@ -1,4 +1,4 @@
define(function() {
define([], function() {
doh.register(
"testBaseUrl",
[
Expand Down
29 changes: 27 additions & 2 deletions tests/all.js
@@ -1,37 +1,62 @@
//PS3 does not have a usable Function.prototype.toString,
//so avoid those tests.
var hasToString = (function () {
var test = 'hello world';
}).toString().indexOf('hello world') !== -1;

doh.registerUrl("simple", "../simple.html");

//PS3 does not like this test
doh.registerUrl("baseUrl", "../baseUrl.html");

doh.registerUrl("config", "../config.html");
doh.registerUrl("dataMain", "../dataMain.html");
doh.registerUrl("anonSimple", "../anon/anonSimple.html");
doh.registerUrl("packages", "../packages/packages.html");

if (hasToString) {
doh.registerUrl("anonSimple", "../anon/anonSimple.html");
doh.registerUrl("packages", "../packages/packages.html");
}

doh.registerUrl("simple-nohead", "../simple-nohead.html");

//Only do the base test if the urls work out.
if (location.href.indexOf('http://127.0.0.1/requirejs/') === 0) {
doh.registerUrl("simple-badbase", "../simple-badbase.html");
}


doh.registerUrl("circular", "../circular.html");
doh.registerUrl("depoverlap", "../depoverlap.html");
doh.registerUrl("urlfetch", "../urlfetch/urlfetch.html");
doh.registerUrl("multiversion", "../multiversion.html", 10000);
doh.registerUrl("jquery", "../jquery/jquery.html");

//Next three tests fail in PS3
doh.registerUrl("jqueryDynamic", "../jquery/jqueryDynamic.html");
doh.registerUrl("jqueryDynamic2", "../jquery/jqueryDynamic2.html");
doh.registerUrl("i18nlocaleunknown", "../i18n/i18n.html?bundle=i18n!nls/fr-fr/colors");

doh.registerUrl("i18n", "../i18n/i18n.html");
//Fail in PS3
doh.registerUrl("i18nlocale", "../i18n/i18n.html?locale=en-us-surfer");
//Fail in PS3
doh.registerUrl("i18nbundle", "../i18n/i18n.html?bundle=i18n!nls/en-us-surfer/colors");

doh.registerUrl("modifiers", "../modifier/modifier.html", 10000);
doh.registerUrl("pause/resume", "../pauseresume/pauseresume.html", 10000);
doh.registerUrl("afterload", "../afterload.html", 10000);
doh.registerUrl("text", "../text/text.html");
doh.registerUrl("textOnly", "../text/textOnly.html");
doh.registerUrl("jsonp", "../jsonp/jsonp.html");
doh.registerUrl("order", "../order/order.html");

doh.registerUrl("relative", "../relative/relative.html");

//Hmm, PS3 does not like exports test? assign2 is undefined?
doh.registerUrl("exports", "../exports/exports.html");
doh.registerUrl("transportD", "../transportD/transportD.html");


doh.registerUrl("priority", "../priority/priority.html");
doh.registerUrl("priorityWithDeps", "../priority/priorityWithDeps/priorityWithDeps.html");
doh.registerUrl("prioritySingleCall", "../priority/prioritySingleCall.html");
Expand Down

0 comments on commit bd2e031

Please sign in to comment.