You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2014/08/19 23:01:18 UTC

[jira] [Commented] (CB-7338) [WP8] XHRHelper doesn't resolve request, app crash throwing: 'first chance exception of type 'System.OutOfMemoryException' occurred in Microsoft.Phone.Interop.ni.dll'

    [ https://issues.apache.org/jira/browse/CB-7338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14102831#comment-14102831 ] 

ASF GitHub Bot commented on CB-7338:
------------------------------------

GitHub user martincgg opened a pull request:

    https://github.com/apache/cordova-wp8/pull/50

    [CB-7338]Remove unwanted slashes in URL, and handle Exceptions when a resource is not found

    The URL result of a XHR request, at times contains some unwanted extra slashes, like: 'x-wmapp0: /www or //www'. that URL starting with those slashes, is not well processed by the URI class, so it's required remove them when the 'basePath' is obtained.
    Added, regExp to the js script code to remove any ---->  ':/, ://, :///' , any slash after 'x-wmapp0:', in that way the URI class it will be successfully resolved and provide the file requested.
    Removing unwanted slashes after x-wmapp0 from the basePath, URI cannot process x-wmapp0: /www or //www.
    
    Also added two try-catch statements, over the 'Browser.InvokeScript' statements, if those are not present it throws: 'A first chance exception of type 'System.OutOfMemoryException' occurred in Microsoft.Phone.Interop.ni.dll', stopping the application.
    The try-catch statement it would throw this trace when a requested resource is not available, found or not well resolved by the URI class:
    
    ERROR: Exception in HandleCommand: System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
       at Microsoft.Phone.Controls.NativeMethods.ValidateHResult(Int32 hr)
       at Microsoft.Phone.Controls.WebBrowserInterop.InvokeScript(String scriptName, String[] args)
       at Microsoft.Phone.Controls.WebBrowser.InvokeScript(String scriptName, String[] args)
       at WPCordovaClassLib.CordovaLib.XHRHelper.HandleCommand(String commandStr)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/martincgg/cordova-wp8 CB-7338

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-wp8/pull/50.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #50
    
----
commit 8829719bbbca1e92670f4576f7baa5e6e4701b9a
Author: Martin Gonzalez <ma...@gmail.com>
Date:   2014-08-19T18:15:43Z

    Remove unwanted slashes and handle Exceptions

----


> [WP8] XHRHelper doesn't resolve request, app crash throwing: 'first chance exception of type 'System.OutOfMemoryException' occurred in Microsoft.Phone.Interop.ni.dll'
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CB-7338
>                 URL: https://issues.apache.org/jira/browse/CB-7338
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: WP8
>    Affects Versions: 3.5.0
>            Reporter: Martin Gonzalez
>            Assignee: Martin Gonzalez
>              Labels: WP8, WP8.1, XHR, XHRHelper
>             Fix For: 3.6.0
>
>
> The XHRHelper class for Windows Phone 8 it doesn't resolve some XHR requests, at some point of the process it when it tries to load the URI to get the resource it doesn't resolve it.
> In addition to that, when it doesn't resolve the path it starts to throw exceptions: 'A first chance exception of type 'System.OutOfMemoryException' occurred in Microsoft.Phone.Interop.ni.dll', per each XHR request pointing out to lines where 'Browser.InvokeScript'.
> That exception should be handled to throw information about a resource that it was not found, instead of crash the application.
> Some of this XHR requests where handled by requireJS & text plugin



--
This message was sent by Atlassian JIRA
(v6.2#6252)