Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11606

Cordova.js not including the WinJS Base.js file correctly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Auto Closed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: cordova-js, cordova-windows
    • Labels:
      None

      Description

      If I remote debug to x64 the app side loads through the debugger. I can click around, do everything, no problem.
      BUT once I disconnect the debug process, and then start the app on the surface, it flashes open, then closes... the error from that closing seems to be related to Windows not being defined( i assume from the base) and then creating DB connections off of that.

      I thought maybe it was a change in the debugging setup, so I went through the whole process of side loading it, and the same thing happens.
      I traced it down to Cordova not including the Base.js file correctly, there seem to be pathing issues, but only when i run it on the surface, without the debugger... so I'm confused.
      Of course, since i side loaded it onto the x64 surface, I thought, I could sideload the app onto the Surface RT, which i did, and guess what, it works fine there.
      So why would the same app, side loaded on RT work, but not on x64.
      Is there something different in the Base file its trying to use, maybe it exists for one but not the other?

      If I run the index.html in chrome, i can see more errors, so debugging with that I see a few more things.

      Here is the code in the cordova.js file thats messing up the include (line 1449 in the cordova js i have)

          if (!window.WinJS) {
                  var scriptElem = document.createElement("script");
      
                  if (navigator.appVersion.indexOf('MSAppHost/3.0') !== -1) {
                      // Windows 10 UWP
                      scriptElem.src = '/www/WinJS/js/base.js';
                  } else if (navigator.appVersion.indexOf("Windows Phone 8.1;") !== -1) {
                      // windows phone 8.1 + Mobile IE 11
                      scriptElem.src = "//Microsoft.Phone.WinJS.2.1/js/base.js";
                  } else if (navigator.appVersion.indexOf("MSAppHost/2.0;") !== -1) {
                      // windows 8.1 + IE 11
                      scriptElem.src = "//Microsoft.WinJS.2.0/js/base.js";
                  } else {
                      // windows 8.0 + IE 10
                      scriptElem.src = "//Microsoft.WinJS.1.0/js/base.js";
                  }
                  scriptElem.addEventListener("load", onWinJSReady);
                  document.head.appendChild(scriptElem);
              }
      

      The x64 is firing this include - the else
        scriptElem.src = "//Microsoft.WinJS.1.0/js/base.js";

      When I inspect it loading locally on my machine, its using
      <script src="//Microsoft.WinJS.2.0/js/base.js"></script>

      If i hard code a script tag to the WinJS/js/base.js that error goes away from the console, but then i am still seeing the error for Windows. is not defined.

      Now, with the base.js fixed, its not showing errors in the windows events log, but its still crashing on start up.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              doughnut.express@gmail.com linda zhong
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: