From 6787b29cfaa723c5c181baeb05160cfd4aadfe0f Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Sun, 19 Feb 2012 17:27:09 -0800 Subject: Clean up and repairing manifest --- js/controllers/document-controller.js | 40 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 57289448..c31ffbac 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -66,35 +66,37 @@ var DocumentController = exports.DocumentController = Montage.create(Component, + + + + + //////////////////////////////////////////////////////////////////// + // handleWebRequest: { value: function (request) { - if (request.url.indexOf('js/document/templates/montage-html') !== -1) { - - console.log(request); - - //TODO: Figure out why active document is not available here - - if (this._hackRootFlag) { - - //console.log(request.url.split('/')[request.url.split('/').length-1]); - //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController._activeDocument.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]); - - return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; - } + if (this._hackRootFlag && request.url.indexOf('js/document/templates/montage-html') !== -1) { + //TODO: Optimize creating string + return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; } } }, - - + //////////////////////////////////////////////////////////////////// + // handleAppLoaded: { value: function() { - // - + //Adding an intercept to resources loaded to ensure user assets load from cloud simulator chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: [""]}, ["blocking"]); - } }, - + //////////////////////////////////////////////////////////////////// + + + + + + + + handleExecuteFileOpen: { value: function(event) { var pickerSettings = event._event.settings || {}; -- cgit v1.2.3 From a9f81445afbc10b246ebbbcf99a0db11a9679021 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 20 Feb 2012 11:23:47 -0800 Subject: Styles controller - Check for element's window object before querying for matching css rules. --- js/controllers/styles-controller.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 44ca50e1..71e2c7f9 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -571,6 +571,10 @@ var stylesController = exports.StylesController = Montage.create(Component, { rules = [], win = element.ownerDocument.defaultView, self = this; + + if(!win) { + return null; + } if(!omitPseudos) { pseudos.concat(['link', 'visited', 'active', 'hover', 'focus', 'first-letter', -- cgit v1.2.3 From c743b291e91b6de8440ecba0ddaf62546c1692f1 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 20 Feb 2012 15:46:23 -0800 Subject: Styles Controller -Fix invalid variable reference when looking for element's window object --- js/controllers/styles-controller.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/styles-controller.js b/js/controllers/styles-controller.js index 44ca50e1..7d5dc42b 100755 --- a/js/controllers/styles-controller.js +++ b/js/controllers/styles-controller.js @@ -674,8 +674,9 @@ var stylesController = exports.StylesController = Montage.create(Component, { } var matchingElements, i; + for(i = 0; i < specArr.length; i++) { - matchingElements = win.document.querySelectorAll(specArr[i].selector); + matchingElements = element.ownerDocument.querySelectorAll(specArr[i].selector); if(nj.toArray(matchingElements).indexOf(element) !== -1) { return specArr[i]; } -- cgit v1.2.3