# Global Metrics

path: .metrics.nargs.average
old: 1.3333333333333333
new: 0.8571428571428571
path: .metrics.nargs.sum
old: 4.0
new: 12.0
path: .metrics.cyclomatic.average
old: 1.4
new: 11.25
path: .metrics.cyclomatic.sum
old: 14.0
new: 90.0
path: .metrics.cognitive.sum
old: 0.0
new: 115.0
path: .metrics.cognitive.average
old: 0.0
new: 8.214285714285714
path: .metrics.halstead.purity_ratio
old: 0.5161396424509419
new: 1.1089252472197273
path: .metrics.halstead.estimated_program_length
old: 91.35671671381672
new: 2979.6821392794072
path: .metrics.halstead.n1
old: 11.0
new: 35.0
path: .metrics.halstead.N1
old: 117.0
new: 1534.0
path: .metrics.halstead.bugs
old: 0.24045696822978063
new: 4.1401698054927545
path: .metrics.halstead.length
old: 177.0
new: 2687.0
path: .metrics.halstead.n2
old: 14.0
new: 334.0
path: .metrics.halstead.difficulty
old: 23.571428571428573
new: 60.41167664670659
path: .metrics.halstead.vocabulary
old: 25.0
new: 369.0
path: .metrics.halstead.time
old: 1076.37952398707
new: 76901.81811504468
path: .metrics.halstead.volume
old: 821.9625455901262
new: 22913.330715284283
path: .metrics.halstead.N2
old: 60.0
new: 1153.0
path: .metrics.halstead.level
old: 0.04242424242424242
new: 0.016553091314583074
path: .metrics.halstead.effort
old: 19374.831431767263
new: 1384232.7260708043
path: .metrics.nexits.average
old: 0.0
new: 1.4285714285714286
path: .metrics.nexits.sum
old: 0.0
new: 20.0
path: .metrics.mi.mi_original
old: 69.50441420104279
new: 86.86575010804876
path: .metrics.mi.mi_visual_studio
old: 40.64585625791976
new: 50.79868427371272
path: .metrics.mi.mi_sei
old: 51.561560473613966
new: 104.349844606786
path: .metrics.nom.total
old: 3.0
new: 14.0
path: .metrics.nom.closures
old: 0.0
new: 6.0
path: .metrics.nom.functions
old: 3.0
new: 8.0
path: .metrics.loc.lloc
old: 0.0
new: 164.0
path: .metrics.loc.ploc
old: 44.0
new: 447.0
path: .metrics.loc.sloc
old: 50.0
new: 2.0
path: .metrics.loc.cloc
old: 6.0
new: 46.0

# Spaces Data

## Minimal test - lines (555, 574)

path: .spaces[3].metrics.nom.functions
old: 3.0
new: 1.0
path: .spaces[3].metrics.nom.total
old: 3.0
new: 1.0
path: .spaces[3].metrics.nexits.average
old: 0.0
new: 2.0
path: .spaces[3].metrics.nexits.sum
old: 0.0
new: 2.0
path: .spaces[3].metrics.cognitive.sum
old: 0.0
new: 2.0
path: .spaces[3].metrics.cognitive.average
old: 0.0
new: 2.0
path: .spaces[3].metrics.halstead.N1
old: 18.0
new: 32.0
path: .spaces[3].metrics.halstead.difficulty
old: 7.0
new: 8.25
path: .spaces[3].metrics.halstead.n2
old: 3.0
new: 14.0
path: .spaces[3].metrics.halstead.purity_ratio
old: 1.0169321648569456
new: 1.7237116361097495
path: .spaces[3].metrics.halstead.length
old: 24.0
new: 53.0
path: .spaces[3].metrics.halstead.N2
old: 6.0
new: 21.0
path: .spaces[3].metrics.halstead.n1
old: 7.0
new: 11.0
path: .spaces[3].metrics.halstead.vocabulary
old: 10.0
new: 25.0
path: .spaces[3].metrics.halstead.time
old: 31.004662218948713
new: 112.80700660994437
path: .spaces[3].metrics.halstead.effort
old: 558.0839199410768
new: 2030.5261189789985
path: .spaces[3].metrics.halstead.bugs
old: 0.02259496908909482
new: 0.05345042122894763
path: .spaces[3].metrics.halstead.level
old: 0.14285714285714285
new: 0.12121212121212122
path: .spaces[3].metrics.halstead.estimated_program_length
old: 24.406371956566694
new: 91.35671671381672
path: .spaces[3].metrics.halstead.volume
old: 79.7262742772967
new: 246.1243780580604
path: .spaces[3].metrics.loc.sloc
old: 5.0
new: 20.0
path: .spaces[3].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[3].metrics.loc.lloc
old: 0.0
new: 9.0
path: .spaces[3].metrics.loc.blank
old: 0.0
new: 5.0
path: .spaces[3].metrics.loc.ploc
old: 5.0
new: 14.0
path: .spaces[3].metrics.mi.mi_original
old: 121.23838999844426
new: 93.14878471631695
path: .spaces[3].metrics.mi.mi_sei
old: 99.61645146172272
new: 75.96606780783563
path: .spaces[3].metrics.mi.mi_visual_studio
old: 70.89964327394401
new: 54.472973518314014
path: .spaces[3].metrics.nargs.sum
old: 4.0
new: 1.0
path: .spaces[3].metrics.nargs.average
old: 1.3333333333333333
new: 1.0
path: .spaces[3].metrics.cyclomatic.sum
old: 4.0
new: 3.0
path: .spaces[3].metrics.cyclomatic.average
old: 1.0
new: 3.0

### Code

    nsDragService::GetNumDropItems(uint32_t* aNumItems) {
      NS_OBJC_BEGIN_TRY_BLOCK_RETURN;

      *aNumItems = 0;

      // first check to see if we have a number of items cached
      if (mDataItems) {
        mDataItems->GetLength(aNumItems);
        return NS_OK;
      }

      NSArray* droppedItems = [globalDragPboard pasteboardItems];
      if (droppedItems) {
        *aNumItems = [droppedItems count];
      }

      return NS_OK;

      NS_OBJC_END_TRY_BLOCK_RETURN(NS_ERROR_FAILURE);
    }

## Minimal test - lines (577, 581)

path: .spaces[4].metrics.mi.mi_sei
old: 96.04529408721528
new: 97.33099448879852
path: .spaces[4].metrics.mi.mi_original
old: 118.97478077838218
new: 119.86596038678442
path: .spaces[4].metrics.mi.mi_visual_studio
old: 69.57589519203637
new: 70.09705285776867
path: .spaces[4].metrics.halstead.vocabulary
old: 10.0
new: 17.0
path: .spaces[4].metrics.halstead.estimated_program_length
old: 23.509775004326936
new: 52.529325012980806
path: .spaces[4].metrics.halstead.level
old: 0.16666666666666666
new: 0.14814814814814814
path: .spaces[4].metrics.halstead.time
old: 26.5754247590989
new: 44.451158398597435
path: .spaces[4].metrics.halstead.N1
old: 16.0
new: 17.0
path: .spaces[4].metrics.halstead.n2
old: 4.0
new: 8.0
path: .spaces[4].metrics.halstead.effort
old: 478.3576456637802
new: 800.1208511747539
path: .spaces[4].metrics.halstead.purity_ratio
old: 0.9795739585136224
new: 1.8113560349303728
path: .spaces[4].metrics.halstead.difficulty
old: 6.0
new: 6.75
path: .spaces[4].metrics.halstead.n1
old: 6.0
new: 9.0
path: .spaces[4].metrics.halstead.length
old: 24.0
new: 29.0
path: .spaces[4].metrics.halstead.N2
old: 8.0
new: 12.0
path: .spaces[4].metrics.halstead.volume
old: 79.7262742772967
new: 118.53642239625984
path: .spaces[4].metrics.halstead.bugs
old: 0.020388278552093332
new: 0.02872868874940668
path: .spaces[4].metrics.loc.ploc
old: 6.0
new: 5.0
path: .spaces[4].metrics.loc.lloc
old: 0.0
new: 3.0
path: .spaces[4].metrics.loc.sloc
old: 6.0
new: 5.0
path: .spaces[4].metrics.nexits.average
old: null
new: 1.0
path: .spaces[4].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[4].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[4].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[4].metrics.nargs.sum
old: 0.0
new: 3.0
path: .spaces[4].metrics.nargs.average
old: null
new: 3.0
path: .spaces[4].metrics.cognitive.average
old: null
new: 0.0

### Code

    nsDragService::UpdateDragImage(nsINode* aImage, int32_t aImageX, int32_t aImageY) {
      nsBaseDragService::UpdateDragImage(aImage, aImageX, aImageY);
      mDragImageChanged = true;
      return NS_OK;
    }

## Minimal test - lines (57, 57)

path: .spaces[0].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[0].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[0].metrics.mi.mi_visual_studio
old: 55.99744445069413
new: 92.40962204246613
path: .spaces[0].metrics.mi.mi_original
old: 95.75563001068696
new: 158.02045369261705
path: .spaces[0].metrics.mi.mi_sei
old: 97.92581338179852
new: 152.37629276875444
path: .spaces[0].metrics.nexits.average
old: null
new: 0.0
path: .spaces[0].metrics.cognitive.average
old: null
new: 0.0
path: .spaces[0].metrics.loc.ploc
old: 16.0
new: 1.0
path: .spaces[0].metrics.loc.sloc
old: 16.0
new: 1.0
path: .spaces[0].metrics.loc.cloc
old: 4.0
new: 0.0
path: .spaces[0].metrics.halstead.N1
old: 44.0
new: 4.0
path: .spaces[0].metrics.halstead.vocabulary
old: 15.0
new: 5.0
path: .spaces[0].metrics.halstead.difficulty
old: 26.0
new: 2.0
path: .spaces[0].metrics.halstead.n1
old: 10.0
new: 4.0
path: .spaces[0].metrics.halstead.effort
old: 7110.540884007504
new: 23.21928094887362
path: .spaces[0].metrics.halstead.level
old: 0.038461538461538464
new: 0.5
path: .spaces[0].metrics.halstead.N2
old: 26.0
new: 1.0
path: .spaces[0].metrics.halstead.bugs
old: 0.12325763690663293
new: 0.002712967490108627
path: .spaces[0].metrics.halstead.purity_ratio
old: 0.6404131631901491
new: 1.6
path: .spaces[0].metrics.halstead.volume
old: 273.4823416925963
new: 11.60964047443681
path: .spaces[0].metrics.halstead.estimated_program_length
old: 44.82892142331043
new: 8.0
path: .spaces[0].metrics.halstead.time
old: 395.030049111528
new: 1.289960052715201
path: .spaces[0].metrics.halstead.n2
old: 5.0
new: 1.0
path: .spaces[0].metrics.halstead.length
old: 70.0
new: 5.0
path: .spaces[0].metrics.cyclomatic.average
old: 5.0
new: 1.0
path: .spaces[0].metrics.cyclomatic.sum
old: 5.0
new: 1.0
path: .spaces[0].metrics.nargs.average
old: null
new: 0.0

### Code

    nsDragService::~nsDragService() {}

## Minimal test - lines (494, 552)

path: .spaces[2].metrics.halstead.difficulty
old: 5.25
new: 26.23728813559322
path: .spaces[2].metrics.halstead.volume
old: 59.79470570797252
new: 2014.512460305628
path: .spaces[2].metrics.halstead.N2
old: 7.0
new: 129.0
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.3060986113514963
new: 1.4465665820558746
path: .spaces[2].metrics.halstead.n2
old: 4.0
new: 59.0
path: .spaces[2].metrics.halstead.bugs
old: 0.015396668859824946
new: 0.46946657879634873
path: .spaces[2].metrics.halstead.n1
old: 6.0
new: 24.0
path: .spaces[2].metrics.halstead.length
old: 18.0
new: 316.0
path: .spaces[2].metrics.halstead.effort
old: 313.9222049668557
new: 52855.34387378157
path: .spaces[2].metrics.halstead.time
old: 17.44012249815865
new: 2936.407992987865
path: .spaces[2].metrics.halstead.N1
old: 11.0
new: 187.0
path: .spaces[2].metrics.halstead.vocabulary
old: 10.0
new: 83.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 23.509775004326936
new: 457.1150399296564
path: .spaces[2].metrics.halstead.level
old: 0.1904761904761905
new: 0.03811369509043928
path: .spaces[2].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[2].metrics.nom.total
old: 0.0
new: 2.0
path: .spaces[2].metrics.nom.closures
old: 0.0
new: 1.0
path: .spaces[2].metrics.cyclomatic.sum
old: 1.0
new: 18.0
path: .spaces[2].metrics.cyclomatic.average
old: 1.0
new: 18.0
path: .spaces[2].metrics.nexits.average
old: null
new: 1.5
path: .spaces[2].metrics.nexits.sum
old: 0.0
new: 3.0
path: .spaces[2].metrics.loc.blank
old: 0.0
new: 10.0
path: .spaces[2].metrics.loc.lloc
old: 0.0
new: 26.0
path: .spaces[2].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[2].metrics.loc.ploc
old: 5.0
new: 48.0
path: .spaces[2].metrics.loc.sloc
old: 5.0
new: 59.0
path: .spaces[2].metrics.cognitive.average
old: null
new: 12.5
path: .spaces[2].metrics.cognitive.sum
old: 0.0
new: 25.0
path: .spaces[2].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[2].metrics.nargs.average
old: null
new: 1.0
path: .spaces[2].metrics.mi.mi_original
old: 123.42433677519352
new: 61.241604461135054
path: .spaces[2].metrics.mi.mi_visual_studio
old: 72.17797472233539
new: 35.81380377844155
path: .spaces[2].metrics.mi.mi_sei
old: 102.46464645797268
new: 24.50102438808713

### Code

    nsDragService::IsDataFlavorSupported(const char* aDataFlavor, bool* _retval) {
      NS_OBJC_BEGIN_TRY_BLOCK_RETURN;

      *_retval = false;

      if (!globalDragPboard) return NS_ERROR_FAILURE;

      nsDependentCString dataFlavor(aDataFlavor);

      // first see if we have data for this in our cached transferable
      if (mDataItems) {
        uint32_t dataItemsCount;
        mDataItems->GetLength(&dataItemsCount);
        for (unsigned int i = 0; i < dataItemsCount; i++) {
          nsCOMPtr currentTransferable = do_QueryElementAt(mDataItems, i);
          if (!currentTransferable) continue;

          nsTArray flavors;
          nsresult rv = currentTransferable->FlavorsTransferableCanImport(flavors);
          if (NS_FAILED(rv)) continue;

          for (uint32_t j = 0; j < flavors.Length(); j++) {
            if (dataFlavor.Equals(flavors[j])) {
              *_retval = true;
              return NS_OK;
            }
          }
        }
      }

      const NSString* type = nil;
      bool allowFileURL = false;
      if (dataFlavor.EqualsLiteral(kFileMime)) {
        type = [UTIHelper stringFromPboardType:(NSString*)kUTTypeFileURL];
        allowFileURL = true;
      } else if (dataFlavor.EqualsLiteral(kUnicodeMime)) {
        type = [UTIHelper stringFromPboardType:NSPasteboardTypeString];
      } else if (dataFlavor.EqualsLiteral(kHTMLMime)) {
        type = [UTIHelper stringFromPboardType:NSPasteboardTypeHTML];
      } else if (dataFlavor.EqualsLiteral(kURLMime) || dataFlavor.EqualsLiteral(kURLDataMime)) {
        type = [UTIHelper stringFromPboardType:kPublicUrlPboardType];
      } else if (dataFlavor.EqualsLiteral(kURLDescriptionMime)) {
        type = [UTIHelper stringFromPboardType:kPublicUrlNamePboardType];
      } else if (dataFlavor.EqualsLiteral(kRTFMime)) {
        type = [UTIHelper stringFromPboardType:NSPasteboardTypeRTF];
      } else if (dataFlavor.EqualsLiteral(kCustomTypesMime)) {
        type = [UTIHelper stringFromPboardType:kMozCustomTypesPboardType];
      }

      NSString* availableType =
          [globalDragPboard availableTypeFromArray:[NSArray arrayWithObjects:(id)type, nil]];
      if (availableType && IsValidType(availableType, allowFileURL)) {
        *_retval = true;
      }

      return NS_OK;

      NS_OBJC_END_TRY_BLOCK_RETURN(NS_ERROR_FAILURE);
    }

## Minimal test - lines (327, 491)

path: .spaces[1].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[1].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[1].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[1].metrics.nargs.average
old: null
new: 2.0
path: .spaces[1].metrics.nexits.average
old: null
new: 7.0
path: .spaces[1].metrics.nexits.sum
old: 0.0
new: 7.0
path: .spaces[1].metrics.loc.blank
old: 0.0
new: 20.0
path: .spaces[1].metrics.loc.ploc
old: 5.0
new: 127.0
path: .spaces[1].metrics.loc.cloc
old: 0.0
new: 18.0
path: .spaces[1].metrics.loc.lloc
old: 0.0
new: 77.0
path: .spaces[1].metrics.loc.sloc
old: 5.0
new: 165.0
path: .spaces[1].metrics.mi.mi_visual_studio
old: 72.3204043555347
new: 20.833598713939605
path: .spaces[1].metrics.mi.mi_original
old: 123.66789144796434
new: 35.62545380083672
path: .spaces[1].metrics.mi.mi_sei
old: 102.81602157656452
new: 3.6399021109565233
path: .spaces[1].metrics.halstead.N1
old: 12.0
new: 468.0
path: .spaces[1].metrics.halstead.difficulty
old: 6.0
new: 44.716981132075475
path: .spaces[1].metrics.halstead.N2
old: 6.0
new: 316.0
path: .spaces[1].metrics.halstead.bugs
old: 0.016312752250359278
new: 1.317442394437097
path: .spaces[1].metrics.halstead.effort
old: 342.3519001557697
new: 248473.0746428383
path: .spaces[1].metrics.halstead.n1
old: 6.0
new: 30.0
path: .spaces[1].metrics.halstead.time
old: 19.019550008653873
new: 13804.059702379906
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.1258145836939113
new: 1.097405977107085
path: .spaces[1].metrics.halstead.vocabulary
old: 9.0
new: 136.0
path: .spaces[1].metrics.halstead.estimated_program_length
old: 20.264662506490403
new: 860.3662860519546
path: .spaces[1].metrics.halstead.n2
old: 3.0
new: 106.0
path: .spaces[1].metrics.halstead.length
old: 18.0
new: 784.0
path: .spaces[1].metrics.halstead.volume
old: 57.05865002596162
new: 5556.570867540266
path: .spaces[1].metrics.halstead.level
old: 0.16666666666666666
new: 0.022362869198312235
path: .spaces[1].metrics.cognitive.average
old: null
new: 69.0
path: .spaces[1].metrics.cognitive.sum
old: 0.0
new: 69.0
path: .spaces[1].metrics.cyclomatic.sum
old: 1.0
new: 34.0
path: .spaces[1].metrics.cyclomatic.average
old: 1.0
new: 34.0

### Code

    nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex) {
      NS_OBJC_BEGIN_TRY_BLOCK_RETURN;

      if (!aTransferable) return NS_ERROR_FAILURE;

      // get flavor list that includes all acceptable flavors (including ones obtained through
      // conversion)
      nsTArray flavors;
      nsresult rv = aTransferable->FlavorsTransferableCanImport(flavors);
      if (NS_FAILED(rv)) return NS_ERROR_FAILURE;

      // if this drag originated within Mozilla we should just use the cached data from
      // when the drag started if possible
      if (mDataItems) {
        nsCOMPtr currentTransferable = do_QueryElementAt(mDataItems, aItemIndex);
        if (currentTransferable) {
          for (uint32_t i = 0; i < flavors.Length(); i++) {
            nsCString& flavorStr = flavors[i];

            nsCOMPtr dataSupports;
            rv = currentTransferable->GetTransferData(flavorStr.get(), getter_AddRefs(dataSupports));
            if (NS_SUCCEEDED(rv)) {
              aTransferable->SetTransferData(flavorStr.get(), dataSupports);
              return NS_OK;  // maybe try to fill in more types? Is there a point?
            }
          }
        }
      }

      // now check the actual clipboard for data
      for (uint32_t i = 0; i < flavors.Length(); i++) {
        nsCString& flavorStr = flavors[i];

        MOZ_LOG(sCocoaLog, LogLevel::Info,
                ("nsDragService::GetData: looking for clipboard data of type %s\n", flavorStr.get()));

        NSArray* droppedItems = [globalDragPboard pasteboardItems];
        if (!droppedItems) {
          continue;
        }

        uint32_t itemCount = [droppedItems count];
        if (aItemIndex >= itemCount) {
          continue;
        }

        NSPasteboardItem* item = [droppedItems objectAtIndex:aItemIndex];
        if (!item) {
          continue;
        }

        if (flavorStr.EqualsLiteral(kFileMime)) {
          NSString* filePath = GetFilePath(item);
          if (!filePath) continue;

          unsigned int stringLength = [filePath length];
          unsigned int dataLength = (stringLength + 1) * sizeof(char16_t);  // in bytes
          char16_t* clipboardDataPtr = (char16_t*)malloc(dataLength);
          if (!clipboardDataPtr) return NS_ERROR_OUT_OF_MEMORY;
          [filePath getCharacters:reinterpret_cast(clipboardDataPtr)];
          clipboardDataPtr[stringLength] = 0;  // null terminate

          nsCOMPtr file;
          rv = NS_NewLocalFile(nsDependentString(clipboardDataPtr), true, getter_AddRefs(file));
          free(clipboardDataPtr);
          if (NS_FAILED(rv)) continue;

          aTransferable->SetTransferData(flavorStr.get(), file);

          break;
        } else if (flavorStr.EqualsLiteral(kCustomTypesMime)) {
          NSString* availableType =
              [item availableTypeFromArray:[NSArray arrayWithObject:kMozCustomTypesPboardType]];
          if (!availableType || !IsValidType(availableType, false)) {
            continue;
          }
          NSData* pasteboardData = [item dataForType:availableType];
          if (!pasteboardData) {
            continue;
          }

          unsigned int dataLength = [pasteboardData length];
          void* clipboardDataPtr = malloc(dataLength);
          if (!clipboardDataPtr) {
            return NS_ERROR_OUT_OF_MEMORY;
          }
          [pasteboardData getBytes:clipboardDataPtr length:dataLength];

          nsCOMPtr genericDataWrapper;
          nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, clipboardDataPtr, dataLength,
                                                     getter_AddRefs(genericDataWrapper));

          aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper);
          free(clipboardDataPtr);
          break;
        }

        NSString* pString = nil;
        if (flavorStr.EqualsLiteral(kUnicodeMime)) {
          pString = GetStringForType(item, [UTIHelper stringFromPboardType:NSPasteboardTypeString]);
        } else if (flavorStr.EqualsLiteral(kHTMLMime)) {
          pString = GetStringForType(item, [UTIHelper stringFromPboardType:NSPasteboardTypeHTML]);
        } else if (flavorStr.EqualsLiteral(kURLMime)) {
          pString = GetStringForType(item, [UTIHelper stringFromPboardType:kPublicUrlPboardType]);
          if (pString) {
            NSString* title = GetTitleForURL(item);
            if (!title) {
              title = pString;
            }
            pString = [NSString stringWithFormat:@"%@\n%@", pString, title];
          }
        } else if (flavorStr.EqualsLiteral(kURLDataMime)) {
          pString = GetStringForType(item, [UTIHelper stringFromPboardType:kPublicUrlPboardType]);
        } else if (flavorStr.EqualsLiteral(kURLDescriptionMime)) {
          pString = GetTitleForURL(item);
        } else if (flavorStr.EqualsLiteral(kRTFMime)) {
          pString = GetStringForType(item, [UTIHelper stringFromPboardType:NSPasteboardTypeRTF]);
        }
        if (pString) {
          NSData* stringData;
          if (flavorStr.EqualsLiteral(kRTFMime)) {
            stringData = [pString dataUsingEncoding:NSASCIIStringEncoding];
          } else {
            stringData = [pString dataUsingEncoding:NSUnicodeStringEncoding];
          }
          unsigned int dataLength = [stringData length];
          void* clipboardDataPtr = malloc(dataLength);
          if (!clipboardDataPtr) return NS_ERROR_OUT_OF_MEMORY;
          [stringData getBytes:clipboardDataPtr length:dataLength];

          // The DOM only wants LF, so convert from MacOS line endings to DOM line endings.
          int32_t signedDataLength = dataLength;
          nsLinebreakHelpers::ConvertPlatformToDOMLinebreaks(flavorStr, &clipboardDataPtr,
                                                             &signedDataLength);
          dataLength = signedDataLength;

          // skip BOM (Byte Order Mark to distinguish little or big endian)
          char16_t* clipboardDataPtrNoBOM = (char16_t*)clipboardDataPtr;
          if ((dataLength > 2) &&
              ((clipboardDataPtrNoBOM[0] == 0xFEFF) || (clipboardDataPtrNoBOM[0] == 0xFFFE))) {
            dataLength -= sizeof(char16_t);
            clipboardDataPtrNoBOM += 1;
          }

          nsCOMPtr genericDataWrapper;
          nsPrimitiveHelpers::CreatePrimitiveForData(flavorStr, clipboardDataPtrNoBOM, dataLength,
                                                     getter_AddRefs(genericDataWrapper));
          aTransferable->SetTransferData(flavorStr.get(), genericDataWrapper);
          free(clipboardDataPtr);
          break;
        }

        // We have never supported this on Mac OS X, we should someday. Normally dragging images
        // in is accomplished with a file path drag instead of the image data itself.
        /*
        if (flavorStr.EqualsLiteral(kPNGImageMime) || flavorStr.EqualsLiteral(kJPEGImageMime) ||
            flavorStr.EqualsLiteral(kJPGImageMime) || flavorStr.EqualsLiteral(kGIFImageMime)) {

        }
        */
      }
      return NS_OK;

      NS_OBJC_END_TRY_BLOCK_RETURN(NS_ERROR_FAILURE);
    }

## Minimal test - lines (583, 633)

path: .spaces[5].metrics.cyclomatic.sum
old: 1.0
new: 6.0
path: .spaces[5].metrics.cyclomatic.average
old: 1.0
new: 6.0
path: .spaces[5].metrics.mi.mi_visual_studio
old: 73.3099929416517
new: 39.771167390864626
path: .spaces[5].metrics.mi.mi_original
old: 125.3600879302244
new: 68.00869623837852
path: .spaces[5].metrics.mi.mi_sei
old: 146.77652821395918
new: 48.361575504024586
path: .spaces[5].metrics.nexits.average
old: null
new: 0.0
path: .spaces[5].metrics.nom.total
old: 0.0
new: 1.0
path: .spaces[5].metrics.nom.functions
old: 0.0
new: 1.0
path: .spaces[5].metrics.cognitive.sum
old: 0.0
new: 6.0
path: .spaces[5].metrics.cognitive.average
old: null
new: 6.0
path: .spaces[5].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[5].metrics.nargs.average
old: null
new: 2.0
path: .spaces[5].metrics.halstead.length
old: 13.0
new: 229.0
path: .spaces[5].metrics.halstead.N2
old: 5.0
new: 102.0
path: .spaces[5].metrics.halstead.estimated_program_length
old: 20.264662506490403
new: 481.4866257866323
path: .spaces[5].metrics.halstead.n1
old: 6.0
new: 18.0
path: .spaces[5].metrics.halstead.purity_ratio
old: 1.558820192806954
new: 2.102561684657783
path: .spaces[5].metrics.halstead.time
old: 11.446951394097235
new: 1117.2429364649586
path: .spaces[5].metrics.halstead.n2
old: 3.0
new: 67.0
path: .spaces[5].metrics.halstead.level
old: 0.2
new: 0.07298474945533769
path: .spaces[5].metrics.halstead.bugs
old: 0.011628409247737769
new: 0.2465048643495592
path: .spaces[5].metrics.halstead.effort
old: 206.04512509375027
new: 20110.372856369253
path: .spaces[5].metrics.halstead.volume
old: 41.209025018750054
new: 1467.7505243755336
path: .spaces[5].metrics.halstead.vocabulary
old: 9.0
new: 85.0
path: .spaces[5].metrics.halstead.difficulty
old: 5.0
new: 13.701492537313433
path: .spaces[5].metrics.halstead.N1
old: 8.0
new: 127.0
path: .spaces[5].metrics.loc.lloc
old: 0.0
new: 9.0
path: .spaces[5].metrics.loc.cloc
old: 2.0
new: 6.0
path: .spaces[5].metrics.loc.sloc
old: 5.0
new: 51.0
path: .spaces[5].metrics.loc.ploc
old: 5.0
new: 37.0
path: .spaces[5].metrics.loc.blank
old: 0.0
new: 8.0

### Code

    void nsDragService::DragMovedWithView(NSDraggingSession* aSession, NSPoint aPoint) {
      aPoint.y = nsCocoaUtils::FlippedScreenY(aPoint.y);

      // XXX It feels like we should be using the backing scale factor at aPoint
      // rather than the initial drag view, but I've seen no ill effects of this.
      CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mNativeDragView);
      LayoutDeviceIntPoint devPoint = nsCocoaUtils::CocoaPointsToDevPixels(aPoint, scaleFactor);

      // If the image has changed, call enumerateDraggingItemsWithOptions to get
      // the item being dragged and update its image.
      if (mDragImageChanged && mNativeDragView) {
        mDragImageChanged = false;

        nsPresContext* pc = nullptr;
        nsCOMPtr content = do_QueryInterface(mImage);
        if (content) {
          pc = content->OwnerDoc()->GetPresContext();
        }

        if (pc) {
          void (^changeImageBlock)(NSDraggingItem*, NSInteger, BOOL*) =
              ^(NSDraggingItem* draggingItem, NSInteger idx, BOOL* stop) {
                // We never add more than one item right now, but check just in case.
                if (idx > 0) {
                  return;
                }

                nsPoint pt = LayoutDevicePixel::ToAppUnits(
                    devPoint, pc->DeviceContext()->AppUnitsPerDevPixelAtUnitFullZoom());
                CSSIntPoint screenPoint = CSSIntPoint(nsPresContext::AppUnitsToIntCSSPixels(pt.x),
                                                      nsPresContext::AppUnitsToIntCSSPixels(pt.y));

                // Create a new image; if one isn't returned don't change the current one.
                LayoutDeviceIntRect newRect;
                NSImage* image = ConstructDragImage(mSourceNode, Nothing(), screenPoint, &newRect);
                if (image) {
                  NSRect draggingRect = nsCocoaUtils::GeckoRectToCocoaRectDevPix(newRect, scaleFactor);
                  [draggingItem setDraggingFrame:draggingRect contents:image];
                }
              };

          [aSession enumerateDraggingItemsWithOptions:NSDraggingItemEnumerationConcurrent
                                              forView:nil
                                              classes:[NSArray arrayWithObject:[NSPasteboardItem class]]
                                        searchOptions:@{}
                                           usingBlock:changeImageBlock];
        }
      }

      DragMoved(devPoint.x, devPoint.y);
    }