1 | <!DOCTYPE html> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <script src="../../../dojo/dojo.js" data-dojo-config="async:true, isDebug:true, selectorEngine: 'lite'"></script> |
---|
5 | <script> |
---|
6 | // These are the values I expect to be the same across all [mobile] webkit browsers |
---|
7 | var expected = { |
---|
8 | // Default settings for a browser, from dojo.js; apparently these get modified in special cases |
---|
9 | // like when running under node, or against RequireJS, but nothing we need to worry about. |
---|
10 | "host-browser":1, |
---|
11 | "host-node": false, |
---|
12 | "host-rhino": false, |
---|
13 | "dom":1, |
---|
14 | "dojo-amd-factory-scan":1, |
---|
15 | "dojo-loader":1, |
---|
16 | "dojo-has-api":1, |
---|
17 | "dojo-inject-api":1, |
---|
18 | "dojo-timeout-api":1, |
---|
19 | "dojo-trace-api":1, |
---|
20 | "dojo-log-api":1, |
---|
21 | "dojo-dom-ready-api":1, |
---|
22 | "dojo-publish-privates":1, |
---|
23 | "dojo-config-api":1, |
---|
24 | "dojo-sniff":1, |
---|
25 | "dojo-sync-loader":1, |
---|
26 | "dojo-test-sniff":1, |
---|
27 | "config-tlmSiblingOfDojo":1, |
---|
28 | |
---|
29 | // Other configuration switches that are hardcoded in the source. |
---|
30 | // Setting some of these to false may reduce code size, but unclear what they all mean. |
---|
31 | "config-publishRequireResult": 1, |
---|
32 | "dojo-config-addOnLoad": 1, // hardcoded to 1 in the source |
---|
33 | "dojo-config-require": 1, |
---|
34 | "dojo-debug-messages": true, |
---|
35 | "dojo-gettext-api": 1, // apparently unused |
---|
36 | "dojo-guarantee-console": 1, |
---|
37 | "dojo-loader-eval-hint-url": 1, |
---|
38 | "dojo-modulePaths": 1, |
---|
39 | "dojo-moduleUrl": 1, |
---|
40 | "dojo-v1x-i18n-Api": 1, |
---|
41 | "dojo-xhr-factory": 1, // if require.getXhr() exists (true for dojo's AMD loader, false for requireJS?) |
---|
42 | "extend-dojo": 1, // add functions to global dojo object |
---|
43 | |
---|
44 | // Browser flags |
---|
45 | //"webkit": true, // this is actually a number like 525 but I don't think anyone is using it |
---|
46 | "air": false, |
---|
47 | "ff": undefined, |
---|
48 | "mozilla": undefined, |
---|
49 | "ie": undefined, |
---|
50 | |
---|
51 | // Configuration settings |
---|
52 | "config-selectorEngine": "lite", |
---|
53 | "dijit-legacy-requires": false, // don't load unrequested modules for back-compat |
---|
54 | "dom-quirks": false, // we assume/require that the app is in strict mode |
---|
55 | "quirks": false, // we assume/require that the app is in strict mode |
---|
56 | |
---|
57 | // Flags for old IE browser bugs / non-standard behavior |
---|
58 | "array-extensible": true, // false for old IE |
---|
59 | "bug-for-in-skips-shadowed": 0, // false for old IE |
---|
60 | "dom-attributes-explicit": true, // everyone except IE6, 7 |
---|
61 | "dom-attributes-specified-flag": true, //everyone except IE6-8 |
---|
62 | "dom-addeventlistener": true, // everyone except IE |
---|
63 | "native-xhr": true, // has XMLHTTPRequest |
---|
64 | "ie-event-behavior": undefined, |
---|
65 | "dojo-force-activex-xhr": false, // true is for IE path |
---|
66 | |
---|
67 | // Flags for features |
---|
68 | "dom-matches-selector": true, |
---|
69 | "dom-qsa": true, |
---|
70 | "dom-qsa2.1": true, |
---|
71 | "dom-qsa3": true, |
---|
72 | "json-parse": true, |
---|
73 | "json-stringify": true, |
---|
74 | |
---|
75 | // Behavior that varies by browser, but is constant across webkit mobile browsers |
---|
76 | "events-keypress-typed": true, // whether printable characters generate keypress event? |
---|
77 | "events-mouseenter": false, // this is set by mouse.html but never used |
---|
78 | "touch": true |
---|
79 | |
---|
80 | // Values which can be different across mobile devices, so intentionally not specified in this list. |
---|
81 | // "event-orientationchange": true, |
---|
82 | // "safari": true, |
---|
83 | // "android": true |
---|
84 | // "wii": true |
---|
85 | }; |
---|
86 | require([ |
---|
87 | // Modules I need for this script to run |
---|
88 | "dojo/has", |
---|
89 | "dojo/dom", |
---|
90 | "dojo/json", |
---|
91 | "dojo/domReady!", |
---|
92 | |
---|
93 | // These modules loaded because they have a has.add() call. |
---|
94 | // Generated from: |
---|
95 | // $ cd <root> |
---|
96 | // $ find . -name '*.js' -print |xargs fgrep -l 'has.add' |
---|
97 | "dojo/_base/browser", |
---|
98 | "dojo/_base/config", |
---|
99 | "dojo/_base/connect", |
---|
100 | "dojo/_base/kernel", |
---|
101 | "dojo/_base/lang", |
---|
102 | "dojo/_base/loader", |
---|
103 | "dojo/_base/sniff", |
---|
104 | "dojo/_base/window", |
---|
105 | "dojo/_base/xhr", |
---|
106 | "dojo/dom-class", |
---|
107 | "dojo/i18n", |
---|
108 | "dojo/main", |
---|
109 | "dojo/mouse", |
---|
110 | "dojo/on", |
---|
111 | "dojo/query", |
---|
112 | "dojo/ready", |
---|
113 | "dojo/selector/_loader", |
---|
114 | "dojo/selector/lite", |
---|
115 | "dojox/form/uploader/Base", |
---|
116 | "dojox/mobile/Audio", |
---|
117 | "dojox/mobile/sniff" |
---|
118 | ], function(has, dom, json){ |
---|
119 | |
---|
120 | // Code to write output to textarea |
---|
121 | var res = dom.byId("res"); |
---|
122 | res.value = ""; // in case value was saved from this page from before |
---|
123 | function log(){ |
---|
124 | for(var i=0; i<arguments.length; i++){ |
---|
125 | res.value += arguments[i]; |
---|
126 | } |
---|
127 | res.value += "\n"; |
---|
128 | } |
---|
129 | |
---|
130 | log("userAgent: ", navigator.userAgent); |
---|
131 | log("appVersion: ", navigator.appVersion); |
---|
132 | |
---|
133 | /* |
---|
134 | // Rearrange the has() hash to alphabetical order, and dump it to console. |
---|
135 | // We could alternately get the list of has() flags from the builder: |
---|
136 | // $ cd util/buildscripts |
---|
137 | // $ ./build.sh action=release optimize=closure --profile webkitMobile --hasReport 1 |
---|
138 | |
---|
139 | var keys = [], newHash = {}; |
---|
140 | for(var key in has.cache){ |
---|
141 | keys.push(key); |
---|
142 | } |
---|
143 | keys.sort(); |
---|
144 | for(var i=0; i<keys.length; i++){ |
---|
145 | newHash[keys[i]] = has(keys[i]); |
---|
146 | } |
---|
147 | |
---|
148 | // Dump the hash |
---|
149 | log("has() values:") |
---|
150 | log(json.stringify(newHash, null, " ")); |
---|
151 | log("Total: " + keys.length); |
---|
152 | */ |
---|
153 | |
---|
154 | log("\nDifferences from expected values for webkit:"); |
---|
155 | var cnt = 0; |
---|
156 | for(key in expected){ |
---|
157 | if(has(key) !== expected[key]){ |
---|
158 | log(key + ": expected = " + json.stringify(expected[key]) + ", actual: " + |
---|
159 | json.stringify(has(key))); |
---|
160 | cnt++; |
---|
161 | } |
---|
162 | } |
---|
163 | if(cnt == 0){ |
---|
164 | log("None!"); |
---|
165 | } |
---|
166 | }); |
---|
167 | </script> |
---|
168 | <style> |
---|
169 | textarea { |
---|
170 | width: 95%; |
---|
171 | height: 500px; |
---|
172 | } |
---|
173 | </style> |
---|
174 | </head> |
---|
175 | <body> |
---|
176 | <p> |
---|
177 | This file is for testing if the given browser matches the webkitMobile build profile. |
---|
178 | Results: |
---|
179 | </p> |
---|
180 | <textarea id="res"></textarea> |
---|
181 | </body> |
---|
182 | </html> |
---|