Permalink
Browse files

latest version of weinre script

  • Loading branch information...
1 parent 188f3f8 commit f67c6cee306806dba93d96ad011350f46fdb406c @sgrebnov committed Dec 13, 2012
Showing with 43 additions and 5 deletions.
  1. +43 −5 WindowsPhone/www/target-script-min.js
View
48 WindowsPhone/www/target-script-min.js
@@ -15,7 +15,8 @@
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
- */
+ */
+
;(function(){
// modjewel.js
(function(){
@@ -520,7 +521,7 @@ this.property = property;
this.target = object[property];
this.hookss = [];
if (typeof this.target === 'undefined') {
-console.log("Unable to hook " + property);
+return;
} else {
hookedFunction = getHookedFunction(this.target, this);
object[property] = hookedFunction;
@@ -1366,6 +1367,33 @@ require("../common/MethodNamer").setNamesForClass(module.exports);
});
;
+// weinre/target/BrowserHacks.amd.js
+;modjewel.define("weinre/target/BrowserHacks", function(require, exports, module) {
+var BrowserHacks;
+BrowserHacks = function() {
+if (typeof document.addEventListener === "undefined") {
+alert("Oops. It seems the page runs in compatibility mode. Please fix it and try again.");
+return;
+}
+if (typeof window.Element === "undefined") {
+window.Element = function() {};
+}
+if (typeof window.Node === "undefined") {
+window.Node = function() {};
+}
+if (!Object.getPrototypeOf) {
+Object.getPrototypeOf = function(object) {
+if (!object.__proto__) {
+throw new Error("This vm does not support __proto__ and getPrototypeOf. Script requires any of them to operate correctly.");
+}
+return object.__proto__;
+};
+}
+};
+BrowserHacks();
+});
+
+;
// weinre/target/CheckForProblems.amd.js
;modjewel.define("weinre/target/CheckForProblems", function(require, exports, module) {
var CheckForProblems, checkForOldPrototypeVersion;
@@ -1435,9 +1463,11 @@ Debug: 4
};
module.exports = Console = (function() {
function Console() {}
-Console.prototype.original = function() {
+Object.defineProperty(Console, 'original', {
+get: function() {
return OriginalConsole;
-};
+}
+});
Console.useRemote = function(value) {
var oldValue;
if (arguments.length === 0) {
@@ -1760,7 +1790,7 @@ property = {};
name = styleDecl.item(i);
property.name = name;
property.priority = styleDecl.getPropertyPriority(name);
-property.implicit = typeof styleDecl.isPropertyImplicit !== "undefined" ? styleDecl.isPropertyImplicit : true;
+property.implicit = typeof styleDecl.isPropertyImplicit !== "undefined" ? styleDecl.isPropertyImplicit(name) : true;
property.shorthandName = typeof styleDecl.getPropertyShorthand !== "undefined" ? styleDecl.getPropertyShorthand(name) || "" : "";
property.status = (property.shorthandName ? "style" : "active");
property.parsedOk = true;
@@ -2815,7 +2845,11 @@ return Weinre.wi.NetworkNotify.didReceiveResponse(this.id, time, "XHR", response
NetworkRequest.prototype.handleLoading = function() {};
NetworkRequest.prototype.handleDone = function() {
var description, sourceString, status, statusText, success, time;
+sourceString = "";
+try {
sourceString = this.xhr.responseText;
+} catch (e) {
+}
Weinre.wi.NetworkNotify.setInitialContent(this.id, sourceString, "XHR");
time = Date.now() / 1000.0;
status = this.xhr.status;
@@ -2946,6 +2980,7 @@ nr = xhr.__weinreNetworkRequest__;
if (!nr) {
return;
}
+try {
switch (xhr.readyState) {
case 2:
return nr.handleHeadersReceived();
@@ -2954,6 +2989,8 @@ return nr.handleLoading();
case 4:
return nr.handleDone();
}
+} catch (e) {
+}
};
};
});
@@ -3276,6 +3313,7 @@ require("../common/MethodNamer").setNamesForClass(module.exports);
// weinre/target/Target.amd.js
;modjewel.define("weinre/target/Target", function(require, exports, module) {
var Binding, CSSStore, Callback, CheckForProblems, ElementHighlighter, Ex, HookLib, InjectedScriptHostImpl, MessageDispatcher, NetworkRequest, NodeStore, Target, Weinre, WeinreExtraClientCommandsImpl, WeinreTargetEventsImpl, WiCSSImpl, WiConsoleImpl, WiDOMImpl, WiDOMStorageImpl, WiDatabaseImpl, WiInspectorImpl, WiRuntimeImpl, currentTime;
+require('./BrowserHacks');
Ex = require('../common/Ex');
Binding = require('../common/Binding');
Callback = require('../common/Callback');

0 comments on commit f67c6ce

Please sign in to comment.