Closed Bug 142165 Opened 23 years ago Closed 23 years ago

Don't serialize 'http://host/file.xul' and 'file:///c:/file.xul' [@ js_XDRScript]

Categories

(Core :: XUL, defect)

x86
Windows 2000
defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: jrgmorrison, Assigned: bugs)

References

Details

Attachments

(1 file, 2 obsolete files)

With the xul-fastload serialization changes that landed last night, we are now serializing 'file:///c:/somefile.xul' and 'http://host/somefile.xul'. A subsequent attempt to load the same resource crashes, even for the minimal xul file. <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window xmlns:html="http://www.w3.org/1999/xhtml" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <text value="Some value"/> </window> The crash is in DOM code, checking property access restrictions, but the fix is that resources other than 'chrome://' (and resource:// ??) should not be serialized into the XUL cache. This needs fixing ASAP, since any remote xul will now crash a trunk build. JSDOM! `string' + 47 bytes nsWindowSH::AddProperty() XPC_WN_Helper_AddProperty() js_DefineNativeProperty() js_DefineProperty() js_DefineFunction() JS_DefineFunction() nsWindowSH::GlobalResolve() nsWindowSH::NewResolve() XPC_WN_Helper_NewResolve() js_LookupProperty() js_GetProperty() JS_GetProperty() nsDOMClassInfo::PostCreate() XPCWrappedNative::GetNewOrUsed() XPCConvert::NativeInterface2JSObject() nsXPConnect::WrapNative() nsDOMClassInfo::WrapNative() nsNodeSH::PreCreate() XPCWrappedNative::GetNewOrUsed() XPCConvert::NativeInterface2JSObject() nsXPConnect::WrapNative() nsDOMClassInfo::WrapNative() nsNodeSH::PreCreate() XPCWrappedNative::GetNewOrUsed() XPCConvert::NativeInterface2JSObject() nsXPConnect::WrapNative() nsXBLProtoImpl::InitTargetObjects() nsXBLProtoImpl::InstallImplementation() nsXBLPrototypeBinding::InstallImplementation() nsXBLBinding::InstallImplementation() nsXBLBinding::InstallImplementation() nsXBLService::LoadBindings() nsCSSFrameConstructor::ConstructFrameInternal() nsCSSFrameConstructor::ConstructFrame() nsCSSFrameConstructor::CreateAnonymousFrames() nsCSSFrameConstructor::CreateAnonymousFrames() nsCSSFrameConstructor::ConstructDocElementFrame() nsCSSFrameConstructor::ContentInserted() StyleSetImpl::ContentInserted() PresShell::InitialReflow() nsXULDocument::StartLayout() nsXULDocument::ResumeWalk() nsXULDocument::CachedChromeStreamListener::OnStopRequest() nsDocumentOpenInfo::OnStopRequest() nsStreamListenerTee::OnStopRequest() nsHttpChannel::OnStopRequest() nsOnStopRequestEvent::HandleEvent() PL_HandleEvent() PL_ProcessPendingEvents() _md_EventReceiverProc() nsAppShellService::Run() main1() main() WinMain() MOZILLA! WinMainCRTStartup + 308 bytes KERNEL32!
*** Bug 142026 has been marked as a duplicate of this bug. ***
Darnit, where'd we lose the IsChromeURI predicate safeguard that JS-in-XUL fastload had? Ben, see the old fastload code in nsXULDocument.cpp, search for IsChromeURI. /be
Oops. Patch in a sec.
Attached patch patch (obsolete) — Splinter Review
I'm building now on my PIII-500, so that'll take about an hr. I'm attaching what I think is the patch anyway, so someone with a current build may wish to test.
okay, on my win2k trunk build from 2am last night, with ben's patch applied, I no longer crash when loading http://, file://, or ftp:// url's for XUL files. Inspection of the XUL.mfl on win2k shows that these resources are not being deserialized into the fastload file anymore. So, let's move forward on getting this landed tonight to fix the crash. However, there's still something wrong: 1) delete XUL.mfl 2) start mozilla; quit; XUL.mfl is about 934973 Bytes 3) start mozilla; quit; XUL.mfl is still the same 4) start mozilla; do View->Page Info'; quit; XUL.mfl expands to 1037729 Bytes and updates timestamp 5) start mozilla; quit; XUL.mfl is not modified 6) Here's the problem ... start mozilla; load file:///c:/crash.xul which is any XUL disk file. quit. XUL.mfl does not changes size, but the timestamp changes 7) start mozilla; XUL.mfl is invalidated (truncated to 0 and then reinitialized with navigator.xul and friends to 934973 Bytes). Seems that loaded non-chrome XUL is setting up the fastload file for failure on next startup.
Sounds like nsIFastLoadService::AddDependency is being called for crash.xul even though it is not loaded via a chrome: URL. Ben, can you debug and verify that? if so, we need an IsChromeURI test in nsChromeProtocolHandler.cpp, which seems like it should not be necessary -- but jrgm's stack trace here shows a chrome cache hit for non-chrome: XUL. What's up with that? /be
Attached patch better patch (obsolete) — Splinter Review
Fix the invalidation problem jrgm mentions.
Comment on attachment 82320 [details] [diff] [review] better patch sr=brendan@mozilla.org. I noticed that nsXULPrototypeCache::GetPrototype calls PutPrototype even if protoDoc->Read failed. That's wrong, the cache should not be filled with a badly-read protoDoc. Ben, can you fix that here too. /be
Attachment #82320 - Flags: superreview+
Attachment #82310 - Attachment is obsolete: true
Comment on attachment 82576 [details] [diff] [review] patch to prevent putting bad prototype into cache r=blake
Attachment #82576 - Flags: review+
Fixed.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
thanks ben! you dabomb.
Keywords: nsbeta1
Attachment #82576 - Flags: superreview+
*** Bug 142804 has been marked as a duplicate of this bug. ***
*** Bug 142916 has been marked as a duplicate of this bug. ***
updating the stack trace in the summary to make it easier for folks to find dups of this bug.
Summary: Don't serialize 'http://host/file.xul' and 'file:///c:/file.xul' → Don't serialize 'http://host/file.xul' and 'file:///c:/file.xul' [@ js_XDRScript]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: