Browse Source

Blobs seem fine

Michelle Bu 11 năm trước cách đây
mục cha
commit
31f4893514
2 tập tin đã thay đổi với 3 bổ sung3 xóa
  1. 2 2
      lib/dataconnection.js
  2. 1 1
      lib/util.js

+ 2 - 2
lib/dataconnection.js

@@ -170,7 +170,7 @@ DataConnection.prototype.send = function(data, chunked) {
 
     // For Chrome-Firefox interoperability, we need to make Firefox "chunk"
     // the data it sends out.
-    var needsChunking = util.chunkedBrowsers.indexOf(this._peerBrowser) !== -1 || util.browser !== 'Firefox';
+    var needsChunking = util.chunkedBrowsers[this._peerBrowser] || util.chunkedBrowsers[util.browser];
     if (needsChunking && !chunked && blob.size > util.chunkedMTU) {
       this._sendChunks(blob);
       return;
@@ -181,7 +181,7 @@ DataConnection.prototype.send = function(data, chunked) {
       util.blobToBinaryString(blob, function(str) {
         self._bufferedSend(str);
       });
-    } else if (!util.supports.binaryBlob || (this._peerSupports && !this._peerSupports.binaryBlob)) {
+    } else if (!util.supports.binaryBlob) {
       // We only do this if we really need to (e.g. blobs are not supported),
       // because this conversion is costly.
       util.blobToArrayBuffer(blob, function(ab) {

+ 1 - 1
lib/util.js

@@ -8,7 +8,7 @@ var util = {
   CLOUD_PORT: 9000,
 
   // Browsers that need chunking:
-  chunkedBrowsers: ['Chrome'],
+  chunkedBrowsers: {'Chrome': 1},
   chunkedMTU: 16300, // The original 60000 bytes setting does not work when sending data from Firefox to Chrome, which is "cut off" after 16384 bytes and delivered individually.
 
   // Logging logic