webrtc底层一对一连接过程探索(四)

一、fun38

1.1 fun38.01(续)

4)代码段四

-1 !== (n = o.indexOf("Version")) && (r = o.substring(n + 8))) : m

? (n = o.indexOf("Firefox"), i = "Firefox", r = o.substring(n + 8))

: (e = o.lastIndexOf(" ") + 1) < (n = o.lastIndexOf("/"))

&& (i = o.substring(e, n),

r = o.substring(n + 1),

i.toLowerCase() === i.toUpperCase() && (i = c.appName));

注:g为false,走v,v为true,走(n = o.indexOf("Chrome"), i = "Chrome", r = o.substring(n + 7)),后面的就不走了,直接到(i = o.substring(e, n),

5) return

return

l && (i = "Edge", r = "" + parseInt(c.userAgent.match(/Edge\/(\d+).(\d+)$/)[2], 10)),

-1 !== (t = r.indexOf(";")) && (r = r.substring(0, t)),

-1 !== (t = r.indexOf(" ")) && (r = r.substring(0, t)),

s = parseInt("" + r, 10),

isNaN(s) && (r = "" + parseFloat(c.appVersion),

s = parseInt(c.appVersion, 10)),

{

   fullVersion: r,

   version: s,

   name: i,

   isPrivateBrowsing: !1

}

a.) l

l为false,所以不走(i = "Edge", r = "" + parseInt(c.userAgent.match(/Edge\/(\d+).(\d+)$/)[2], 10))了。

b.) -1 !== (t = r.indexOf(";")) && (r = r.substring(0, t))

注:(t = r.indexOf(";"))结果为-1,所以-1 !== (t = r.indexOf(";"))不成立,后面的就不走了。

c.) -1 !== (t = r.indexOf(" ")) && (r = r.substring(0, t)),

注:r中有空格,所以-1!==13成立,继续往下走,r=r.substring(0,13)=64.0.2388.140

d.) s = parseInt("" + r, 10),

转化成十进制,是64.

e.) 如下:

isNaN(s) && (r = "" + parseFloat(c.appVersion),

s = parseInt(c.appVersion, 10)),

注:第一句,感觉没啥作用,第二句对s进行了重定义。但打印出来,还是64,不知为什么,因为c.appVersion打印出来如下:

c.appVersion:  5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36

f.) 如下:

{

   fullVersion: r,

   version: s,

   name: i,

   isPrivateBrowsing: !1

}

注:以上是最终return结果,打印如下:

还有就是可以用逗号的形式打印console,如下:

 

1.2 fun38.02

1)本节完整代码如下:

            //fun38.02

            function n(e, n) {

                console.info('fun38.02==>2454==>f38.02');

                var t = 0,

                    o = 50,

                    i = !1,

                    r = window.setInterval(function() {

                        e() && (window.clearInterval(r),

                        n(i)),

                        t++ > o && (window.clearInterval(r),

                        i = !0, n(i))

                    }, 10)

            }

2)e,n

 先看看参数e,n都代表啥,如下:

注:e,n是两个函数。

3) 三个变量

       var t = 0,

          o = 50,

          i = !1,

注:t,o均是数字变量,i代码非0,打印一下为false.

4)r

    r = window.setInterval(function() {

        e() && (window.clearInterval(r),

         n(i)),

         t++ > o && (window.clearInterval(r),

         i = !0, n(i))

       }, 10)

注:这个没走,后面走了,先往下走,走到的时候再说。

1.3 按照程序走

 

1.4 fun38.09

1)本阶段代码

2)代码段一

if (window.webkitRequestFileSystem)

    window.webkitRequestFileSystem(window.TEMPORARY, 1, function() {               

      o = !1

console.log('2471-2471',o);

     },

     function() {

       o = !0

       console.log('2477-2477',o);

     });

注:Google的Chrome完整的支持Filesystem API,

window.requestFileSystem(type, size, successCallback, opt_errorCallback)

中前两个参数,你指定需要的生命周期类型和文件系统的大小。一个持久性的(Persistent)文件系统非常适合长期保存用户数据。浏览器不会删除,除非用户特别要求。一个临时性(Temporary)的文件系统非常适合web应用来缓存数据,但是在浏览器删除文件系统后仍然可以操作。size用来指定字节大小,一般指定有效的最大访问存储大小。第三个参数是请求成功后的回调函数,第四个参数是请求失败后的回调函数。从日志来看,走了,o = !1,说明浏览器是谷歌浏览器。

3)代码段二

else if (window.indexedDB && /Firefox/.test(window.navigator.userAgent)) {

var i;

try {

   i = window.indexedDB.open("test"), i.onerror = function() {

      return !0

}

   } catch (r) {

     o = !0

   }

   void 0 === o && n(function() {

        return "done" === i.readyState

   }, function(e) {

        e || (o = !i.result)

   })

}

注:第一个if走了,说明了是谷歌浏览器,以下的几个elseif都不会走了。包括以上这个判断火狐浏览器的。

1.5 fun38.09

//fun38.09

console.info('fun38.09==>2739==>f38.09');

var d = "Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45";

! function(e) {

   "undefined" == typeof window && ("undefined" == typeof window && "undefined" != typeof global ? (global.navigator = {

   userAgent: d,

   getUserMedia: function() {}

},

   e.window = global) : "undefined" == typeof window, "undefined" == typeof document && (e.document = {},

   document.createElement = document.captureStream = document.mozCaptureStream = function() {

     return {}

}),

"undefined" == typeof location && (e.location = {

     protocol: "file:",

     href: "",

     hash: ""

}),

"undefined" == typeof screen && (e.screen = {

                    width: 0,

                    height: 0

                }))

}("undefined" != typeof global ? global : window);

注:fun38先走的是以上代码,需要逐行解析。

 

posted on 2018-02-19 22:57  小小梁  阅读(234)  评论(0)    收藏  举报

导航