You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by Carlos Santana <cs...@gmail.com> on 2013/08/21 16:03:49 UTC

I want to help on jira issue CB-4421: WP8 Project - XHRHelper.HandleCommand failing with 'System.InvalidOperationException: This operation is not supported for a relative URI" error

I started working on root cause, and potential fix.

There are multiple extra things I found working on this issue:

1. Use should not need to specify 'www' or '/www/' or '//www' in the path
for a relative path like
User should be able to do this $.get("folder/to/devConfig.txt") assuming
folder is a the same directory as index.html (Context root)
What this means is that for other platforms (web, ios, android, etc..)
specifying 'folder/to/devConfig.txt' works, but for wp8 it doesn't user
will need to append the 'www/' this breaks the whole thing about coding for
the web once and run everywhere

2. Is user wants to access a file locally and is not relative to or inside
'www/' then it needs to use the File Plugin, for example accessing a file
at the app root same level as 'www' or higher

3. We should provide a fix and not be jerks and break old code and try to
detect if user specifies '//www/folder..' or 'www/folder..' or 'folder/'
'file.txt' and still work fine and read the relative file. but maybe
putting a console log suggesting to users that proper way will be 'folder/'
or 'file.txt' they should not worry about the name 'www' since it could be
specified in config.xml

4. I'm not familiar on how the response is handle back using
InvokeScript("__onXHRLocalCallback" it doesn't look unique like a unique
callback id it looks like a single global for all responses, and might
cause issues with async calls. I think I will need help on this one from
wp8 experts and maybe log it under a different jira issue
https://github.com/apache/cordova-wp8/blob/master/wp8/template/cordovalib/XHRHelper.cs#L222

--Carlos




-- 
Carlos Santana
<cs...@gmail.com>

Re: I want to help on jira issue CB-4421: WP8 Project - XHRHelper.HandleCommand failing with 'System.InvalidOperationException: This operation is not supported for a relative URI" error

Posted by Carlos Santana <cs...@gmail.com>.
Jesse,
   Can you please put the status of the jira issue CB-4421 to "In Progress"
this way its clear you are working on it.

--Carlos


On Wed, Aug 21, 2013 at 12:14 PM, Jesse <pu...@gmail.com> wrote:

> Thanks Carlos, and Ivan.
> Ivan, I will look at your gist.
> Carlos, thanks for the offer to help, I am working on this already, in the
> context of fixing issues with the FileTransfer API.
>
> re: your points:
> 1. There are deeper implications as the file could come from a static
> resource packed in the dll, or unpacked into IsolatedStorage. Ultimately, I
> think the File API and XHR should treat urls the same.
> 2. yes
> 3. sure
> 4. the call is always synchronous, so this is not an issue.
>
> Also, of note, Microsoft will likely be fixing this in an 8.1 update before
> the end of the year. ( in which case we would only have to worry about wp7
> devices )
>
> Cheers,
>   Jesse
>
>
> @purplecabbage
> risingj.com
>
>
> On Wed, Aug 21, 2013 at 7:11 AM, Ivan Baktsheev <ow...@apla.me> wrote:
>
> > hi,
> >
> > i have same issue. here is my patch (for a "This operation is not
> > supported for a relative URI"), but whole javascript thing needs to be
> > rewritten.
> >
> > you must rewrite file platforms/wp8/cordovalib/XHRHelper.cs with this
> one:
> >
> > https://gist.github.com/apla/6294961
> >
> > On 21 Aug 2013, at 18:03, Carlos Santana <cs...@gmail.com> wrote:
> >
> > > I started working on root cause, and potential fix.
> > >
> > > There are multiple extra things I found working on this issue:
> > >
> > > 1. Use should not need to specify 'www' or '/www/' or '//www' in the
> path
> > > for a relative path like
> > > User should be able to do this $.get("folder/to/devConfig.txt")
> assuming
> > > folder is a the same directory as index.html (Context root)
> > > What this means is that for other platforms (web, ios, android, etc..)
> > > specifying 'folder/to/devConfig.txt' works, but for wp8 it doesn't user
> > > will need to append the 'www/' this breaks the whole thing about coding
> > for
> > > the web once and run everywhere
> > >
> > > 2. Is user wants to access a file locally and is not relative to or
> > inside
> > > 'www/' then it needs to use the File Plugin, for example accessing a
> file
> > > at the app root same level as 'www' or higher
> > >
> > > 3. We should provide a fix and not be jerks and break old code and try
> to
> > > detect if user specifies '//www/folder..' or 'www/folder..' or
> 'folder/'
> > > 'file.txt' and still work fine and read the relative file. but maybe
> > > putting a console log suggesting to users that proper way will be
> > 'folder/'
> > > or 'file.txt' they should not worry about the name 'www' since it could
> > be
> > > specified in config.xml
> > >
> > > 4. I'm not familiar on how the response is handle back using
> > > InvokeScript("__onXHRLocalCallback" it doesn't look unique like a
> unique
> > > callback id it looks like a single global for all responses, and might
> > > cause issues with async calls. I think I will need help on this one
> from
> > > wp8 experts and maybe log it under a different jira issue
> > >
> >
> https://github.com/apache/cordova-wp8/blob/master/wp8/template/cordovalib/XHRHelper.cs#L222
> > >
> > > --Carlos
> > >
> > >
> > >
> > >
> > > --
> > > Carlos Santana
> > > <cs...@gmail.com>
> >
> >
>



-- 
Carlos Santana
<cs...@gmail.com>

Re: I want to help on jira issue CB-4421: WP8 Project - XHRHelper.HandleCommand failing with 'System.InvalidOperationException: This operation is not supported for a relative URI" error

Posted by Jesse <pu...@gmail.com>.
Thanks Carlos, and Ivan.
Ivan, I will look at your gist.
Carlos, thanks for the offer to help, I am working on this already, in the
context of fixing issues with the FileTransfer API.

re: your points:
1. There are deeper implications as the file could come from a static
resource packed in the dll, or unpacked into IsolatedStorage. Ultimately, I
think the File API and XHR should treat urls the same.
2. yes
3. sure
4. the call is always synchronous, so this is not an issue.

Also, of note, Microsoft will likely be fixing this in an 8.1 update before
the end of the year. ( in which case we would only have to worry about wp7
devices )

Cheers,
  Jesse


@purplecabbage
risingj.com


On Wed, Aug 21, 2013 at 7:11 AM, Ivan Baktsheev <ow...@apla.me> wrote:

> hi,
>
> i have same issue. here is my patch (for a "This operation is not
> supported for a relative URI"), but whole javascript thing needs to be
> rewritten.
>
> you must rewrite file platforms/wp8/cordovalib/XHRHelper.cs with this one:
>
> https://gist.github.com/apla/6294961
>
> On 21 Aug 2013, at 18:03, Carlos Santana <cs...@gmail.com> wrote:
>
> > I started working on root cause, and potential fix.
> >
> > There are multiple extra things I found working on this issue:
> >
> > 1. Use should not need to specify 'www' or '/www/' or '//www' in the path
> > for a relative path like
> > User should be able to do this $.get("folder/to/devConfig.txt") assuming
> > folder is a the same directory as index.html (Context root)
> > What this means is that for other platforms (web, ios, android, etc..)
> > specifying 'folder/to/devConfig.txt' works, but for wp8 it doesn't user
> > will need to append the 'www/' this breaks the whole thing about coding
> for
> > the web once and run everywhere
> >
> > 2. Is user wants to access a file locally and is not relative to or
> inside
> > 'www/' then it needs to use the File Plugin, for example accessing a file
> > at the app root same level as 'www' or higher
> >
> > 3. We should provide a fix and not be jerks and break old code and try to
> > detect if user specifies '//www/folder..' or 'www/folder..' or 'folder/'
> > 'file.txt' and still work fine and read the relative file. but maybe
> > putting a console log suggesting to users that proper way will be
> 'folder/'
> > or 'file.txt' they should not worry about the name 'www' since it could
> be
> > specified in config.xml
> >
> > 4. I'm not familiar on how the response is handle back using
> > InvokeScript("__onXHRLocalCallback" it doesn't look unique like a unique
> > callback id it looks like a single global for all responses, and might
> > cause issues with async calls. I think I will need help on this one from
> > wp8 experts and maybe log it under a different jira issue
> >
> https://github.com/apache/cordova-wp8/blob/master/wp8/template/cordovalib/XHRHelper.cs#L222
> >
> > --Carlos
> >
> >
> >
> >
> > --
> > Carlos Santana
> > <cs...@gmail.com>
>
>

Re: I want to help on jira issue CB-4421: WP8 Project - XHRHelper.HandleCommand failing with 'System.InvalidOperationException: This operation is not supported for a relative URI" error

Posted by Ivan Baktsheev <ow...@apla.me>.
hi,

i have same issue. here is my patch (for a "This operation is not supported for a relative URI"), but whole javascript thing needs to be rewritten.

you must rewrite file platforms/wp8/cordovalib/XHRHelper.cs with this one:

https://gist.github.com/apla/6294961

On 21 Aug 2013, at 18:03, Carlos Santana <cs...@gmail.com> wrote:

> I started working on root cause, and potential fix.
> 
> There are multiple extra things I found working on this issue:
> 
> 1. Use should not need to specify 'www' or '/www/' or '//www' in the path
> for a relative path like
> User should be able to do this $.get("folder/to/devConfig.txt") assuming
> folder is a the same directory as index.html (Context root)
> What this means is that for other platforms (web, ios, android, etc..)
> specifying 'folder/to/devConfig.txt' works, but for wp8 it doesn't user
> will need to append the 'www/' this breaks the whole thing about coding for
> the web once and run everywhere
> 
> 2. Is user wants to access a file locally and is not relative to or inside
> 'www/' then it needs to use the File Plugin, for example accessing a file
> at the app root same level as 'www' or higher
> 
> 3. We should provide a fix and not be jerks and break old code and try to
> detect if user specifies '//www/folder..' or 'www/folder..' or 'folder/'
> 'file.txt' and still work fine and read the relative file. but maybe
> putting a console log suggesting to users that proper way will be 'folder/'
> or 'file.txt' they should not worry about the name 'www' since it could be
> specified in config.xml
> 
> 4. I'm not familiar on how the response is handle back using
> InvokeScript("__onXHRLocalCallback" it doesn't look unique like a unique
> callback id it looks like a single global for all responses, and might
> cause issues with async calls. I think I will need help on this one from
> wp8 experts and maybe log it under a different jira issue
> https://github.com/apache/cordova-wp8/blob/master/wp8/template/cordovalib/XHRHelper.cs#L222
> 
> --Carlos
> 
> 
> 
> 
> -- 
> Carlos Santana
> <cs...@gmail.com>