Hello,

I haven't worked with FF OS for a while now but I think you can fix this 
problem pretty quickly. You will have to change the code of your angular.js 
file (you can minify it later after the modification).

Find where angular obtains the reference to the XMLHttpRequest object. It 
should be the following:

var XHR = window.XMLHttpRequest || function() {
  try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e1) {}
  try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e2) {}
  try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e3) {}
  throw new Error("This browser does not support XMLHttpRequest.");
};

Since this angular file is expected to run in FF OS (not IE) apps you can 
change this to:
var XHR = function(){
  return new window.XMLHttpRequest({mozSystem: true});
};

Alternativelly you can search where the XHR object is used and you will 
find the line:
var xhr = new XHR();
you can change it here to:
var xhr = new XHR({mozSystem: true});

Tried this in AngularJS v1.1.5. Let me know if this helps.
Luís

On Thursday, 24 July 2014 03:24:03 UTC+1, jesus israel perales martinez 
wrote:
>
> Hey man , this a simple configuration on jquery but on angular i dont 
> know, this the line code for jquery 
>
>
> var xhr = new XMLHttpRequest({mozSystem: true});
>
>
> how to add this object to $http service? 
> my english is bad.
>
> for more information ---->
> http://stackoverflow.com/questions/13873025/firefox-os-packaged-apps-and-xmlhttprequests
> same problem.
>
> El jueves, 9 de mayo de 2013 08:33:59 UTC-5, Luís Matos escribió:
>>
>> Hello, 
>>
>> I am a member of a team in charge of building a packaged Firefox OS 
>> application. 
>> Due to the restricted CSP policy for Firefox OS privileged applications 
>> I’ve added the ng-csp directive to the body of the application:
>>
>>
>> *<body ng-app="the-app" ng-csp>*
>>
>>  
>>
>> The CSP specification for Firefox OS privileged apps is:
>>  
>> default-src *; script-src 'self'; object-src 'none'; style-src 'self' 
>> 'unsafe-inline'
>>  
>> According to the logs I can get from the Firefox OS device Angular seems 
>> to be calling *eval()* or the *Function()* constructor and both are 
>> blocked in Firefox OS privileged apps and the app simply stops rendering.
>>
>>  
>>
>> I would like to know if this is expected behavior, a known issue or am I 
>> applying the directive incorrectly?
>>
>>  
>>
>> Thanks in advance.
>>
>>  
>>
>> *Angular Version*: v1.0.1
>>
>>  
>>
>> *Error Log:*
>>
>> 05-07 19:31:10.048: ERROR/GeckoConsole(1397): [JavaScript Error: "CSP 
>> ERROR: Couldn't parse invalid source 'unsafe-inline'"] 
>> 05-07 19:31:10.048: ERROR/GeckoConsole(1397): [JavaScript Warning: "CSP 
>> WARN: Failed to parse unrecognized source 'unsafe-inline'"] 
>>
>> <-- Dropped CSS tags --> 
>>
>> 05-07 19:31:13.892: ERROR/GeckoConsole(1397): [JavaScript Error: "Error: 
>> call to Function() blocked by CSP" {file: 
>> "app://788ceebd-a9b7-4a98-a8b0-1ff248e40f52/scripts/vendor/d10639ae.angular.js"
>>  
>> line: 6337}] 
>> 05-07 19:31:13.912: ERROR/GeckoConsole(1397): [JavaScript Warning: "CSP 
>> WARN:  Directive eval script base restriction violated" {file: 
>> "app://788ceebd-a9b7-4a98-a8b0-1ff248e40f52/scripts/vendor/d10639ae.angular.js"
>>  
>> line: *6337* column: 0 source: "call to eval() or related function 
>> blocked by CSP"}] 
>>
>>  
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to