Global Metrics
path: .metrics.halstead.N1
old: 58.0
new: 224.0
path: .metrics.halstead.time
old: 310.51738035815714
new: 2467.9798266925213
path: .metrics.halstead.effort
old: 5589.312846446828
new: 44423.63688046538
path: .metrics.halstead.level
old: 0.08888888888888889
new: 0.05704584040747029
path: .metrics.halstead.volume
old: 496.82780857305136
new: 2534.1836998024396
path: .metrics.halstead.estimated_program_length
old: 168.64245895143551
new: 617.665286268844
path: .metrics.halstead.purity_ratio
old: 1.794068712249314
new: 1.629723710471884
path: .metrics.halstead.bugs
old: 0.10498268866694442
new: 0.4181076870879481
path: .metrics.halstead.difficulty
old: 11.25
new: 17.529761904761905
path: .metrics.halstead.length
old: 94.0
new: 379.0
path: .metrics.halstead.vocabulary
old: 39.0
new: 103.0
path: .metrics.halstead.N2
old: 36.0
new: 155.0
path: .metrics.halstead.n2
old: 24.0
new: 84.0
path: .metrics.halstead.n1
old: 15.0
new: 19.0
path: .metrics.nom.functions
old: 2.0
new: 1.0
path: .metrics.nom.total
old: 2.0
new: 1.0
path: .metrics.loc.ploc
old: 22.0
new: 75.0
path: .metrics.loc.sloc
old: 46.0
new: 95.0
path: .metrics.loc.blank
old: 9.0
new: 14.0
path: .metrics.loc.cloc
old: 15.0
new: 6.0
path: .metrics.loc.lloc
old: 9.0
new: 26.0
path: .metrics.nargs.average
old: 1.0
new: 3.0
path: .metrics.nargs.sum
old: 2.0
new: 3.0
path: .metrics.cyclomatic.sum
old: 6.0
new: 11.0
path: .metrics.cyclomatic.average
old: 1.5
new: 5.5
path: .metrics.cognitive.sum
old: 2.0
new: 18.0
path: .metrics.cognitive.average
old: 1.0
new: 18.0
path: .metrics.mi.mi_original
old: 75.31314315378192
new: 53.941534724339704
path: .metrics.mi.mi_visual_studio
old: 44.04277377414147
new: 31.54475714873667
path: .metrics.mi.mi_sei
old: 72.24868474889504
new: 22.218848401521605
path: .metrics.nexits.average
old: 2.0
new: 4.0
Spaces Data
Minimal test - lines (31, 95)
path: .spaces[0].metrics.nargs.average
old: 1.0
new: 3.0
path: .spaces[0].metrics.nargs.sum
old: 2.0
new: 3.0
path: .spaces[0].metrics.nexits.average
old: 2.0
new: 4.0
path: .spaces[0].metrics.cognitive.sum
old: 2.0
new: 18.0
path: .spaces[0].metrics.cognitive.average
old: 1.0
new: 18.0
path: .spaces[0].metrics.halstead.effort
old: 5555.1716344388715
new: 34083.936251787556
path: .spaces[0].metrics.halstead.time
old: 308.6206463577151
new: 1893.5520139881976
path: .spaces[0].metrics.halstead.difficulty
old: 11.590909090909092
new: 16.175675675675677
path: .spaces[0].metrics.halstead.estimated_program_length
old: 156.71085454414833
new: 534.558199082504
path: .spaces[0].metrics.halstead.length
old: 92.0
new: 323.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.7033788537407428
new: 1.654978944527876
path: .spaces[0].metrics.halstead.n1
old: 15.0
new: 18.0
path: .spaces[0].metrics.halstead.bugs
old: 0.10455474159436792
new: 0.3504116809010894
path: .spaces[0].metrics.halstead.n2
old: 22.0
new: 74.0
path: .spaces[0].metrics.halstead.level
old: 0.08627450980392157
new: 0.061821219715956555
path: .spaces[0].metrics.halstead.vocabulary
old: 37.0
new: 92.0
path: .spaces[0].metrics.halstead.volume
old: 479.2697096378634
new: 2107.110511806415
path: .spaces[0].metrics.halstead.N1
old: 58.0
new: 190.0
path: .spaces[0].metrics.halstead.N2
old: 34.0
new: 133.0
path: .spaces[0].metrics.mi.mi_sei
old: 73.61031965770286
new: 23.27285408942249
path: .spaces[0].metrics.mi.mi_visual_studio
old: 48.33615916972567
new: 35.83564172158431
path: .spaces[0].metrics.mi.mi_original
old: 82.6548321802309
new: 61.27894734390917
path: .spaces[0].metrics.loc.lloc
old: 9.0
new: 24.0
path: .spaces[0].metrics.loc.blank
old: 6.0
new: 9.0
path: .spaces[0].metrics.loc.sloc
old: 30.0
new: 65.0
path: .spaces[0].metrics.loc.ploc
old: 19.0
new: 55.0
path: .spaces[0].metrics.loc.cloc
old: 5.0
new: 1.0
path: .spaces[0].metrics.nom.functions
old: 2.0
new: 1.0
path: .spaces[0].metrics.nom.total
old: 2.0
new: 1.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.6666666666666667
new: 10.0
path: .spaces[0].metrics.cyclomatic.sum
old: 5.0
new: 10.0
Code
nsresult nsDragServiceProxy::InvokeDragSessionImpl(
nsIArray* aArrayTransferables, const Maybe& aRegion,
uint32_t aActionType) {
NS_ENSURE_STATE(mSourceDocument->GetDocShell());
BrowserChild* child = BrowserChild::GetFrom(mSourceDocument->GetDocShell());
NS_ENSURE_STATE(child);
nsTArray dataTransfers;
nsContentUtils::TransferablesToIPCTransferables(
aArrayTransferables, dataTransfers, false, child->Manager(), nullptr);
nsCOMPtr principal;
if (mSourceNode) {
principal = mSourceNode->NodePrincipal();
}
nsCOMPtr csp;
if (mSourceDocument) {
csp = mSourceDocument->GetCsp();
}
nsCOMPtr cookieJarSettings;
cookieJarSettings = mSourceDocument->CookieJarSettings();
net::CookieJarSettingsArgs csArgs;
net::CookieJarSettings::Cast(cookieJarSettings)->Serialize(csArgs);
LayoutDeviceIntRect dragRect;
if (mHasImage || mSelection) {
nsPresContext* pc;
RefPtr surface;
DrawDrag(mSourceNode, aRegion, mScreenPosition, &dragRect, &surface, &pc);
if (surface) {
RefPtr dataSurface = surface->GetDataSurface();
if (dataSurface) {
size_t length;
int32_t stride;
Maybe maybeShm = nsContentUtils::GetSurfaceData(
dataSurface, &length, &stride, child);
if (maybeShm.isNothing()) {
return NS_ERROR_FAILURE;
}
auto surfaceData = maybeShm.value();
// Save the surface data to shared memory.
if (!surfaceData.IsReadable() || !surfaceData.get()) {
NS_WARNING("Failed to create shared memory for drag session.");
return NS_ERROR_FAILURE;
}
mozilla::Unused << child->SendInvokeDragSession(
dataTransfers, aActionType, Some(std::move(surfaceData)), stride,
dataSurface->GetFormat(), dragRect, principal, csp, csArgs);
StartDragSession();
return NS_OK;
}
}
}
mozilla::Unused << child->SendInvokeDragSession(
dataTransfers, aActionType, Nothing(), 0, static_cast(0),
dragRect, principal, csp, csArgs);
StartDragSession();
return NS_OK;
}