Closed Bug 1649611 Opened 4 years ago Closed 3 years ago

DownloadIntegration.jsm imports OS.File during startup

Categories

(Toolkit Graveyard :: OS.File, task)

Tracking

(firefox87 fixed)

RESOLVED FIXED
87 Branch
Tracking Status
firefox87 --- fixed

People

(Reporter: barret, Assigned: emmamalysz)

References

(Regressed 1 open bug)

Details

Attachments

(1 file)

According to this startup profile, DownloadIntegration.jsm runs during startup and imports osfile.jsm. We should migrate this to the new IOUtils replacement for osfile.jsm when possible.

Stack:

(root) []
XREMain::XRE_main []
XREMain::XRE_main(int, char**, mozilla::BootstrapConfig const&) [libxul.so]
XREMain::XRE_mainRun() [libxul.so]
nsAppStartup::Run() [libxul.so]
nsBaseAppShell::Run() [libxul.so]
MessageLoop::Run() [libxul.so]
mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) [libxul.so]
nsThread::ProcessNextEvent(bool, bool*) [libxul.so]
mozilla::ipc::MessageChannel::MessageTask::Run() [libxul.so]
mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message&&) [libxul.so]
mozilla::ipc::PBackgroundChild::OnMessageReceived(IPC::Message const&) [libxul.so]
PBackgroundIDBRequest::Msg___delete__ []
mozilla::dom::indexedDB::PBackgroundIDBRequestChild::OnMessageReceived(IPC::Message const&) [libxul.so]
mozilla::dom::indexedDB::BackgroundRequestChild::Recv__delete__(mozilla::dom::indexedDB::RequestResponse&&) [libxul.so]
IndexedDB:SetResultAndDispatchSuccessEvent []
mozilla::dom::indexedDB::BackgroundRequestChild::HandleResponse(mozilla::dom::indexedDB::SerializedStructuredCloneReadInfo&&) [libxul.so]
mozilla::dom::indexedDB::(anonymous namespace)::detail::DispatchSuccessEvent(RefPtr<mozilla::dom::IDBRequest> const&, mozilla::SafeRefPtr<mozilla::dom::IDBTransaction> const&, RefPtr<mozilla::dom::Event> const&) [libxul.so]
mozilla::dom::EventTarget::DispatchEvent(mozilla::dom::Event&, mozilla::ErrorResult&) [libxul.so]
mozilla::DOMEventTargetHelper::DispatchEvent(mozilla::dom::Event&, mozilla::dom::CallerType, mozilla::ErrorResult&) [libxul.so]
mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*) [libxul.so]
EventDispatcher::Dispatch []
EventDispatcher::Dispatch success []
mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) [libxul.so]
mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) [libxul.so]
mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) [libxul.so]
<name omitted> [libxul.so]
promise callback []
mozilla::PromiseJobRunnable::Run(mozilla::AutoSlowOperation&) [libxul.so]
mozilla::dom::PromiseJobCallback::Call(mozilla::dom::BindingCallContext&, JS::Handle<JS::Value>, mozilla::ErrorResult&) [libxul.so]
JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>) [libxul.so]
js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [libxul.so]
PromiseReactionJob(JSContext*, unsigned int, JS::Value*) [libxul.so]
AsyncFunctionResume(JSContext*, JS::Handle<js::AsyncFunctionGeneratorObject*>, ResumeKind, JS::Handle<JS::Value>) [libxul.so]
js::CallSelfHostedFunction(JSContext*, JS::Handle<js::PropertyName*>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>) [libxul.so]
js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) [libxul.so]
js::RunScript []
js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [libxul.so]
AsyncFunctionNext [self-hosted:688:26]
0xff4eaa5ea9f []
js::jit::InterpretResume(JSContext*, JS::Handle<JSObject*>, JS::Value*, JS::MutableHandle<JS::Value>) [libxul.so]
js::CallSelfHostedFunction(JSContext*, JS::Handle<js::PropertyName*>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>) [libxul.so]
js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>, js::CallReason) [libxul.so]
js::RunScript []
InterpretGeneratorResume [self-hosted:1146:33]
initializePublicDownloadList [resource://gre/modules/DownloadIntegration.jsm:231:36]
> loadPublicDownloadListFromStore [resource://gre/modules/DownloadIntegration.jsm:260:39]
js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [libxul.so]
Interpret(JSContext*, js::RunState&) [libxul.so]
js::NativeGetExistingProperty(JSContext*, JS::Handle<JSObject*>, JS::Handle<js::NativeObject*>, JS::Handle<js::Shape*>, JS::MutableHandle<JS::Value>) [libxul.so]
js::CallGetter(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::MutableHandle<JS::Value>) [libxul.so]
js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) [libxul.so]
mozilla::dom::module_getter::ModuleGetter(JSContext*, unsigned int, JS::Value*) [libxul.so]
mozJSComponentLoader::Import(JSContext*, nsTSubstring<char> const&, JS::MutableHandle<JSObject*>, JS::MutableHandle<JSObject*>, bool) [libxul.so]
profiler_get_backtrace() [libxul.so]
Registers::SyncPopulate() [libxul.so]
No longer depends on: 1649610
Depends on: 1671035
Depends on: 1673019
Depends on: 1673038
No longer depends on: 1673038
Depends on: 1674311
Depends on: 1678415
Assignee: nobody → emalysz
Status: NEW → ASSIGNED
Pushed by emalysz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/79484a596fa1
Remove OS.File usage from DownloadIntegration.jsm r=barret

Backed out for failures on test_DownloadCore.js

backout: https://hg.mozilla.org/integration/autoland/rev/29f93c17253e2fd3118ba85bfaf0427e4610c192

push: https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&selectedTaskRun=ObV0zR8YSY6QMSzz08ZX0g.0&revision=79484a596fa19aee7e02fb39a4616e45c547a5d0

failure log: https://treeherder.mozilla.org/logviewer?job_id=324784345&repo=autoland&lineNumber=4057

[task 2020-12-17T05:41:02.032Z] 05:41:02 INFO - TEST-START | toolkit/components/downloads/test/unit/test_DownloadCore.js
[task 2020-12-17T05:41:02.415Z] 05:41:02 WARNING - TEST-UNEXPECTED-FAIL | toolkit/components/downloads/test/unit/test_DownloadCore.js | xpcshell return code: 0
[task 2020-12-17T05:41:02.416Z] 05:41:02 INFO - TEST-INFO took 382ms
[task 2020-12-17T05:41:02.416Z] 05:41:02 INFO - >>>>>>>

Flags: needinfo?(emalysz)

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:emalysz, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(emalysz)
Flags: needinfo?(emalysz)
Attachment #9193143 - Attachment description: Bug 1649611: Remove OS.File usage from DownloadIntegration.jsm → Bug 1649611: Remove OS.File usage from DownloadIntegration.jsm and respect umask in IOUtils::SetPermissions
Pushed by emalysz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/43f2f5614583
Remove OS.File usage from DownloadIntegration.jsm and respect umask in IOUtils::SetPermissions r=barret
Pushed by emalysz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4934ec1fbb6f
Remove OS.File usage from DownloadIntegration.jsm and respect umask in IOUtils::SetPermissions r=barret
Backout by malexandru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/33f255475ce3
Backed out changeset 4934ec1fbb6f for causing xpcshell failures in test_DownloadCore.js
Pushed by emalysz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c89276392499
Remove OS.File usage from DownloadIntegration.jsm and respect umask in IOUtils::SetPermissions r=barret
Pushed by emalysz@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c7dd9e63300d
Remove OS.File usage from DownloadIntegration.jsm and respect umask in IOUtils::SetPermissions r=barret
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
Flags: needinfo?(emalysz)
Regressions: 1689404
Status: RESOLVED → REOPENED
Flags: needinfo?(emalysz)
Resolution: FIXED → ---
Target Milestone: 87 Branch → ---
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/91181a01b68c
Remove OS.File usage from DownloadIntegration.jsm and respect umask in IOUtils::SetPermissions r=barret
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/aadba76932ea
Remove OS.File usage from DownloadIntegration.jsm and respect umask in IOUtils::SetPermissions r=barret
Status: REOPENED → RESOLVED
Closed: 3 years ago3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
Flags: needinfo?(emalysz)
Regressions: 1696958
Regressions: 1714583

Did this cause a regression on Windows, that temporary files opened using "Open With" are not read-only anymore (see bug 1095893, bug 1009465), even though 'browser.helperApps.deleteTempFileOnExit' is true, and are opened read-write (see e.g. https://bugs.documentfoundation.org/show_bug.cgi?id=146642 for LibreOffice)?

This patch did not change how we compute the mode, but the mode changing code from OS.File to IOUtils. There are currently automated test to check that IOUtils.setPermissions works correctly on windows and I opened up a terminal to double check:

>> await IOUtils.writeUTF8("C:\\t\\txt.txt", "")
0
>> await IOUtils.setPermissions("C:\\t\\txt.txt", 0o400)
undefined
>> await IOUtils.getWindowsAttributes("C:\\t\\txt.txt")
Object { hidden: false, readOnly: true, system: false }
>> await IOUtils.stat("C:\\t\\txt.txt")
Object { creationTime: 1641835572456, lastModified: 1641835572456, path: "C:\\t\\txt.txt", permissions: 292, size: 0, type: "regular" }

Perhaps this is due to bug 1726858, which changed the logic for download permissions?

Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: