SOLVED - Issue with MVC viewer and Chrome

Stimulsoft Reports.WEB discussion
Post Reply
User avatar
poweredbyporkers
Posts: 28
Joined: Fri Nov 29, 2013 8:42 pm

SOLVED - Issue with MVC viewer and Chrome

Post by poweredbyporkers »

Environment C# .NET 4.5 VS 2012 Update 4 Chrome (v31.0.1650.57) IE11

Hi,

Awesome product so far but I'm a little stumped with this issue. Using the mobile viewer I can see my report and toolbar but I can't use any of the buttons in the toolbar all is fine in IE, using MVC viewer I can see the toolbar but the report just never appears due to a error, but again works fine in IE

Code: Select all

"Uncaught TypeError: Cannot read property 'length' of null" at line 113 of WebResource.axd?d=CC6UhKvo7a7jUnHStCIJAAkR2mWwkvEVmM12bx-ZR1WpkNMVHWZXpZk-nkIwLpNggZcH0sPVWgsvi0r0SvSALBqN9gZOUJyp7QwDI2TZ1wqrZRsSa8p2GzFIIkakMD8aeaqUGhWeCGpdp51wRht6Pyr9jUpNmkARk_2YhvXj85EFp-E9xZAIivJhcjWAz7f-0&t=635213123121677529
Image

I have no idea what I've missed, do you? Here is my view

Code: Select all

@using Stimulsoft.Report.Mvc

@section ScriptHeader
{
    @Html.Stimulsoft().RenderMvcViewerScripts()
}

<table>
    <tr>
        <td style="width: 100%;">
            @Html.Stimulsoft().StiMvcViewer(new StiMvcViewerOptions() {
                Theme = StiTheme.Windows7,
                ActionGetReportSnapshot = Model.ReportName + "SnapshotResult",
                ActionViewerEvent = "ViewerEvent",
                ActionPrintReport = "PrintReport",
                ActionExportReport = "ExportReport",
                ActionInteraction = "Interaction"
            })
        </td>
    </tr>
</table>


@section ScriptFooter
{

}
Thanks!
Last edited by poweredbyporkers on Sat Nov 30, 2013 7:11 pm, edited 1 time in total.
User avatar
poweredbyporkers
Posts: 28
Joined: Fri Nov 29, 2013 8:42 pm

Re: Issue with MVC viewer and Chrome

Post by poweredbyporkers »

I've tracked the issue to a <style type="text/css"></style> that is being created in the head of my page only on webkit browsers. I'm assuming it's returning a NULL or undefined to the node.sheet.cssRules.length line and that's where it's blowing up. Can you guys confirm?

Now all I need to do is work out where the hell it's coming from :x

EDIT:

Actually I was wrong. This is the line that's causing all the headaches

<link href='//fonts.googleapis.com/css?family=Open+Sans:400,700,300&subset=latin,vietnamese,latin-ext' rel='stylesheet' type='text/css'>
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: SOLVED - Issue with MVC viewer and Chrome

Post by HighAley »

Hello.

We have added additional check to avoid such issue in future.

Code: Select all

if (node.type == "text/css") {
            if (node.sheet && node.sheet.cssRules) {
                for (j = 0; j < node.sheet.cssRules.length; j++) {
Thank you.
User avatar
poweredbyporkers
Posts: 28
Joined: Fri Nov 29, 2013 8:42 pm

Re: SOLVED - Issue with MVC viewer and Chrome

Post by poweredbyporkers »

Perfect, thank you
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: SOLVED - Issue with MVC viewer and Chrome

Post by HighAley »

Hello.

Let us know if you get any error with our product.

Thank you.
sbd_jeff
Posts: 27
Joined: Fri Nov 08, 2013 9:39 pm

Re: SOLVED - Issue with MVC viewer and Chrome

Post by sbd_jeff »

Has this behavior been applied to your releases?
I'm still getting this error in Chrome.

I've applied the 2014.1.1900.0 dlls:
Stimulsoft.Base
Stimulsoft.Report
Stimulsoft.Report.Mvc
Stimulsoft.Report.MvcMobile

Thanks,
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: SOLVED - Issue with MVC viewer and Chrome

Post by HighAley »

Hello.

Let us know if you need any additional help.

Thank you.
sbd_jeff
Posts: 27
Joined: Fri Nov 08, 2013 9:39 pm

Re: SOLVED - Issue with MVC viewer and Chrome

Post by sbd_jeff »

I've looked at the source for 2014.1.1900.0.
The fix described above was applied to Stimulsoft.Report.Mvc.
It was not applied to Stimulsoft.Report.MvcMobile (specifically the ..\Scripts\Viewer\Viewer.js file).

Please include for next public release.
Thanks!
sbd_jeff
Posts: 27
Joined: Fri Nov 08, 2013 9:39 pm

Re: SOLVED - Issue with MVC viewer and Chrome

Post by sbd_jeff »

Using the following block in Viewer.js:

Code: Select all

    if (node.type == "text/css") {
                if (node.sheet && node.sheet.cssRules) {
                    for (j = 0; j < node.sheet.cssRules.length; j++) {
This works in Chrome and IE, however Firefox 29.0 will raise a "SecurityError: The operation is insecure"

I've found that using node.sheet.rules appears to work:

Code: Select all

if (node.type == "text/css") {
            if (node.sheet && node.sheet.rules) {
                var flag = false;
                for (j = 0; j < node.sheet.cssRules.length; j++) {
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: SOLVED - Issue with MVC viewer and Chrome

Post by HighAley »

Hello.

We have made an improvement.

Thank you.
Post Reply