Global Metrics
path: .metrics.nom.closures
old: 2.0
new: 0.0
path: .metrics.nom.functions
old: 50.0
new: 31.0
path: .metrics.nom.total
old: 52.0
new: 31.0
path: .metrics.nexits.average
old: 1.6538461538461535
new: 1.7741935483870968
path: .metrics.nexits.sum
old: 86.0
new: 55.0
path: .metrics.mi.mi_original
old: -20.120963613963298
new: -2.4264969088252997
path: .metrics.mi.mi_sei
old: -68.70037538717307
new: -49.134172818558405
path: .metrics.cognitive.sum
old: 57.0
new: 55.0
path: .metrics.cognitive.average
old: 1.0961538461538465
new: 1.7741935483870968
path: .metrics.halstead.n1
old: 40.0
new: 31.0
path: .metrics.halstead.difficulty
old: 54.64362850971922
new: 48.51672862453532
path: .metrics.halstead.length
old: 3189.0
new: 1979.0
path: .metrics.halstead.level
old: 0.018300395256916995
new: 0.020611447398666768
path: .metrics.halstead.n2
old: 463.0
new: 269.0
path: .metrics.halstead.bugs
old: 4.491025600240121
new: 2.8487998872027336
path: .metrics.halstead.N1
old: 1924.0
new: 1137.0
path: .metrics.halstead.volume
old: 28619.408126889823
new: 16284.83218849135
path: .metrics.halstead.estimated_program_length
old: 4312.681185244984
new: 2324.8034611497246
path: .metrics.halstead.N2
old: 1265.0
new: 842.0
path: .metrics.halstead.effort
old: 1563868.305853807
new: 790086.7839851324
path: .metrics.halstead.vocabulary
old: 503.0
new: 300.0
path: .metrics.halstead.time
old: 86881.57254743371
new: 43893.71022139624
path: .metrics.halstead.purity_ratio
old: 1.352361613435241
new: 1.1747364634409927
path: .metrics.cyclomatic.sum
old: 131.0
new: 79.0
path: .metrics.cyclomatic.average
old: 2.519230769230769
new: 2.393939393939394
path: .metrics.nargs.sum
old: 60.0
new: 75.0
path: .metrics.nargs.average
old: 1.1538461538461535
new: 2.4193548387096775
path: .metrics.loc.blank
old: 110.0
new: 129.0
path: .metrics.loc.cloc
old: 71.0
new: 56.0
path: .metrics.loc.ploc
old: 587.0
new: 461.0
path: .metrics.loc.sloc
old: 768.0
new: 646.0
path: .metrics.loc.lloc
old: 254.0
new: 182.0
Spaces Data
Minimal test - lines (208, 212)
path: .spaces[7].metrics.nargs.average
old: 1.0
new: 3.0
path: .spaces[7].metrics.nargs.sum
old: 1.0
new: 3.0
path: .spaces[7].metrics.halstead.effort
old: 365.5060725175299
new: 343.3468786650285
path: .spaces[7].metrics.halstead.vocabulary
old: 14.0
new: 17.0
path: .spaces[7].metrics.halstead.N1
old: 10.0
new: 12.0
path: .spaces[7].metrics.halstead.difficulty
old: 5.333333333333333
new: 4.0
path: .spaces[7].metrics.halstead.length
old: 18.0
new: 21.0
path: .spaces[7].metrics.halstead.level
old: 0.1875
new: 0.25
path: .spaces[7].metrics.halstead.estimated_program_length
old: 39.50977500432694
new: 52.529325012980806
path: .spaces[7].metrics.halstead.n2
old: 6.0
new: 9.0
path: .spaces[7].metrics.halstead.volume
old: 68.53238859703687
new: 85.83671966625712
path: .spaces[7].metrics.halstead.time
old: 20.305892917640552
new: 19.074826592501584
path: .spaces[7].metrics.halstead.N2
old: 8.0
new: 9.0
path: .spaces[7].metrics.halstead.purity_ratio
old: 2.194987500240386
new: 2.5013964291895623
path: .spaces[7].metrics.halstead.bugs
old: 0.017040217866005423
new: 0.016344343499188157
path: .spaces[7].metrics.mi.mi_visual_studio
old: 76.60262417125709
new: 71.07858598043994
path: .spaces[7].metrics.mi.mi_original
old: 130.99048733284965
new: 121.54438202655228
path: .spaces[7].metrics.mi.mi_sei
old: 113.38029434612244
new: 99.75244506501232
path: .spaces[7].metrics.loc.sloc
old: 3.0
new: 5.0
path: .spaces[7].metrics.loc.ploc
old: 3.0
new: 5.0
path: .spaces[7].metrics.loc.lloc
old: 1.0
new: 2.0
Code
nsOfflineCachePendingUpdate::OnContentBlockingEvent(
nsIWebProgress* aWebProgress, nsIRequest* aRequest, uint32_t aEvent) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}
Minimal test - lines (511, 566)
path: .spaces[25].metrics.loc.ploc
old: 4.0
new: 41.0
path: .spaces[25].metrics.loc.sloc
old: 4.0
new: 56.0
path: .spaces[25].metrics.loc.cloc
old: 0.0
new: 2.0
path: .spaces[25].metrics.loc.blank
old: 0.0
new: 13.0
path: .spaces[25].metrics.loc.lloc
old: 1.0
new: 24.0
path: .spaces[25].metrics.mi.mi_sei
old: 105.12994940155043
new: 35.33981285333145
path: .spaces[25].metrics.mi.mi_original
old: 125.27178399587255
new: 66.11830620544939
path: .spaces[25].metrics.mi.mi_visual_studio
old: 73.25835321396058
new: 38.66567614353765
path: .spaces[25].metrics.cyclomatic.average
old: 1.0
new: 12.0
path: .spaces[25].metrics.cyclomatic.sum
old: 1.0
new: 12.0
path: .spaces[25].metrics.cognitive.average
old: 0.0
new: 10.0
path: .spaces[25].metrics.cognitive.sum
old: 0.0
new: 10.0
path: .spaces[25].metrics.nexits.average
old: 1.0
new: 9.0
path: .spaces[25].metrics.nexits.sum
old: 1.0
new: 9.0
path: .spaces[25].metrics.halstead.time
old: 35.0
new: 1201.0684495443827
path: .spaces[25].metrics.halstead.N2
old: 9.0
new: 79.0
path: .spaces[25].metrics.halstead.difficulty
old: 7.5
new: 17.86904761904762
path: .spaces[25].metrics.halstead.N1
old: 12.0
new: 125.0
path: .spaces[25].metrics.halstead.bugs
old: 0.024496598167132053
new: 0.2586856003575021
path: .spaces[25].metrics.halstead.purity_ratio
old: 2.3204312358666934
new: 1.5058233064320394
path: .spaces[25].metrics.halstead.level
old: 0.13333333333333333
new: 0.05596269153897401
path: .spaces[25].metrics.halstead.vocabulary
old: 16.0
new: 61.0
path: .spaces[25].metrics.halstead.n1
old: 10.0
new: 19.0
path: .spaces[25].metrics.halstead.estimated_program_length
old: 48.72905595320056
new: 307.18795451213606
path: .spaces[25].metrics.halstead.length
old: 21.0
new: 204.0
path: .spaces[25].metrics.halstead.volume
old: 84.0
new: 1209.870416862829
path: .spaces[25].metrics.halstead.effort
old: 630.0
new: 21619.232091798887
path: .spaces[25].metrics.halstead.n2
old: 6.0
new: 42.0
path: .spaces[25].metrics.nargs.sum
old: 0.0
new: 3.0
path: .spaces[25].metrics.nargs.average
old: 0.0
new: 3.0
Code
static nsresult OfflineAppPermForPrincipal(nsIPrincipal* aPrincipal,
bool pinned, bool* aAllowed) {
*aAllowed = false;
if (!StaticPrefs::browser_cache_offline_enable()) {
return NS_OK;
}
if (!StaticPrefs::browser_cache_offline_storage_enable()) {
return NS_OK;
}
if (!aPrincipal) return NS_ERROR_INVALID_ARG;
nsCOMPtr uri;
// Casting to BasePrincipal, as we can't get InnerMost URI otherwise
auto* basePrincipal = BasePrincipal::Cast(aPrincipal);
basePrincipal->GetURI(getter_AddRefs(uri));
if (!uri) return NS_OK;
nsCOMPtr innerURI = NS_GetInnermostURI(uri);
if (!innerURI) return NS_OK;
// only https applications can use offline APIs.
if (!innerURI->SchemeIs("https")) {
return NS_OK;
}
nsAutoCString domain;
nsresult rv = innerURI->GetAsciiHost(domain);
NS_ENSURE_SUCCESS(rv, rv);
if (nsOfflineCacheUpdateService::AllowedDomains()->Contains(domain)) {
*aAllowed = true;
return NS_OK;
}
nsCOMPtr permissionManager =
components::PermissionManager::Service();
if (!permissionManager) {
return NS_OK;
}
uint32_t perm;
const nsLiteralCString permName = pinned ? "pin-app"_ns : "offline-app"_ns;
permissionManager->TestExactPermissionFromPrincipal(aPrincipal, permName,
&perm);
if (perm == nsIPermissionManager::ALLOW_ACTION ||
perm == nsIOfflineCacheUpdateService::ALLOW_NO_WARN) {
*aAllowed = true;
}
return NS_OK;
}
Minimal test - lines (126, 179)
path: .spaces[3].metrics.cognitive.average
old: 0.75
new: 9.0
path: .spaces[3].metrics.cognitive.sum
old: 3.0
new: 9.0
path: .spaces[3].metrics.cyclomatic.average
old: 1.4
new: 9.0
path: .spaces[3].metrics.cyclomatic.sum
old: 7.0
new: 9.0
path: .spaces[3].metrics.mi.mi_visual_studio
old: 45.79053785724141
new: 39.45877221467855
path: .spaces[3].metrics.mi.mi_original
old: 78.3018197358828
new: 67.47450048710031
path: .spaces[3].metrics.mi.mi_sei
old: 62.98291018427097
new: 40.41504838432542
path: .spaces[3].metrics.nargs.average
old: 0.25
new: 4.0
path: .spaces[3].metrics.nargs.sum
old: 1.0
new: 4.0
path: .spaces[3].metrics.nom.functions
old: 4.0
new: 1.0
path: .spaces[3].metrics.nom.total
old: 4.0
new: 1.0
path: .spaces[3].metrics.halstead.volume
old: 626.8335845403158
new: 1192.0782048501403
path: .spaces[3].metrics.halstead.bugs
old: 0.1427259405467272
new: 0.2473173734502071
path: .spaces[3].metrics.halstead.effort
old: 8860.051627637156
new: 20209.88398455238
path: .spaces[3].metrics.halstead.N2
old: 49.0
new: 81.0
path: .spaces[3].metrics.halstead.n2
old: 26.0
new: 43.0
path: .spaces[3].metrics.halstead.time
old: 492.22509042428646
new: 1122.771332475132
path: .spaces[3].metrics.halstead.purity_ratio
old: 1.5454255692803094
new: 1.5342688282495114
path: .spaces[3].metrics.halstead.difficulty
old: 14.134615384615383
new: 16.953488372093023
path: .spaces[3].metrics.halstead.level
old: 0.07074829931972788
new: 0.05898491083676269
path: .spaces[3].metrics.halstead.estimated_program_length
old: 180.8147916057962
new: 308.3880344781518
path: .spaces[3].metrics.halstead.N1
old: 68.0
new: 120.0
path: .spaces[3].metrics.halstead.vocabulary
old: 41.0
new: 61.0
path: .spaces[3].metrics.halstead.length
old: 117.0
new: 201.0
path: .spaces[3].metrics.halstead.n1
old: 15.0
new: 18.0
path: .spaces[3].metrics.nexits.average
old: 0.5
new: 7.0
path: .spaces[3].metrics.nexits.sum
old: 2.0
new: 7.0
path: .spaces[3].metrics.loc.ploc
old: 30.0
new: 43.0
path: .spaces[3].metrics.loc.blank
old: 1.0
new: 8.0
path: .spaces[3].metrics.loc.cloc
old: 4.0
new: 3.0
path: .spaces[3].metrics.loc.sloc
old: 35.0
new: 54.0
path: .spaces[3].metrics.loc.lloc
old: 12.0
new: 25.0
Code
nsOfflineCachePendingUpdate::OnStateChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
uint32_t progressStateFlags,
nsresult aStatus) {
if (mDidReleaseThis) {
return NS_OK;
}
nsCOMPtr updateDoc = do_QueryReferent(mDocument);
if (!updateDoc) {
// The document that scheduled this update has gone away,
// we don't need to listen anymore.
aWebProgress->RemoveProgressListener(this);
MOZ_ASSERT(!mDidReleaseThis);
mDidReleaseThis = true;
NS_RELEASE_THIS();
return NS_OK;
}
if (!(progressStateFlags & STATE_STOP)) {
return NS_OK;
}
nsCOMPtr windowProxy;
aWebProgress->GetDOMWindow(getter_AddRefs(windowProxy));
if (!windowProxy) return NS_OK;
auto* outerWindow = nsPIDOMWindowOuter::From(windowProxy);
nsPIDOMWindowInner* innerWindow = outerWindow->GetCurrentInnerWindow();
nsCOMPtr progressDoc = outerWindow->GetDoc();
if (!progressDoc || progressDoc != updateDoc) {
return NS_OK;
}
LOG(("nsOfflineCachePendingUpdate::OnStateChange [%p, doc=%p]", this,
progressDoc.get()));
// Only schedule the update if the document loaded successfully
if (NS_SUCCEEDED(aStatus)) {
nsCOMPtr update;
mService->Schedule(mManifestURI, mDocumentURI, mLoadingPrincipal, updateDoc,
innerWindow, nullptr, getter_AddRefs(update));
if (mDidReleaseThis) {
return NS_OK;
}
}
aWebProgress->RemoveProgressListener(this);
MOZ_ASSERT(!mDidReleaseThis);
mDidReleaseThis = true;
NS_RELEASE_THIS();
return NS_OK;
}
Minimal test - lines (291, 316)
path: .spaces[14].metrics.halstead.difficulty
old: 7.857142857142857
new: 11.2
path: .spaces[14].metrics.halstead.purity_ratio
old: 2.404384677475562
new: 1.946695988126816
path: .spaces[14].metrics.halstead.volume
old: 100.07820003461548
new: 562.3214567196417
path: .spaces[14].metrics.halstead.N2
old: 10.0
new: 48.0
path: .spaces[14].metrics.halstead.n1
old: 11.0
new: 14.0
path: .spaces[14].metrics.halstead.n2
old: 7.0
new: 30.0
path: .spaces[14].metrics.halstead.bugs
old: 0.028397591141375755
new: 0.11367907487840216
path: .spaces[14].metrics.halstead.vocabulary
old: 18.0
new: 44.0
path: .spaces[14].metrics.halstead.N1
old: 14.0
new: 55.0
path: .spaces[14].metrics.halstead.time
old: 43.68492858653851
new: 349.8889064033326
path: .spaces[14].metrics.halstead.length
old: 24.0
new: 103.0
path: .spaces[14].metrics.halstead.estimated_program_length
old: 57.70523225941349
new: 200.50968677706203
path: .spaces[14].metrics.halstead.effort
old: 786.3287145576932
new: 6298.000315259987
path: .spaces[14].metrics.halstead.level
old: 0.1272727272727273
new: 0.08928571428571429
path: .spaces[14].metrics.nargs.average
old: 0.0
new: 4.0
path: .spaces[14].metrics.nargs.sum
old: 0.0
new: 4.0
path: .spaces[14].metrics.mi.mi_visual_studio
old: 72.72577869593864
new: 49.743890632914145
path: .spaces[14].metrics.mi.mi_sei
old: 103.81608352809806
new: 67.94806203418798
path: .spaces[14].metrics.mi.mi_original
old: 124.36108157005508
new: 85.06205298228318
path: .spaces[14].metrics.loc.lloc
old: 1.0
new: 6.0
path: .spaces[14].metrics.loc.sloc
old: 4.0
new: 26.0
path: .spaces[14].metrics.loc.cloc
old: 0.0
new: 2.0
path: .spaces[14].metrics.loc.ploc
old: 4.0
new: 19.0
path: .spaces[14].metrics.loc.blank
old: 0.0
new: 5.0
Code
nsOfflineCacheUpdateService::ScheduleOnDocumentStop(
nsIURI* aManifestURI, nsIURI* aDocumentURI, nsIPrincipal* aLoadingPrincipal,
Document* aDocument) {
LOG(
("nsOfflineCacheUpdateService::ScheduleOnDocumentStop [%p, "
"manifestURI=%p, documentURI=%p doc=%p]",
this, aManifestURI, aDocumentURI, aDocument));
nsCOMPtr progress =
do_QueryInterface(aDocument->GetContainer());
NS_ENSURE_TRUE(progress, NS_ERROR_INVALID_ARG);
// Proceed with cache update
RefPtr update = new nsOfflineCachePendingUpdate(
this, aManifestURI, aDocumentURI, aLoadingPrincipal, aDocument);
NS_ENSURE_TRUE(update, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = progress->AddProgressListener(
update, nsIWebProgress::NOTIFY_STATE_DOCUMENT);
NS_ENSURE_SUCCESS(rv, rv);
// The update will release when it has scheduled itself.
Unused << update.forget();
return NS_OK;
}
Minimal test - lines (464, 469)
path: .spaces[22].metrics.mi.mi_visual_studio
old: 72.72577869593864
new: 67.19969561818925
path: .spaces[22].metrics.mi.mi_original
old: 124.36108157005508
new: 114.91147950710362
path: .spaces[22].metrics.mi.mi_sei
old: 103.81608352809806
new: 90.18318949350387
path: .spaces[22].metrics.halstead.difficulty
old: 7.857142857142857
new: 5.541666666666667
path: .spaces[22].metrics.halstead.bugs
old: 0.028397591141375755
new: 0.03255464627332205
path: .spaces[22].metrics.halstead.time
old: 43.68492858653851
new: 53.62025169168489
path: .spaces[22].metrics.halstead.n1
old: 11.0
new: 7.0
path: .spaces[22].metrics.halstead.vocabulary
old: 18.0
new: 19.0
path: .spaces[22].metrics.halstead.length
old: 24.0
new: 41.0
path: .spaces[22].metrics.halstead.purity_ratio
old: 2.404384677475562
new: 1.5285618161721244
path: .spaces[22].metrics.halstead.level
old: 0.1272727272727273
new: 0.1804511278195489
path: .spaces[22].metrics.halstead.effort
old: 786.3287145576932
new: 965.164530450328
path: .spaces[22].metrics.halstead.N2
old: 10.0
new: 19.0
path: .spaces[22].metrics.halstead.N1
old: 14.0
new: 22.0
path: .spaces[22].metrics.halstead.volume
old: 100.07820003461548
new: 174.165028051187
path: .spaces[22].metrics.halstead.n2
old: 7.0
new: 12.0
path: .spaces[22].metrics.halstead.estimated_program_length
old: 57.70523225941349
new: 62.6710344630571
path: .spaces[22].metrics.loc.sloc
old: 4.0
new: 6.0
path: .spaces[22].metrics.loc.ploc
old: 4.0
new: 6.0
path: .spaces[22].metrics.nargs.sum
old: 0.0
new: 5.0
path: .spaces[22].metrics.nargs.average
old: 0.0
new: 5.0
Code
nsOfflineCacheUpdateService::ScheduleAppUpdate(
nsIURI* aManifestURI, nsIURI* aDocumentURI, nsIPrincipal* aLoadingPrincipal,
nsIFile* aProfileDir, nsIOfflineCacheUpdate** aUpdate) {
return Schedule(aManifestURI, aDocumentURI, aLoadingPrincipal, nullptr,
nullptr, aProfileDir, aUpdate);
}
Minimal test - lines (267, 276)
path: .spaces[12].metrics.loc.sloc
old: 3.0
new: 10.0
path: .spaces[12].metrics.loc.ploc
old: 3.0
new: 8.0
path: .spaces[12].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[12].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[12].metrics.loc.lloc
old: 1.0
new: 3.0
path: .spaces[12].metrics.mi.mi_original
old: 132.43687749961728
new: 108.1169347486444
path: .spaces[12].metrics.mi.mi_sei
old: 115.46699426690871
new: 104.00934544372608
path: .spaces[12].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 63.2262776307862
path: .spaces[12].metrics.halstead.effort
old: 272.43023996768716
new: 940.0193606380012
path: .spaces[12].metrics.halstead.n1
old: 7.0
new: 12.0
path: .spaces[12].metrics.halstead.n2
old: 4.0
new: 8.0
path: .spaces[12].metrics.halstead.difficulty
old: 5.25
new: 7.5
path: .spaces[12].metrics.halstead.N1
old: 9.0
new: 19.0
path: .spaces[12].metrics.halstead.level
old: 0.1904761904761905
new: 0.13333333333333333
path: .spaces[12].metrics.halstead.time
old: 15.135013331538175
new: 52.223297813222295
path: .spaces[12].metrics.halstead.bugs
old: 0.01400819850161732
new: 0.03198673734700207
path: .spaces[12].metrics.halstead.N2
old: 6.0
new: 10.0
path: .spaces[12].metrics.halstead.estimated_program_length
old: 27.651484454403228
new: 67.01955000865388
path: .spaces[12].metrics.halstead.length
old: 15.0
new: 29.0
path: .spaces[12].metrics.halstead.purity_ratio
old: 1.8434322969602153
new: 2.3110189658156512
path: .spaces[12].metrics.halstead.volume
old: 51.89147427955946
new: 125.33591475173353
path: .spaces[12].metrics.halstead.vocabulary
old: 11.0
new: 20.0
path: .spaces[12].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[12].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[12].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[12].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[12].metrics.nargs.average
old: 1.0
new: 0.0
path: .spaces[12].metrics.nargs.sum
old: 1.0
new: 0.0
Code
nsOfflineCacheUpdateService* nsOfflineCacheUpdateService::EnsureService() {
if (!gOfflineCacheUpdateService) {
// Make the service manager hold a long-lived reference to the service
nsCOMPtr service =
components::OfflineCacheUpdate::Service();
Unused << service;
}
return gOfflineCacheUpdateService;
}
Minimal test - lines (230, 236)
path: .spaces[9].metrics.nargs.average
old: 2.0
new: 0.0
path: .spaces[9].metrics.nargs.sum
old: 2.0
new: 0.0
path: .spaces[9].metrics.mi.mi_sei
old: 102.7934374179506
new: 92.63477674940373
path: .spaces[9].metrics.mi.mi_original
old: 123.65223730209578
new: 116.6107903014273
path: .spaces[9].metrics.mi.mi_visual_studio
old: 72.31124988426654
new: 68.19344462071771
path: .spaces[9].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[9].metrics.nexits.average
old: 1.0
new: 0.0
path: .spaces[9].metrics.halstead.N1
old: 15.0
new: 13.0
path: .spaces[9].metrics.halstead.N2
old: 12.0
new: 8.0
path: .spaces[9].metrics.halstead.time
old: 42.47927513443585
new: 27.62994989545349
path: .spaces[9].metrics.halstead.purity_ratio
old: 2.2869854059946086
new: 1.6956971654493718
path: .spaces[9].metrics.halstead.estimated_program_length
old: 61.74860596185444
new: 35.60964047443681
path: .spaces[9].metrics.halstead.effort
old: 764.6269524198453
new: 497.3390981181628
path: .spaces[9].metrics.halstead.n1
old: 10.0
new: 8.0
path: .spaces[9].metrics.halstead.volume
old: 114.6940428629768
new: 77.70923408096293
path: .spaces[9].metrics.halstead.vocabulary
old: 19.0
new: 13.0
path: .spaces[9].metrics.halstead.bugs
old: 0.027872664048771673
new: 0.02092411734427081
path: .spaces[9].metrics.halstead.level
old: 0.15
new: 0.15625
path: .spaces[9].metrics.halstead.n2
old: 9.0
new: 5.0
path: .spaces[9].metrics.halstead.difficulty
old: 6.666666666666667
new: 6.4
path: .spaces[9].metrics.halstead.length
old: 27.0
new: 21.0
path: .spaces[9].metrics.loc.lloc
old: 1.0
new: 4.0
path: .spaces[9].metrics.loc.ploc
old: 4.0
new: 6.0
path: .spaces[9].metrics.loc.sloc
old: 4.0
new: 7.0
path: .spaces[9].metrics.loc.blank
old: 0.0
new: 1.0
Code
nsOfflineCacheUpdateService::~nsOfflineCacheUpdateService() {
MOZ_ASSERT(gOfflineCacheUpdateService == this);
gOfflineCacheUpdateService = nullptr;
delete mAllowedDomains;
mAllowedDomains = nullptr;
}
Minimal test - lines (592, 646)
path: .spaces[29].metrics.halstead.effort
old: 666.0791492653966
new: 14320.720051344426
path: .spaces[29].metrics.halstead.bugs
old: 0.025423146759899307
new: 0.1965721473697822
path: .spaces[29].metrics.halstead.volume
old: 92.5109929535273
new: 1124.7323510644935
path: .spaces[29].metrics.halstead.purity_ratio
old: 1.4243856189774724
new: 1.520483038470406
path: .spaces[29].metrics.halstead.level
old: 0.1388888888888889
new: 0.07853881278538813
path: .spaces[29].metrics.halstead.n2
old: 5.0
new: 43.0
path: .spaces[29].metrics.halstead.difficulty
old: 7.2
new: 12.732558139534884
path: .spaces[29].metrics.halstead.time
old: 37.00439718141092
new: 795.5955584080236
path: .spaces[29].metrics.halstead.N1
old: 16.0
new: 119.0
path: .spaces[29].metrics.halstead.N2
old: 9.0
new: 73.0
path: .spaces[29].metrics.halstead.estimated_program_length
old: 35.60964047443681
new: 291.93274338631795
path: .spaces[29].metrics.halstead.vocabulary
old: 13.0
new: 58.0
path: .spaces[29].metrics.halstead.length
old: 25.0
new: 192.0
path: .spaces[29].metrics.halstead.n1
old: 8.0
new: 15.0
path: .spaces[29].metrics.loc.cloc
old: 0.0
new: 2.0
path: .spaces[29].metrics.loc.lloc
old: 2.0
new: 22.0
path: .spaces[29].metrics.loc.ploc
old: 6.0
new: 41.0
path: .spaces[29].metrics.loc.blank
old: 0.0
new: 12.0
path: .spaces[29].metrics.loc.sloc
old: 6.0
new: 55.0
path: .spaces[29].metrics.cyclomatic.average
old: 2.0
new: 9.0
path: .spaces[29].metrics.cyclomatic.sum
old: 2.0
new: 9.0
path: .spaces[29].metrics.mi.mi_original
old: 117.97139370147602
new: 67.4796404431577
path: .spaces[29].metrics.mi.mi_sei
old: 94.69953238667514
new: 37.12513327017156
path: .spaces[29].metrics.mi.mi_visual_studio
old: 68.98911912367018
new: 39.461778036934334
path: .spaces[29].metrics.nexits.average
old: 0.0
new: 8.0
path: .spaces[29].metrics.nexits.sum
old: 0.0
new: 8.0
path: .spaces[29].metrics.cognitive.average
old: 1.0
new: 11.0
path: .spaces[29].metrics.cognitive.sum
old: 1.0
new: 11.0
Code
nsOfflineCacheUpdateService::AllowOfflineApp(nsIPrincipal* aPrincipal) {
nsresult rv;
if (!StaticPrefs::browser_cache_offline_enable()) {
return NS_ERROR_NOT_AVAILABLE;
}
if (!StaticPrefs::browser_cache_offline_storage_enable()) {
return NS_ERROR_NOT_AVAILABLE;
}
nsCOMPtr uri;
// Casting to BasePrincipal, as we can't get InnerMost URI otherwise
auto* basePrincipal = BasePrincipal::Cast(aPrincipal);
basePrincipal->GetURI(getter_AddRefs(uri));
if (!uri) {
return NS_ERROR_NOT_AVAILABLE;
}
nsCOMPtr innerURI = NS_GetInnermostURI(uri);
if (!innerURI) {
return NS_ERROR_NOT_AVAILABLE;
}
// if http then we should prevent this cache
if (innerURI->SchemeIs("http")) {
return NS_ERROR_NOT_AVAILABLE;
}
if (GeckoProcessType_Default != XRE_GetProcessType()) {
ContentChild* child = ContentChild::GetSingleton();
if (!child->SendSetOfflinePermission(IPC::Principal(aPrincipal))) {
return NS_ERROR_FAILURE;
}
nsAutoCString domain;
rv = aPrincipal->GetBaseDomain(domain);
NS_ENSURE_SUCCESS(rv, rv);
nsOfflineCacheUpdateService::AllowedDomains()->PutEntry(domain);
} else {
nsCOMPtr permissionManager =
components::PermissionManager::Service();
if (!permissionManager) return NS_ERROR_NOT_AVAILABLE;
rv = permissionManager->AddFromPrincipal(
aPrincipal, "offline-app"_ns, nsIPermissionManager::ALLOW_ACTION,
nsIPermissionManager::EXPIRE_NEVER, 0);
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}
Minimal test - lines (78, 105)
path: .spaces[1].metrics.cognitive.sum
old: 1.0
new: 0.0
path: .spaces[1].metrics.cognitive.average
old: 1.0
new: 0.0
path: .spaces[1].metrics.nom.total
old: 1.0
new: 2.0
path: .spaces[1].metrics.nom.functions
old: 1.0
new: 2.0
path: .spaces[1].metrics.loc.ploc
old: 67.0
new: 25.0
path: .spaces[1].metrics.loc.sloc
old: 67.0
new: 28.0
path: .spaces[1].metrics.loc.lloc
old: 64.0
new: 1.0
path: .spaces[1].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[1].metrics.cyclomatic.sum
old: 32.0
new: 3.0
path: .spaces[1].metrics.cyclomatic.average
old: 32.0
new: 1.0
path: .spaces[1].metrics.mi.mi_original
old: 57.35166264793436
new: 84.21590702475855
path: .spaces[1].metrics.mi.mi_sei
old: 10.298342797841713
new: 46.10247901478586
path: .spaces[1].metrics.mi.mi_visual_studio
old: 33.53898400463998
new: 49.24906843553131
path: .spaces[1].metrics.halstead.N1
old: 192.0
new: 48.0
path: .spaces[1].metrics.halstead.difficulty
old: 5.884615384615385
new: 9.9
path: .spaces[1].metrics.halstead.length
old: 260.0
new: 93.0
path: .spaces[1].metrics.halstead.purity_ratio
old: 1.2498161167550674
new: 1.6575285220363267
path: .spaces[1].metrics.halstead.time
old: 504.1126736928454
new: 264.44166382377426
path: .spaces[1].metrics.halstead.estimated_program_length
old: 324.95219035631754
new: 154.1501525493784
path: .spaces[1].metrics.halstead.effort
old: 9074.028126471218
new: 4759.949948827937
path: .spaces[1].metrics.halstead.level
old: 0.1699346405228758
new: 0.101010101010101
path: .spaces[1].metrics.halstead.N2
old: 68.0
new: 45.0
path: .spaces[1].metrics.halstead.bugs
old: 0.14501474369831066
new: 0.09432214516755982
path: .spaces[1].metrics.halstead.n2
old: 52.0
new: 25.0
path: .spaces[1].metrics.halstead.n1
old: 9.0
new: 11.0
path: .spaces[1].metrics.halstead.vocabulary
old: 61.0
new: 36.0
path: .spaces[1].metrics.halstead.volume
old: 1541.9917077663506
new: 480.80302513413505
path: .spaces[1].metrics.nargs.average
old: 1.0
new: 2.5
path: .spaces[1].metrics.nargs.sum
old: 1.0
new: 5.0
path: .spaces[1].metrics.nexits.average
old: 30.0
new: 0.0
path: .spaces[1].metrics.nexits.sum
old: 30.0
new: 0.0
Code
class nsOfflineCachePendingUpdate final : public nsIWebProgressListener,
public nsSupportsWeakReference {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBPROGRESSLISTENER
nsOfflineCachePendingUpdate(nsOfflineCacheUpdateService* aService,
nsIURI* aManifestURI, nsIURI* aDocumentURI,
nsIPrincipal* aLoadingPrincipal,
Document* aDocument)
: mService(aService),
mManifestURI(aManifestURI),
mDocumentURI(aDocumentURI),
mLoadingPrincipal(aLoadingPrincipal),
mDidReleaseThis(false) {
mDocument = do_GetWeakReference(aDocument);
}
private:
~nsOfflineCachePendingUpdate() {}
RefPtr mService;
nsCOMPtr mManifestURI;
nsCOMPtr mDocumentURI;
nsCOMPtr mLoadingPrincipal;
nsWeakPtr mDocument;
bool mDidReleaseThis;
};
Minimal test - lines (471, 490)
path: .spaces[23].metrics.nargs.average
old: 0.0
new: 3.0
path: .spaces[23].metrics.nargs.sum
old: 0.0
new: 3.0
path: .spaces[23].metrics.mi.mi_sei
old: 105.12994940155043
new: 73.04831028452162
path: .spaces[23].metrics.mi.mi_original
old: 125.27178399587255
new: 91.1969254639455
path: .spaces[23].metrics.mi.mi_visual_studio
old: 73.25835321396058
new: 53.33153535903246
path: .spaces[23].metrics.loc.lloc
old: 1.0
new: 7.0
path: .spaces[23].metrics.loc.ploc
old: 4.0
new: 14.0
path: .spaces[23].metrics.loc.blank
old: 0.0
new: 5.0
path: .spaces[23].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[23].metrics.loc.sloc
old: 4.0
new: 20.0
path: .spaces[23].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[23].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[23].metrics.nexits.sum
old: 1.0
new: 2.0
path: .spaces[23].metrics.nexits.average
old: 1.0
new: 2.0
path: .spaces[23].metrics.halstead.effort
old: 630.0
new: 4118.8142626068075
path: .spaces[23].metrics.halstead.n1
old: 10.0
new: 14.0
path: .spaces[23].metrics.halstead.n2
old: 6.0
new: 21.0
path: .spaces[23].metrics.halstead.N2
old: 9.0
new: 33.0
path: .spaces[23].metrics.halstead.level
old: 0.13333333333333333
new: 0.09090909090909093
path: .spaces[23].metrics.halstead.length
old: 21.0
new: 73.0
path: .spaces[23].metrics.halstead.difficulty
old: 7.5
new: 11.0
path: .spaces[23].metrics.halstead.estimated_program_length
old: 48.72905595320056
new: 145.54163478716043
path: .spaces[23].metrics.halstead.vocabulary
old: 16.0
new: 35.0
path: .spaces[23].metrics.halstead.N1
old: 12.0
new: 40.0
path: .spaces[23].metrics.halstead.time
old: 35.0
new: 228.82301458926707
path: .spaces[23].metrics.halstead.volume
old: 84.0
new: 374.43766023698254
path: .spaces[23].metrics.halstead.bugs
old: 0.024496598167132053
new: 0.08564990466735453
path: .spaces[23].metrics.halstead.purity_ratio
old: 2.3204312358666934
new: 1.9937210244816497
path: .spaces[23].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[23].metrics.cyclomatic.average
old: 1.0
new: 2.0
Code
NS_IMETHODIMP nsOfflineCacheUpdateService::CheckForUpdate(
nsIURI* aManifestURI, nsIPrincipal* aLoadingPrincipal,
nsIObserver* aObserver) {
if (GeckoProcessType_Default != XRE_GetProcessType()) {
// Not intended to support this on child processes
return NS_ERROR_NOT_IMPLEMENTED;
}
nsCOMPtr update = new OfflineCacheUpdateGlue();
nsresult rv;
rv = update->InitForUpdateCheck(aManifestURI, aLoadingPrincipal, aObserver);
NS_ENSURE_SUCCESS(rv, rv);
rv = update->Schedule();
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
Minimal test - lines (200, 205)
path: .spaces[6].metrics.loc.sloc
old: 3.0
new: 6.0
path: .spaces[6].metrics.loc.ploc
old: 3.0
new: 6.0
path: .spaces[6].metrics.loc.lloc
old: 1.0
new: 2.0
path: .spaces[6].metrics.halstead.n2
old: 7.0
new: 9.0
path: .spaces[6].metrics.halstead.level
old: 0.2916666666666667
new: 0.25
path: .spaces[6].metrics.halstead.N2
old: 8.0
new: 9.0
path: .spaces[6].metrics.halstead.difficulty
old: 3.4285714285714284
new: 4.0
path: .spaces[6].metrics.halstead.estimated_program_length
old: 35.161259458730164
new: 52.529325012980806
path: .spaces[6].metrics.halstead.time
old: 11.982376230171155
new: 19.074826592501584
path: .spaces[6].metrics.halstead.bugs
old: 0.011988247942334716
new: 0.016344343499188157
path: .spaces[6].metrics.halstead.vocabulary
old: 13.0
new: 17.0
path: .spaces[6].metrics.halstead.effort
old: 215.6827721430808
new: 343.3468786650285
path: .spaces[6].metrics.halstead.purity_ratio
old: 2.068309379925304
new: 2.5013964291895623
path: .spaces[6].metrics.halstead.n1
old: 6.0
new: 8.0
path: .spaces[6].metrics.halstead.length
old: 17.0
new: 21.0
path: .spaces[6].metrics.halstead.volume
old: 62.907475208398566
new: 85.83671966625712
path: .spaces[6].metrics.halstead.N1
old: 9.0
new: 12.0
path: .spaces[6].metrics.nargs.sum
old: 1.0
new: 3.0
path: .spaces[6].metrics.nargs.average
old: 1.0
new: 3.0
path: .spaces[6].metrics.mi.mi_sei
old: 114.02277779900194
new: 95.49128769050486
path: .spaces[6].metrics.mi.mi_visual_studio
old: 76.86305434314004
new: 69.35132912660247
path: .spaces[6].metrics.mi.mi_original
old: 131.43582292676948
new: 118.5907728064902
Code
nsOfflineCachePendingUpdate::OnSecurityChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
uint32_t aState) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}
Minimal test - lines (454, 461)
path: .spaces[21].metrics.loc.sloc
old: 4.0
new: 8.0
path: .spaces[21].metrics.loc.ploc
old: 4.0
new: 8.0
path: .spaces[21].metrics.mi.mi_original
old: 126.19700005047748
new: 109.79401249948933
path: .spaces[21].metrics.mi.mi_sei
old: 106.4647540152798
new: 82.80024521970583
path: .spaces[21].metrics.mi.mi_visual_studio
old: 73.79941523419735
new: 64.20702485350253
path: .spaces[21].metrics.nargs.average
old: 2.0
new: 5.0
path: .spaces[21].metrics.nargs.sum
old: 2.0
new: 5.0
path: .spaces[21].metrics.halstead.N2
old: 8.0
new: 20.0
path: .spaces[21].metrics.halstead.bugs
old: 0.01957356884634842
new: 0.0338637731485916
path: .spaces[21].metrics.halstead.estimated_program_length
old: 35.60964047443681
new: 67.75720079023742
path: .spaces[21].metrics.halstead.vocabulary
old: 13.0
new: 20.0
path: .spaces[21].metrics.halstead.level
old: 0.15625
new: 0.1857142857142857
path: .spaces[21].metrics.halstead.purity_ratio
old: 1.8741916039177269
new: 1.539936381596305
path: .spaces[21].metrics.halstead.length
old: 19.0
new: 44.0
path: .spaces[21].metrics.halstead.volume
old: 70.30835464468075
new: 190.16483617504392
path: .spaces[21].metrics.halstead.time
old: 24.99852609588649
new: 56.88691680450033
path: .spaces[21].metrics.halstead.n1
old: 8.0
new: 7.0
path: .spaces[21].metrics.halstead.effort
old: 449.9734697259568
new: 1023.964502481006
path: .spaces[21].metrics.halstead.N1
old: 11.0
new: 24.0
path: .spaces[21].metrics.halstead.difficulty
old: 6.4
new: 5.384615384615385
path: .spaces[21].metrics.halstead.n2
old: 5.0
new: 13.0
Code
nsOfflineCacheUpdateService::ScheduleUpdate(nsIURI* aManifestURI,
nsIURI* aDocumentURI,
nsIPrincipal* aLoadingPrincipal,
mozIDOMWindow* aWindow,
nsIOfflineCacheUpdate** aUpdate) {
return Schedule(aManifestURI, aDocumentURI, aLoadingPrincipal, nullptr,
nsPIDOMWindowInner::From(aWindow), nullptr, aUpdate);
}
Minimal test - lines (45, 49)
path: .spaces[0].metrics.mi.mi_visual_studio
old: 89.84306917940205
new: 70.47966131662542
path: .spaces[0].metrics.mi.mi_original
old: 153.6316482967775
new: 120.52022085142949
path: .spaces[0].metrics.mi.mi_sei
old: 146.04458498874996
new: 98.37671267599616
path: .spaces[0].metrics.halstead.N2
old: 2.0
new: 8.0
path: .spaces[0].metrics.halstead.estimated_program_length
old: 17.509775004326936
new: 51.01955000865387
path: .spaces[0].metrics.halstead.difficulty
old: 3.0
new: 12.0
path: .spaces[0].metrics.halstead.n2
old: 2.0
new: 4.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.9455305560363263
new: 2.0407820003461548
path: .spaces[0].metrics.halstead.time
old: 4.5
new: 66.66666666666667
path: .spaces[0].metrics.halstead.level
old: 0.3333333333333333
new: 0.08333333333333333
path: .spaces[0].metrics.halstead.vocabulary
old: 8.0
new: 16.0
path: .spaces[0].metrics.halstead.volume
old: 27.0
new: 100.0
path: .spaces[0].metrics.halstead.length
old: 9.0
new: 25.0
path: .spaces[0].metrics.halstead.effort
old: 81.0
new: 1200.0
path: .spaces[0].metrics.halstead.n1
old: 6.0
new: 12.0
path: .spaces[0].metrics.halstead.bugs
old: 0.006240251469155711
new: 0.03764144115524113
path: .spaces[0].metrics.halstead.N1
old: 7.0
new: 17.0
path: .spaces[0].metrics.loc.lloc
old: 1.0
new: 3.0
path: .spaces[0].metrics.loc.sloc
old: 1.0
new: 5.0
path: .spaces[0].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[0].metrics.loc.ploc
old: 1.0
new: 4.0
path: .spaces[0].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[0].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[0].metrics.cognitive.sum
old: 0.0
new: 1.0
Code
nsTHashtable* nsOfflineCacheUpdateService::AllowedDomains() {
if (!mAllowedDomains) mAllowedDomains = new nsTHashtable();
return mAllowedDomains;
}
Minimal test - lines (278, 288)
path: .spaces[13].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[13].metrics.loc.ploc
old: 3.0
new: 8.0
path: .spaces[13].metrics.loc.sloc
old: 3.0
new: 11.0
path: .spaces[13].metrics.loc.lloc
old: 1.0
new: 5.0
path: .spaces[13].metrics.mi.mi_original
old: 131.43582292676948
new: 106.13100883211833
path: .spaces[13].metrics.mi.mi_sei
old: 114.02277779900194
new: 77.5156479940316
path: .spaces[13].metrics.mi.mi_visual_studio
old: 76.86305434314004
new: 62.06491744568322
path: .spaces[13].metrics.halstead.n2
old: 5.0
new: 11.0
path: .spaces[13].metrics.halstead.vocabulary
old: 13.0
new: 20.0
path: .spaces[13].metrics.halstead.N2
old: 7.0
new: 14.0
path: .spaces[13].metrics.halstead.effort
old: 352.28186116703193
new: 816.8444099337116
path: .spaces[13].metrics.halstead.purity_ratio
old: 2.0946847337904004
new: 2.017668873272457
path: .spaces[13].metrics.halstead.bugs
old: 0.016626682361242505
new: 0.02912761816732554
path: .spaces[13].metrics.halstead.N1
old: 10.0
new: 19.0
path: .spaces[13].metrics.halstead.estimated_program_length
old: 35.60964047443681
new: 66.58307281799108
path: .spaces[13].metrics.halstead.time
old: 19.571214509279553
new: 45.38024499631731
path: .spaces[13].metrics.halstead.volume
old: 62.907475208398566
new: 142.62362713128297
path: .spaces[13].metrics.halstead.level
old: 0.17857142857142858
new: 0.1746031746031746
path: .spaces[13].metrics.halstead.n1
old: 8.0
new: 9.0
path: .spaces[13].metrics.halstead.difficulty
old: 5.6
new: 5.7272727272727275
path: .spaces[13].metrics.halstead.length
old: 17.0
new: 33.0
Code
nsresult nsOfflineCacheUpdateService::ScheduleUpdate(
nsOfflineCacheUpdate* aUpdate) {
LOG(("nsOfflineCacheUpdateService::Schedule [%p, update=%p]", this, aUpdate));
aUpdate->SetOwner(this);
mUpdates.AppendElement(aUpdate);
ProcessNextUpdate();
return NS_OK;
}
Minimal test - lines (225, 228)
path: .spaces[8].metrics.nexits.sum
old: 1.0
new: 0.0
path: .spaces[8].metrics.nexits.average
old: 1.0
new: 0.0
path: .spaces[8].metrics.mi.mi_sei
old: 114.02277779900194
new: 107.53701147893022
path: .spaces[8].metrics.mi.mi_visual_studio
old: 76.86305434314004
new: 74.23405396973165
path: .spaces[8].metrics.mi.mi_original
old: 131.43582292676948
new: 126.9402322882411
path: .spaces[8].metrics.loc.ploc
old: 3.0
new: 4.0
path: .spaces[8].metrics.loc.sloc
old: 3.0
new: 4.0
path: .spaces[8].metrics.nargs.average
old: 1.0
new: 0.0
path: .spaces[8].metrics.nargs.sum
old: 1.0
new: 0.0
path: .spaces[8].metrics.halstead.vocabulary
old: 13.0
new: 12.0
path: .spaces[8].metrics.halstead.n2
old: 5.0
new: 6.0
path: .spaces[8].metrics.halstead.level
old: 0.17857142857142858
new: 0.2857142857142857
path: .spaces[8].metrics.halstead.estimated_program_length
old: 35.60964047443681
new: 31.019550008653873
path: .spaces[8].metrics.halstead.difficulty
old: 5.6
new: 3.5
path: .spaces[8].metrics.halstead.bugs
old: 0.016626682361242505
new: 0.011899986460347829
path: .spaces[8].metrics.halstead.purity_ratio
old: 2.0946847337904004
new: 1.8246794122737573
path: .spaces[8].metrics.halstead.volume
old: 62.907475208398566
new: 60.94436251225965
path: .spaces[8].metrics.halstead.effort
old: 352.28186116703193
new: 213.3052687929088
path: .spaces[8].metrics.halstead.n1
old: 8.0
new: 6.0
path: .spaces[8].metrics.halstead.time
old: 19.571214509279553
new: 11.850292710717154
Code
nsOfflineCacheUpdateService::nsOfflineCacheUpdateService()
: mDisabled(false), mUpdateRunning(false) {
MOZ_ASSERT(NS_IsMainThread());
}
Minimal test - lines (371, 382)
path: .spaces[18].metrics.cognitive.sum
old: 0.0
new: 2.0
path: .spaces[18].metrics.cognitive.average
old: 0.0
new: 2.0
path: .spaces[18].metrics.mi.mi_sei
old: 105.12994940155043
new: 72.06006432176225
path: .spaces[18].metrics.mi.mi_original
old: 125.27178399587255
new: 102.27891024290474
path: .spaces[18].metrics.mi.mi_visual_studio
old: 73.25835321396058
new: 59.812228212225
path: .spaces[18].metrics.loc.sloc
old: 4.0
new: 12.0
path: .spaces[18].metrics.loc.ploc
old: 4.0
new: 10.0
path: .spaces[18].metrics.loc.lloc
old: 1.0
new: 5.0
path: .spaces[18].metrics.loc.blank
old: 0.0
new: 2.0
path: .spaces[18].metrics.halstead.effort
old: 630.0
new: 2361.189788128185
path: .spaces[18].metrics.halstead.volume
old: 84.0
new: 218.26124091941205
path: .spaces[18].metrics.halstead.vocabulary
old: 16.0
new: 25.0
path: .spaces[18].metrics.halstead.n2
old: 6.0
new: 11.0
path: .spaces[18].metrics.halstead.estimated_program_length
old: 48.72905595320056
new: 91.35671671381672
path: .spaces[18].metrics.halstead.length
old: 21.0
new: 47.0
path: .spaces[18].metrics.halstead.n1
old: 10.0
new: 14.0
path: .spaces[18].metrics.halstead.bugs
old: 0.024496598167132053
new: 0.0591061506155739
path: .spaces[18].metrics.halstead.purity_ratio
old: 2.3204312358666934
new: 1.943759930081207
path: .spaces[18].metrics.halstead.N1
old: 12.0
new: 30.0
path: .spaces[18].metrics.halstead.N2
old: 9.0
new: 17.0
path: .spaces[18].metrics.halstead.difficulty
old: 7.5
new: 10.818181818181818
path: .spaces[18].metrics.halstead.level
old: 0.13333333333333333
new: 0.09243697478991596
path: .spaces[18].metrics.halstead.time
old: 35.0
new: 131.17721045156583
path: .spaces[18].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[18].metrics.cyclomatic.sum
old: 1.0
new: 2.0
Code
nsOfflineCacheUpdateService::GetUpdate(uint32_t aIndex,
nsIOfflineCacheUpdate** aUpdate) {
LOG(("nsOfflineCacheUpdateService::GetUpdate [%p, %d]", this, aIndex));
if (aIndex < mUpdates.Length()) {
NS_ADDREF(*aUpdate = mUpdates[aIndex]);
} else {
*aUpdate = nullptr;
}
return NS_OK;
}
Minimal test - lines (115, 123)
path: .spaces[2].metrics.mi.mi_sei
old: 5.20108586904589
new: 82.92067351609002
path: .spaces[2].metrics.mi.mi_original
old: 38.01236000610619
new: 109.87748703358766
path: .spaces[2].metrics.mi.mi_visual_studio
old: 22.229450295968533
new: 64.2558403705191
path: .spaces[2].metrics.nexits.sum
old: 7.0
new: 1.0
path: .spaces[2].metrics.nexits.average
old: 7.0
new: 1.0
path: .spaces[2].metrics.cyclomatic.average
old: 23.0
new: 1.0
path: .spaces[2].metrics.cyclomatic.sum
old: 23.0
new: 1.0
path: .spaces[2].metrics.nargs.average
old: 10.0
new: 6.0
path: .spaces[2].metrics.nargs.sum
old: 10.0
new: 6.0
path: .spaces[2].metrics.cognitive.average
old: 28.0
new: 0.0
path: .spaces[2].metrics.cognitive.sum
old: 28.0
new: 0.0
path: .spaces[2].metrics.loc.sloc
old: 167.0
new: 9.0
path: .spaces[2].metrics.loc.cloc
old: 17.0
new: 0.0
path: .spaces[2].metrics.loc.lloc
old: 58.0
new: 2.0
path: .spaces[2].metrics.loc.blank
old: 24.0
new: 0.0
path: .spaces[2].metrics.loc.ploc
old: 126.0
new: 9.0
path: .spaces[2].metrics.halstead.purity_ratio
old: 1.280721915671745
new: 2.2339850002884627
path: .spaces[2].metrics.halstead.n1
old: 36.0
new: 8.0
path: .spaces[2].metrics.halstead.N2
old: 317.0
new: 12.0
path: .spaces[2].metrics.halstead.bugs
old: 1.4026166833540883
new: 0.021517142732338488
path: .spaces[2].metrics.halstead.length
old: 760.0
new: 30.0
path: .spaces[2].metrics.halstead.difficulty
old: 49.61739130434783
new: 4.0
path: .spaces[2].metrics.halstead.vocabulary
old: 151.0
new: 20.0
path: .spaces[2].metrics.halstead.level
old: 0.02015422362425517
new: 0.25
path: .spaces[2].metrics.halstead.effort
old: 272954.57788145705
new: 518.6313713864835
path: .spaces[2].metrics.halstead.volume
old: 5501.18760188706
new: 129.65784284662087
path: .spaces[2].metrics.halstead.n2
old: 115.0
new: 12.0
path: .spaces[2].metrics.halstead.N1
old: 443.0
new: 18.0
path: .spaces[2].metrics.halstead.estimated_program_length
old: 973.3486559105264
new: 67.01955000865388
path: .spaces[2].metrics.halstead.time
old: 15164.143215636504
new: 28.81285396591575
Code
nsOfflineCachePendingUpdate::OnProgressChange(nsIWebProgress* aProgress,
nsIRequest* aRequest,
int32_t curSelfProgress,
int32_t maxSelfProgress,
int32_t curTotalProgress,
int32_t maxTotalProgress) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}
Minimal test - lines (583, 589)
path: .spaces[28].metrics.loc.lloc
old: 43.0
new: 1.0
path: .spaces[28].metrics.loc.sloc
old: 131.0
new: 7.0
path: .spaces[28].metrics.loc.blank
old: 28.0
new: 0.0
path: .spaces[28].metrics.loc.cloc
old: 6.0
new: 0.0
path: .spaces[28].metrics.loc.ploc
old: 97.0
new: 7.0
path: .spaces[28].metrics.nexits.average
old: 2.3333333333333335
new: 1.0
path: .spaces[28].metrics.nexits.sum
old: 7.0
new: 1.0
path: .spaces[28].metrics.nargs.sum
old: 6.0
new: 2.0
path: .spaces[28].metrics.cognitive.average
old: 6.0
new: 0.0
path: .spaces[28].metrics.cognitive.sum
old: 18.0
new: 0.0
path: .spaces[28].metrics.halstead.level
old: 0.03340484216978241
new: 0.1390374331550802
path: .spaces[28].metrics.halstead.N1
old: 369.0
new: 20.0
path: .spaces[28].metrics.halstead.bugs
old: 0.8613087151410893
new: 0.03806121014103269
path: .spaces[28].metrics.halstead.n2
old: 109.0
new: 13.0
path: .spaces[28].metrics.halstead.vocabulary
old: 135.0
new: 24.0
path: .spaces[28].metrics.halstead.purity_ratio
old: 1.3870056839876663
new: 2.3286341659687695
path: .spaces[28].metrics.halstead.effort
old: 131346.9959795381
new: 1220.1290593265262
path: .spaces[28].metrics.halstead.difficulty
old: 29.93577981651376
new: 7.1923076923076925
path: .spaces[28].metrics.halstead.n1
old: 26.0
new: 11.0
path: .spaces[28].metrics.halstead.time
old: 7297.055332196561
new: 67.78494774036257
path: .spaces[28].metrics.halstead.estimated_program_length
old: 859.9435240723533
new: 86.15946414084446
path: .spaces[28].metrics.halstead.N2
old: 251.0
new: 17.0
path: .spaces[28].metrics.halstead.length
old: 620.0
new: 37.0
path: .spaces[28].metrics.halstead.volume
old: 4387.625670171515
new: 169.64361252668277
path: .spaces[28].metrics.nom.closures
old: 2.0
new: 0.0
path: .spaces[28].metrics.nom.total
old: 3.0
new: 1.0
path: .spaces[28].metrics.mi.mi_original
old: 44.96177711142343
new: 112.55101641921529
path: .spaces[28].metrics.mi.mi_visual_studio
old: 26.293436907265168
new: 65.8193078474943
path: .spaces[28].metrics.mi.mi_sei
old: 6.967905035011345
new: 86.77776110240586
path: .spaces[28].metrics.cyclomatic.sum
old: 15.0
new: 1.0
path: .spaces[28].metrics.cyclomatic.average
old: 15.0
new: 1.0
Code
nsresult nsOfflineCacheUpdateService::OfflineAppPinnedForURI(
nsIURI* aDocumentURI, bool* aPinned) {
OriginAttributes attrs;
nsCOMPtr principal =
BasePrincipal::CreateContentPrincipal(aDocumentURI, attrs);
return OfflineAppPermForPrincipal(principal, true, aPinned);
}
Minimal test - lines (182, 188)
path: .spaces[4].metrics.halstead.length
old: 35.0
new: 25.0
path: .spaces[4].metrics.halstead.n2
old: 10.0
new: 11.0
path: .spaces[4].metrics.halstead.purity_ratio
old: 1.6348365985392463
new: 2.482149912200411
path: .spaces[4].metrics.halstead.time
old: 55.135675019070575
new: 23.599597296908808
path: .spaces[4].metrics.halstead.vocabulary
old: 18.0
new: 19.0
path: .spaces[4].metrics.halstead.volume
old: 145.94737505048093
new: 106.19818783608964
path: .spaces[4].metrics.halstead.N1
old: 18.0
new: 14.0
path: .spaces[4].metrics.halstead.estimated_program_length
old: 57.219280948873624
new: 62.05374780501027
path: .spaces[4].metrics.halstead.bugs
old: 0.033165168845354476
new: 0.01883635254437623
path: .spaces[4].metrics.halstead.effort
old: 992.4421503432704
new: 424.7927513443585
path: .spaces[4].metrics.halstead.N2
old: 17.0
new: 11.0
path: .spaces[4].metrics.halstead.level
old: 0.14705882352941177
new: 0.25
path: .spaces[4].metrics.halstead.difficulty
old: 6.8
new: 4.0
path: .spaces[4].metrics.loc.ploc
old: 6.0
new: 7.0
path: .spaces[4].metrics.loc.lloc
old: 0.0
new: 2.0
path: .spaces[4].metrics.loc.sloc
old: 6.0
new: 7.0
path: .spaces[4].metrics.mi.mi_visual_studio
old: 67.73720281682291
new: 67.2436602055262
path: .spaces[4].metrics.mi.mi_sei
old: 91.50922433205152
new: 90.29165050503887
path: .spaces[4].metrics.mi.mi_original
old: 115.8306168167672
new: 114.9866589514498
path: .spaces[4].metrics.nargs.sum
old: 1.0
new: 4.0
path: .spaces[4].metrics.nargs.average
old: 1.0
new: 4.0
path: .spaces[4].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[4].metrics.nexits.sum
old: 0.0
new: 1.0
Code
nsOfflineCachePendingUpdate::OnLocationChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
nsIURI* location,
uint32_t aFlags) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}
Minimal test - lines (363, 368)
path: .spaces[17].metrics.halstead.effort
old: 642.315589339339
new: 560.5663325143322
path: .spaces[17].metrics.halstead.purity_ratio
old: 2.403216609239857
new: 2.2029485584698687
path: .spaces[17].metrics.halstead.volume
old: 89.92418250750745
new: 98.09910819000814
path: .spaces[17].metrics.halstead.length
old: 22.0
new: 24.0
path: .spaces[17].metrics.halstead.N2
old: 10.0
new: 8.0
path: .spaces[17].metrics.halstead.N1
old: 12.0
new: 16.0
path: .spaces[17].metrics.halstead.time
old: 35.684199407741055
new: 31.14257402857401
path: .spaces[17].metrics.halstead.level
old: 0.14
new: 0.175
path: .spaces[17].metrics.halstead.difficulty
old: 7.142857142857143
new: 5.714285714285714
path: .spaces[17].metrics.halstead.bugs
old: 0.024814815683571648
new: 0.022661922621840313
path: .spaces[17].metrics.nargs.average
old: 0.0
new: 1.0
path: .spaces[17].metrics.nargs.sum
old: 0.0
new: 1.0
path: .spaces[17].metrics.loc.sloc
old: 4.0
new: 6.0
path: .spaces[17].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[17].metrics.loc.lloc
old: 1.0
new: 3.0
path: .spaces[17].metrics.loc.ploc
old: 4.0
new: 5.0
path: .spaces[17].metrics.mi.mi_original
old: 124.91740347654104
new: 117.89640956484268
path: .spaces[17].metrics.mi.mi_sei
old: 104.6186863837232
new: 94.4895332852044
path: .spaces[17].metrics.mi.mi_visual_studio
old: 73.05111314417604
new: 68.94526875137
Code
nsOfflineCacheUpdateService::GetNumUpdates(uint32_t* aNumUpdates) {
LOG(("nsOfflineCacheUpdateService::GetNumUpdates [%p]", this));
*aNumUpdates = mUpdates.Length();
return NS_OK;
}
Minimal test - lines (191, 197)
path: .spaces[5].metrics.nargs.average
old: 1.0
new: 4.0
path: .spaces[5].metrics.nargs.sum
old: 1.0
new: 4.0
path: .spaces[5].metrics.loc.ploc
old: 8.0
new: 7.0
path: .spaces[5].metrics.loc.sloc
old: 9.0
new: 7.0
path: .spaces[5].metrics.loc.lloc
old: 3.0
new: 2.0
path: .spaces[5].metrics.loc.cloc
old: 1.0
new: 0.0
path: .spaces[5].metrics.nexits.sum
old: 0.0
new: 1.0
path: .spaces[5].metrics.nexits.average
old: 0.0
new: 1.0
path: .spaces[5].metrics.halstead.volume
old: 277.3259433703244
new: 106.19818783608964
path: .spaces[5].metrics.halstead.N1
old: 37.0
new: 14.0
path: .spaces[5].metrics.halstead.estimated_program_length
old: 96.32251891746031
new: 62.05374780501027
path: .spaces[5].metrics.halstead.level
old: 0.07792207792207792
new: 0.25
path: .spaces[5].metrics.halstead.time
old: 197.7231262918054
new: 23.599597296908808
path: .spaces[5].metrics.halstead.effort
old: 3559.016273252497
new: 424.7927513443585
path: .spaces[5].metrics.halstead.purity_ratio
old: 1.632585066397633
new: 2.482149912200411
path: .spaces[5].metrics.halstead.difficulty
old: 12.833333333333334
new: 4.0
path: .spaces[5].metrics.halstead.vocabulary
old: 26.0
new: 19.0
path: .spaces[5].metrics.halstead.length
old: 59.0
new: 25.0
path: .spaces[5].metrics.halstead.n1
old: 14.0
new: 8.0
path: .spaces[5].metrics.halstead.N2
old: 22.0
new: 11.0
path: .spaces[5].metrics.halstead.n2
old: 12.0
new: 11.0
path: .spaces[5].metrics.halstead.bugs
old: 0.07770197561805875
new: 0.01883635254437623
path: .spaces[5].metrics.mi.mi_visual_studio
old: 61.94383369567817
new: 67.2436602055262
path: .spaces[5].metrics.mi.mi_sei
old: 101.90447559150178
new: 90.29165050503887
path: .spaces[5].metrics.mi.mi_original
old: 105.92395561960969
new: 114.9866589514498
Code
nsOfflineCachePendingUpdate::OnStatusChange(nsIWebProgress* aWebProgress,
nsIRequest* aRequest,
nsresult aStatus,
const char16_t* aMessage) {
MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)");
return NS_OK;
}
Minimal test - lines (238, 251)
path: .spaces[10].metrics.mi.mi_visual_studio
old: 56.87266593857348
new: 58.315024685442495
path: .spaces[10].metrics.mi.mi_original
old: 97.25225875496064
new: 99.71869221210667
path: .spaces[10].metrics.mi.mi_sei
old: 97.6696230233762
new: 88.48198170551962
path: .spaces[10].metrics.nargs.sum
old: 1.0
new: 0.0
path: .spaces[10].metrics.nargs.average
old: 1.0
new: 0.0
path: .spaces[10].metrics.halstead.bugs
old: 0.10357337406458224
new: 0.04930460901953381
path: .spaces[10].metrics.halstead.estimated_program_length
old: 128.36161893476807
new: 96.32251891746031
path: .spaces[10].metrics.halstead.effort
old: 5477.142857142857
new: 1798.9254292714263
path: .spaces[10].metrics.halstead.n1
old: 18.0
new: 12.0
path: .spaces[10].metrics.halstead.volume
old: 355.0
new: 220.92066675263132
path: .spaces[10].metrics.halstead.N1
old: 47.0
new: 28.0
path: .spaces[10].metrics.halstead.level
old: 0.06481481481481481
new: 0.12280701754385966
path: .spaces[10].metrics.halstead.length
old: 71.0
new: 47.0
path: .spaces[10].metrics.halstead.purity_ratio
old: 1.807910125841804
new: 2.049415296116177
path: .spaces[10].metrics.halstead.difficulty
old: 15.428571428571429
new: 8.142857142857142
path: .spaces[10].metrics.halstead.N2
old: 24.0
new: 19.0
path: .spaces[10].metrics.halstead.time
old: 304.2857142857143
new: 99.94030162619036
path: .spaces[10].metrics.halstead.vocabulary
old: 32.0
new: 26.0
path: .spaces[10].metrics.loc.blank
old: 0.0
new: 3.0
path: .spaces[10].metrics.loc.ploc
old: 11.0
new: 10.0
path: .spaces[10].metrics.loc.cloc
old: 3.0
new: 1.0
path: .spaces[10].metrics.cognitive.sum
old: 2.0
new: 1.0
path: .spaces[10].metrics.cognitive.average
old: 2.0
new: 1.0
Code
nsresult nsOfflineCacheUpdateService::Init() {
// Observe xpcom-shutdown event
nsCOMPtr observerService =
mozilla::services::GetObserverService();
if (!observerService) return NS_ERROR_FAILURE;
nsresult rv =
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, true);
NS_ENSURE_SUCCESS(rv, rv);
gOfflineCacheUpdateService = this;
return NS_OK;
}
Minimal test - lines (569, 572)
path: .spaces[26].metrics.mi.mi_visual_studio
old: 76.86305434314004
new: 73.55682051328075
path: .spaces[26].metrics.mi.mi_sei
old: 114.02277779900194
new: 105.86627077189092
path: .spaces[26].metrics.mi.mi_original
old: 131.43582292676948
new: 125.7821630777101
path: .spaces[26].metrics.loc.ploc
old: 3.0
new: 4.0
path: .spaces[26].metrics.loc.sloc
old: 3.0
new: 4.0
path: .spaces[26].metrics.nargs.average
old: 1.0
new: 2.0
path: .spaces[26].metrics.nargs.sum
old: 1.0
new: 2.0
path: .spaces[26].metrics.halstead.length
old: 17.0
new: 20.0
path: .spaces[26].metrics.halstead.N1
old: 10.0
new: 12.0
path: .spaces[26].metrics.halstead.n2
old: 5.0
new: 6.0
path: .spaces[26].metrics.halstead.difficulty
old: 5.6
new: 5.333333333333333
path: .spaces[26].metrics.halstead.effort
old: 352.28186116703193
new: 406.1178583528111
path: .spaces[26].metrics.halstead.vocabulary
old: 13.0
new: 14.0
path: .spaces[26].metrics.halstead.purity_ratio
old: 2.0946847337904004
new: 1.975488750216347
path: .spaces[26].metrics.halstead.bugs
old: 0.016626682361242505
new: 0.018280166067772708
path: .spaces[26].metrics.halstead.time
old: 19.571214509279553
new: 22.56210324182284
path: .spaces[26].metrics.halstead.volume
old: 62.907475208398566
new: 76.14709844115208
path: .spaces[26].metrics.halstead.N2
old: 7.0
new: 8.0
path: .spaces[26].metrics.halstead.estimated_program_length
old: 35.60964047443681
new: 39.50977500432694
path: .spaces[26].metrics.halstead.level
old: 0.17857142857142858
new: 0.1875
Code
nsOfflineCacheUpdateService::OfflineAppAllowed(nsIPrincipal* aPrincipal,
bool* aAllowed) {
return OfflineAppPermForPrincipal(aPrincipal, false, aAllowed);
}
Minimal test - lines (421, 451)
path: .spaces[20].metrics.loc.cloc
old: 0.0
new: 3.0
path: .spaces[20].metrics.loc.lloc
old: 1.0
new: 11.0
path: .spaces[20].metrics.loc.sloc
old: 4.0
new: 31.0
path: .spaces[20].metrics.loc.blank
old: 0.0
new: 6.0
path: .spaces[20].metrics.loc.ploc
old: 4.0
new: 22.0
path: .spaces[20].metrics.mi.mi_original
old: 125.39425724332408
new: 81.10997598646682
path: .spaces[20].metrics.mi.mi_sei
old: 105.30664094829032
new: 64.79614921081314
path: .spaces[20].metrics.mi.mi_visual_studio
old: 73.32997499609597
new: 47.43273449500984
path: .spaces[20].metrics.cognitive.average
old: 0.0
new: 3.0
path: .spaces[20].metrics.cognitive.sum
old: 0.0
new: 3.0
path: .spaces[20].metrics.halstead.difficulty
old: 6.75
new: 14.444444444444445
path: .spaces[20].metrics.halstead.purity_ratio
old: 2.0971000008241782
new: 1.5846213685808597
path: .spaces[20].metrics.halstead.n1
old: 9.0
new: 15.0
path: .spaces[20].metrics.halstead.time
old: 30.766763440417087
new: 510.60585966312465
path: .spaces[20].metrics.halstead.vocabulary
old: 15.0
new: 42.0
path: .spaces[20].metrics.halstead.effort
old: 553.8017419275076
new: 9190.905473936244
path: .spaces[20].metrics.halstead.bugs
old: 0.022479239973047977
new: 0.1462573201421246
path: .spaces[20].metrics.halstead.length
old: 21.0
new: 118.0
path: .spaces[20].metrics.halstead.level
old: 0.14814814814814814
new: 0.06923076923076923
path: .spaces[20].metrics.halstead.estimated_program_length
old: 44.039100017307746
new: 186.98532149254143
path: .spaces[20].metrics.halstead.n2
old: 6.0
new: 27.0
path: .spaces[20].metrics.halstead.N2
old: 9.0
new: 52.0
path: .spaces[20].metrics.halstead.N1
old: 12.0
new: 66.0
path: .spaces[20].metrics.halstead.volume
old: 82.0447025077789
new: 636.2934558878937
path: .spaces[20].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[20].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[20].metrics.nargs.sum
old: 2.0
new: 7.0
path: .spaces[20].metrics.nargs.average
old: 2.0
new: 7.0
Code
nsresult nsOfflineCacheUpdateService::Schedule(
nsIURI* aManifestURI, nsIURI* aDocumentURI, nsIPrincipal* aLoadingPrincipal,
Document* aDocument, nsPIDOMWindowInner* aWindow,
nsIFile* aCustomProfileDir, nsIOfflineCacheUpdate** aUpdate) {
nsCOMPtr update;
if (GeckoProcessType_Default != XRE_GetProcessType()) {
update = new OfflineCacheUpdateChild(aWindow);
} else {
update = new OfflineCacheUpdateGlue();
}
nsresult rv;
if (aWindow) {
// Ensure there is window.applicationCache object that is
// responsible for association of the new applicationCache
// with the corresponding document. Just ignore the result.
aWindow->GetApplicationCache();
}
rv = update->Init(aManifestURI, aDocumentURI, aLoadingPrincipal, aDocument,
aCustomProfileDir);
NS_ENSURE_SUCCESS(rv, rv);
rv = update->Schedule();
NS_ENSURE_SUCCESS(rv, rv);
NS_ADDREF(*aUpdate = update);
return NS_OK;
}
Minimal test - lines (497, 505)
path: .spaces[24].metrics.nargs.average
old: 1.0
new: 3.0
path: .spaces[24].metrics.nargs.sum
old: 1.0
new: 3.0
path: .spaces[24].metrics.loc.ploc
old: 3.0
new: 8.0
path: .spaces[24].metrics.loc.lloc
old: 1.0
new: 5.0
path: .spaces[24].metrics.loc.sloc
old: 3.0
new: 9.0
path: .spaces[24].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[24].metrics.halstead.n2
old: 5.0
new: 14.0
path: .spaces[24].metrics.halstead.level
old: 0.17857142857142858
new: 0.10980392156862744
path: .spaces[24].metrics.halstead.n1
old: 8.0
new: 15.0
path: .spaces[24].metrics.halstead.time
old: 19.571214509279553
new: 113.06372435088576
path: .spaces[24].metrics.halstead.purity_ratio
old: 2.0946847337904004
new: 2.432746257455092
path: .spaces[24].metrics.halstead.N2
old: 7.0
new: 17.0
path: .spaces[24].metrics.halstead.vocabulary
old: 13.0
new: 29.0
path: .spaces[24].metrics.halstead.length
old: 17.0
new: 46.0
path: .spaces[24].metrics.halstead.bugs
old: 0.016626682361242505
new: 0.05353148281427934
path: .spaces[24].metrics.halstead.effort
old: 352.28186116703193
new: 2035.1470383159435
path: .spaces[24].metrics.halstead.estimated_program_length
old: 35.60964047443681
new: 111.90632784293425
path: .spaces[24].metrics.halstead.N1
old: 10.0
new: 29.0
path: .spaces[24].metrics.halstead.volume
old: 62.907475208398566
new: 223.4671257758683
path: .spaces[24].metrics.halstead.difficulty
old: 5.6
new: 9.107142857142858
path: .spaces[24].metrics.cognitive.average
old: 0.0
new: 3.0
path: .spaces[24].metrics.cognitive.sum
old: 0.0
new: 3.0
path: .spaces[24].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[24].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[24].metrics.mi.mi_visual_studio
old: 76.86305434314004
new: 62.33145462528467
path: .spaces[24].metrics.mi.mi_original
old: 131.43582292676948
new: 106.58678740923678
path: .spaces[24].metrics.mi.mi_sei
old: 114.02277779900194
new: 78.37683720579274
Code
nsOfflineCacheUpdateService::Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* aData) {
if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
if (mUpdates.Length() > 0) mUpdates[0]->Cancel();
mDisabled = true;
}
return NS_OK;
}
Minimal test - lines (384, 419)
path: .spaces[19].metrics.halstead.N1
old: 12.0
new: 80.0
path: .spaces[19].metrics.halstead.estimated_program_length
old: 44.039100017307746
new: 252.9035678365762
path: .spaces[19].metrics.halstead.n2
old: 6.0
new: 33.0
path: .spaces[19].metrics.halstead.difficulty
old: 6.75
new: 19.39393939393939
path: .spaces[19].metrics.halstead.effort
old: 553.8017419275076
new: 15996.519669471045
path: .spaces[19].metrics.halstead.length
old: 21.0
new: 144.0
path: .spaces[19].metrics.halstead.purity_ratio
old: 2.0971000008241782
new: 1.7562747766428903
path: .spaces[19].metrics.halstead.volume
old: 82.0447025077789
new: 824.8205454571006
path: .spaces[19].metrics.halstead.N2
old: 9.0
new: 64.0
path: .spaces[19].metrics.halstead.time
old: 30.766763440417087
new: 888.6955371928357
path: .spaces[19].metrics.halstead.vocabulary
old: 15.0
new: 53.0
path: .spaces[19].metrics.halstead.bugs
old: 0.022479239973047977
new: 0.21162277981436584
path: .spaces[19].metrics.halstead.level
old: 0.14814814814814814
new: 0.0515625
path: .spaces[19].metrics.halstead.n1
old: 9.0
new: 20.0
path: .spaces[19].metrics.cyclomatic.sum
old: 1.0
new: 5.0
path: .spaces[19].metrics.cyclomatic.average
old: 1.0
new: 5.0
path: .spaces[19].metrics.nargs.average
old: 2.0
new: 4.0
path: .spaces[19].metrics.nargs.sum
old: 2.0
new: 4.0
path: .spaces[19].metrics.loc.blank
old: 0.0
new: 7.0
path: .spaces[19].metrics.loc.lloc
old: 1.0
new: 13.0
path: .spaces[19].metrics.loc.ploc
old: 4.0
new: 28.0
path: .spaces[19].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[19].metrics.loc.sloc
old: 4.0
new: 36.0
path: .spaces[19].metrics.cognitive.average
old: 0.0
new: 6.0
path: .spaces[19].metrics.cognitive.sum
old: 0.0
new: 6.0
path: .spaces[19].metrics.mi.mi_visual_studio
old: 73.32997499609597
new: 44.95797123890645
path: .spaces[19].metrics.mi.mi_sei
old: 105.30664094829032
new: 48.486923437269
path: .spaces[19].metrics.mi.mi_original
old: 125.39425724332408
new: 76.87813081853004
path: .spaces[19].metrics.nexits.average
old: 1.0
new: 2.0
path: .spaces[19].metrics.nexits.sum
old: 1.0
new: 2.0
Code
nsresult nsOfflineCacheUpdateService::FindUpdate(
nsIURI* aManifestURI, nsACString const& aOriginSuffix,
nsIFile* aCustomProfileDir, nsOfflineCacheUpdate** aUpdate) {
nsresult rv;
nsCOMPtr cacheService =
do_GetService(NS_APPLICATIONCACHESERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString groupID;
rv =
cacheService->BuildGroupIDForSuffix(aManifestURI, aOriginSuffix, groupID);
NS_ENSURE_SUCCESS(rv, rv);
RefPtr update;
for (uint32_t i = 0; i < mUpdates.Length(); i++) {
update = mUpdates[i];
bool partial;
rv = update->GetPartial(&partial);
NS_ENSURE_SUCCESS(rv, rv);
if (partial) {
// Partial updates aren't considered
continue;
}
if (update->IsForGroupID(groupID) &&
update->IsForProfile(aCustomProfileDir)) {
update.swap(*aUpdate);
return NS_OK;
}
}
return NS_ERROR_NOT_AVAILABLE;
}
Minimal test - lines (318, 335)
path: .spaces[15].metrics.halstead.length
old: 17.0
new: 63.0
path: .spaces[15].metrics.halstead.level
old: 0.17857142857142858
new: 0.08735632183908046
path: .spaces[15].metrics.halstead.n2
old: 5.0
new: 19.0
path: .spaces[15].metrics.halstead.estimated_program_length
old: 35.60964047443681
new: 139.3139816895559
path: .spaces[15].metrics.halstead.vocabulary
old: 13.0
new: 34.0
path: .spaces[15].metrics.halstead.bugs
old: 0.016626682361242505
new: 0.07929461933927795
path: .spaces[15].metrics.halstead.time
old: 19.571214509279553
new: 203.8332151527274
path: .spaces[15].metrics.halstead.difficulty
old: 5.6
new: 11.447368421052632
path: .spaces[15].metrics.halstead.volume
old: 62.907475208398566
new: 320.5101589987714
path: .spaces[15].metrics.halstead.N1
old: 10.0
new: 34.0
path: .spaces[15].metrics.halstead.N2
old: 7.0
new: 29.0
path: .spaces[15].metrics.halstead.n1
old: 8.0
new: 15.0
path: .spaces[15].metrics.halstead.purity_ratio
old: 2.0946847337904004
new: 2.2113330426913635
path: .spaces[15].metrics.halstead.effort
old: 352.28186116703193
new: 3668.9978727490934
path: .spaces[15].metrics.cyclomatic.sum
old: 1.0
new: 2.0
path: .spaces[15].metrics.cyclomatic.average
old: 1.0
new: 2.0
path: .spaces[15].metrics.mi.mi_original
old: 131.43582292676948
new: 93.71242486142944
path: .spaces[15].metrics.mi.mi_sei
old: 114.02277779900194
new: 77.55563274655853
path: .spaces[15].metrics.mi.mi_visual_studio
old: 76.86305434314004
new: 54.80258763826284
path: .spaces[15].metrics.loc.ploc
old: 3.0
new: 13.0
path: .spaces[15].metrics.loc.sloc
old: 3.0
new: 18.0
path: .spaces[15].metrics.loc.blank
old: 0.0
new: 4.0
path: .spaces[15].metrics.loc.cloc
old: 0.0
new: 1.0
path: .spaces[15].metrics.loc.lloc
old: 1.0
new: 7.0
path: .spaces[15].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[15].metrics.cognitive.sum
old: 0.0
new: 1.0
Code
nsresult nsOfflineCacheUpdateService::UpdateFinished(
nsOfflineCacheUpdate* aUpdate) {
LOG(("nsOfflineCacheUpdateService::UpdateFinished [%p, update=%p]", this,
aUpdate));
NS_ASSERTION(mUpdates.Length() > 0 && mUpdates[0] == aUpdate,
"Unknown update completed");
// keep this item alive until we're done notifying observers
RefPtr update = mUpdates[0];
Unused << update;
mUpdates.RemoveElementAt(0);
mUpdateRunning = false;
ProcessNextUpdate();
return NS_OK;
}
Minimal test - lines (341, 356)
path: .spaces[16].metrics.mi.mi_original
old: 124.91740347654104
new: 96.6327608614548
path: .spaces[16].metrics.mi.mi_sei
old: 104.6186863837232
new: 64.11803232783505
path: .spaces[16].metrics.mi.mi_visual_studio
old: 73.05111314417604
new: 56.51038646868701
path: .spaces[16].metrics.halstead.time
old: 35.684199407741055
new: 117.64435680762637
path: .spaces[16].metrics.halstead.bugs
old: 0.024814815683571648
new: 0.05496773162444412
path: .spaces[16].metrics.halstead.purity_ratio
old: 2.403216609239857
new: 1.752408968163232
path: .spaces[16].metrics.halstead.N1
old: 12.0
new: 33.0
path: .spaces[16].metrics.halstead.length
old: 22.0
new: 52.0
path: .spaces[16].metrics.halstead.n2
old: 7.0
new: 13.0
path: .spaces[16].metrics.halstead.vocabulary
old: 17.0
new: 25.0
path: .spaces[16].metrics.halstead.level
old: 0.14
new: 0.11403508771929824
path: .spaces[16].metrics.halstead.difficulty
old: 7.142857142857143
new: 8.76923076923077
path: .spaces[16].metrics.halstead.N2
old: 10.0
new: 19.0
path: .spaces[16].metrics.halstead.volume
old: 89.92418250750745
new: 241.48052186828568
path: .spaces[16].metrics.halstead.n1
old: 10.0
new: 12.0
path: .spaces[16].metrics.halstead.effort
old: 642.315589339339
new: 2117.5984225372745
path: .spaces[16].metrics.halstead.estimated_program_length
old: 52.87076540327685
new: 91.12526634448808
path: .spaces[16].metrics.cyclomatic.sum
old: 1.0
new: 4.0
path: .spaces[16].metrics.cyclomatic.average
old: 1.0
new: 4.0
path: .spaces[16].metrics.cognitive.average
old: 0.0
new: 3.0
path: .spaces[16].metrics.cognitive.sum
old: 0.0
new: 3.0
path: .spaces[16].metrics.loc.ploc
old: 4.0
new: 11.0
path: .spaces[16].metrics.loc.blank
old: 0.0
new: 5.0
path: .spaces[16].metrics.loc.sloc
old: 4.0
new: 16.0
path: .spaces[16].metrics.loc.lloc
old: 1.0
new: 9.0
path: .spaces[16].metrics.nexits.sum
old: 1.0
new: 4.0
path: .spaces[16].metrics.nexits.average
old: 1.0
new: 4.0
Code
nsresult nsOfflineCacheUpdateService::ProcessNextUpdate() {
LOG(("nsOfflineCacheUpdateService::ProcessNextUpdate [%p, num=%zu]", this,
mUpdates.Length()));
if (mDisabled) return NS_ERROR_ABORT;
if (mUpdateRunning) return NS_OK;
if (mUpdates.Length() > 0) {
mUpdateRunning = true;
return mUpdates[0]->Begin();
}
return NS_OK;
}
Minimal test - lines (254, 264)
path: .spaces[11].metrics.nargs.average
old: 1.0
new: 0.0
path: .spaces[11].metrics.nargs.sum
old: 1.0
new: 0.0
path: .spaces[11].metrics.halstead.vocabulary
old: 11.0
new: 26.0
path: .spaces[11].metrics.halstead.time
old: 15.135013331538175
new: 138.4018361452655
path: .spaces[11].metrics.halstead.length
old: 15.0
new: 53.0
path: .spaces[11].metrics.halstead.bugs
old: 0.01400819850161732
new: 0.06125689553736768
path: .spaces[11].metrics.halstead.N1
old: 9.0
new: 33.0
path: .spaces[11].metrics.halstead.volume
old: 51.89147427955946
new: 249.12330506147785
path: .spaces[11].metrics.halstead.effort
old: 272.43023996768716
new: 2491.2330506147787
path: .spaces[11].metrics.halstead.purity_ratio
old: 1.8434322969602153
new: 1.8153100504088375
path: .spaces[11].metrics.halstead.level
old: 0.1904761904761905
new: 0.1
path: .spaces[11].metrics.halstead.n1
old: 7.0
new: 13.0
path: .spaces[11].metrics.halstead.estimated_program_length
old: 27.651484454403228
new: 96.2114326716684
path: .spaces[11].metrics.halstead.N2
old: 6.0
new: 20.0
path: .spaces[11].metrics.halstead.difficulty
old: 5.25
new: 10.0
path: .spaces[11].metrics.halstead.n2
old: 4.0
new: 13.0
path: .spaces[11].metrics.mi.mi_original
old: 132.43687749961728
new: 102.77076711096154
path: .spaces[11].metrics.mi.mi_sei
old: 115.46699426690871
new: 72.87148364553941
path: .spaces[11].metrics.mi.mi_visual_studio
old: 77.4484663740452
new: 60.09986380757985
path: .spaces[11].metrics.cognitive.average
old: 0.0
new: 3.0
path: .spaces[11].metrics.cognitive.sum
old: 0.0
new: 3.0
path: .spaces[11].metrics.cyclomatic.sum
old: 1.0
new: 3.0
path: .spaces[11].metrics.cyclomatic.average
old: 1.0
new: 3.0
path: .spaces[11].metrics.nexits.average
old: 1.0
new: 2.0
path: .spaces[11].metrics.nexits.sum
old: 1.0
new: 2.0
path: .spaces[11].metrics.loc.lloc
old: 1.0
new: 6.0
path: .spaces[11].metrics.loc.ploc
old: 3.0
new: 10.0
path: .spaces[11].metrics.loc.blank
old: 0.0
new: 1.0
path: .spaces[11].metrics.loc.sloc
old: 3.0
new: 11.0
Code
already_AddRefed
nsOfflineCacheUpdateService::GetInstance() {
if (!gOfflineCacheUpdateService) {
auto serv = MakeRefPtr();
if (NS_FAILED(serv->Init())) serv = nullptr;
MOZ_ASSERT(gOfflineCacheUpdateService == serv.get());
return serv.forget();
}
return do_AddRef(gOfflineCacheUpdateService);
}
Minimal test - lines (575, 581)
path: .spaces[27].metrics.loc.ploc
old: 4.0
new: 7.0
path: .spaces[27].metrics.loc.sloc
old: 4.0
new: 7.0
path: .spaces[27].metrics.mi.mi_original
old: 125.27178399587255
new: 112.76359852557472
path: .spaces[27].metrics.mi.mi_sei
old: 105.12994940155043
new: 87.08445225303234
path: .spaces[27].metrics.mi.mi_visual_studio
old: 73.25835321396058
new: 65.94362486875714
path: .spaces[27].metrics.nargs.sum
old: 0.0
new: 2.0
path: .spaces[27].metrics.nargs.average
old: 0.0
new: 2.0
path: .spaces[27].metrics.halstead.vocabulary
old: 16.0
new: 23.0
path: .spaces[27].metrics.halstead.bugs
old: 0.024496598167132053
new: 0.03752048052956009
path: .spaces[27].metrics.halstead.time
old: 35.0
new: 66.34557535550286
path: .spaces[27].metrics.halstead.estimated_program_length
old: 48.72905595320056
new: 81.07329781366414
path: .spaces[27].metrics.halstead.effort
old: 630.0
new: 1194.2203563990515
path: .spaces[27].metrics.halstead.length
old: 21.0
new: 36.0
path: .spaces[27].metrics.halstead.purity_ratio
old: 2.3204312358666934
new: 2.2520360503795596
path: .spaces[27].metrics.halstead.N2
old: 9.0
new: 16.0
path: .spaces[27].metrics.halstead.N1
old: 12.0
new: 20.0
path: .spaces[27].metrics.halstead.difficulty
old: 7.5
new: 7.333333333333333
path: .spaces[27].metrics.halstead.n1
old: 10.0
new: 11.0
path: .spaces[27].metrics.halstead.n2
old: 6.0
new: 12.0
path: .spaces[27].metrics.halstead.volume
old: 84.0
new: 162.84823041805248
path: .spaces[27].metrics.halstead.level
old: 0.13333333333333333
new: 0.13636363636363638
Code
nsOfflineCacheUpdateService::OfflineAppAllowedForURI(nsIURI* aURI,
bool* aAllowed) {
OriginAttributes attrs;
nsCOMPtr principal =
BasePrincipal::CreateContentPrincipal(aURI, attrs);
return OfflineAppPermForPrincipal(principal, false, aAllowed);
}