Details

    • Type: Improvement
    • Status: Open
    • Priority: None
    • Resolution: Unresolved
    • Affects Version/s: Release 3.5.0
    • Fix Version/s: None
    • Component/s: iOS
    • Environment:

      Titanium SDK 3.5.0, iOS

      Description

      Currently globals are not set with the ‘right’ flags. We cannot actually say right or wrong flags, because they’re not in the EcmaScript definition.

      Some discussion happened on https://github.com/smclab/titaniumifier/issues/31.

      The code to test the descriptors is the following:

      var global = (function () { return this; }());
       
      if ((typeof window !== 'undefined') &&
          (window === global) &&
          (!window.hasOwnProperty('alert'))) {
        // In the browser the globals are not directly in the window, but in the
        // prototype chain
        global = Object.getPrototypeOf(global);
      }
       
      printPropertyDescriptor(global, 'alert');
       
      printPropertyDescriptor(global, 'setTimeout');
      printPropertyDescriptor(global, 'clearTimeout');
      printPropertyDescriptor(global, 'setInterval');
      printPropertyDescriptor(global, 'clearInterval');
       
      function printPropertyDescriptor(obj, name) {
      	var descriptor = Object.getOwnPropertyDescriptor(obj, 'clearTimeout');
      	var formatted = JSON.stringify(descriptor, null, 2);
      	console.log(name + " = " + formatted);
      }
      

      The result is different in every environment. As you will see only Titanium on iOS is setting the properties as non-writable.

      Also, if using "use strict" trying to overwrite those properties will result in an error thrown.

      Node.js

      alert = {
        "writable": true,
        "enumerable": true,
        "configurable": true
      }
      setTimeout = {
        "writable": true,
        "enumerable": true,
        "configurable": true
      }
      clearTimeout = {
        "writable": true,
        "enumerable": true,
        "configurable": true
      }
      setInterval = {
        "writable": true,
        "enumerable": true,
        "configurable": true
      }
      clearInterval = {
        "writable": true,
        "enumerable": true,
        "configurable": true
      }
      

      Chrome

      alert = {
        "writable": true,
        "enumerable": true,
        "configurable": false
      }
      setTimeout = {
        "writable": true,
        "enumerable": true,
        "configurable": false
      }
      clearTimeout = {
        "writable": true,
        "enumerable": true,
        "configurable": false
      }
      setInterval = {
        "writable": true,
        "enumerable": true,
        "configurable": false
      }
      clearInterval = {
        "writable": true,
        "enumerable": true,
        "configurable": false
      }
      

      Firefox

      alert = {
        "configurable": true,
        "enumerable": true,
        "writable": true
      }
      setTimeout = {
        "configurable": true,
        "enumerable": true,
        "writable": true
      }
      clearTimeout = {
        "configurable": true,
        "enumerable": true,
        "writable": true
      }
      setInterval = {
        "configurable": true,
        "enumerable": true,
        "writable": true
      }
      clearInterval = {
        "configurable": true,
        "enumerable": true,
        "writable": true
      }
      

      Titanium Android

      alert = {
        "writable": true,
        "enumerable": true,
        "configurable": true
      }
      setTimeout = {
        "writable": true,
        "enumerable": true,
        "configurable": true
      }
      clearTimeout = {
        "writable": true,
        "enumerable": true,
        "configurable": true
      }
      setInterval = {
        "writable": true,
        "enumerable": true,
        "configurable": true
      }
      clearInterval = {
        "writable": true,
        "enumerable": true,
        "configurable": true
      }
      

      Titanium iOS (drumroll)

      alert = {
        "writable": false,
        "enumerable": true,
        "configurable": false
      }
      setTimeout = {
        "writable": false,
        "enumerable": true,
        "configurable": false
      }
      clearTimeout = {
        "writable": false,
        "enumerable": true,
        "configurable": false
      }
      setInterval = {
        "writable": false,
        "enumerable": true,
        "configurable": false
      }
      clearInterval = {
        "writable": false,
        "enumerable": true,
        "configurable": false
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cwilliams Christopher Williams
                Reporter:
                yuchi Pier Paolo Ramon
              • Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration