Closed Bug 1198970 Opened 5 years ago Closed 5 years ago

Get WebExtensions background pages to work on b2g

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set

Tracking

(firefox43 fixed)

RESOLVED FIXED
FxOS-S6 (04Sep)
Tracking Status
firefox43 --- fixed

People

(Reporter: fabrice, Assigned: fabrice)

References

Details

Attachments

(1 file)

While investigating the test failures in bug 1190330 I got another crash:

Program received signal SIGSEGV, Segmentation fault.
0xb42e75de in mozilla::OriginAttributes::CreateSuffix (this=0x9f38080c, aStr=...) at /home/fabrice/dev/b2g-inbound/caps/BasePrincipal.cpp:55
55	    MOZ_RELEASE_ASSERT(mAddonId.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) == kNotFound);
(gdb) bt
#0  0xb42e75de in mozilla::OriginAttributes::CreateSuffix (this=0x9f38080c, aStr=...) at /home/fabrice/dev/b2g-inbound/caps/BasePrincipal.cpp:55
#1  0xb42e778a in mozilla::BasePrincipal::GetOriginSuffix (this=<optimized out>, aOriginAttributes=...) at /home/fabrice/dev/b2g-inbound/caps/BasePrincipal.cpp:313
#2  0xb4a68d1a in PrincipalToScopeKey (aKey=..., aPrincipal=0x9f380800) at /home/fabrice/dev/b2g-inbound/dom/workers/ServiceWorkerManager.cpp:3246
#3  mozilla::dom::workers::ServiceWorkerManager::PrincipalToScopeKey (aPrincipal=0x9f380800, aKey=...)
    at /home/fabrice/dev/b2g-inbound/dom/workers/ServiceWorkerManager.cpp:3237
#4  0xb4a7a182 in mozilla::dom::workers::ServiceWorkerManager::GetServiceWorkerRegistrationInfo (this=this@entry=0xa957c200, aPrincipal=0x9f380800, 
    aURI=0x9f8e1530) at /home/fabrice/dev/b2g-inbound/dom/workers/ServiceWorkerManager.cpp:3179
#5  0xb4a7a24e in mozilla::dom::workers::ServiceWorkerManager::GetServiceWorkerRegistrationInfo (this=this@entry=0xa957c200, aDoc=aDoc@entry=0xa3dbf000)
    at /home/fabrice/dev/b2g-inbound/dom/workers/ServiceWorkerManager.cpp:3163
#6  0xb4a7a276 in mozilla::dom::workers::ServiceWorkerManager::MaybeStartControlling (this=0xa957c200, aDoc=0xa3dbf000)
    at /home/fabrice/dev/b2g-inbound/dom/workers/ServiceWorkerManager.cpp:3395
#7  0xb448a044 in nsDocument::SetScriptGlobalObject (this=0xa3dbf000, aScriptGlobalObject=0x9f8cd23c) at /home/fabrice/dev/b2g-inbound/dom/base/nsDocument.cpp:4750
#8  0xb442085c in nsGlobalWindow::SetNewDocument (this=0x9f8cc510, aDocument=0xa3dbf000, aState=0x0, aForceReuseInnerWindow=<optimized out>)
    at ../../../../b2g-inbound/dom/base/nsGlobalWindow.cpp:2664
#9  0xb4c34526 in nsDocumentViewer::InitInternal (this=0x9f8e1320, aParentWidget=<optimized out>, aState=aState@entry=0x0, aBounds=..., 
    aDoCreation=aDoCreation@entry=true, aNeedMakeCX=aNeedMakeCX@entry=true, aForceSetNewDocument=aForceSetNewDocument@entry=true)
    at /home/fabrice/dev/b2g-inbound/layout/base/nsDocumentViewer.cpp:881
#10 0xb4c34906 in nsDocumentViewer::Init (this=<optimized out>, aParentWidget=<optimized out>, aBounds=...)
    at /home/fabrice/dev/b2g-inbound/layout/base/nsDocumentViewer.cpp:621
#11 0xb4d95d1c in nsDocShell::SetupNewViewer (this=this@entry=0xa04ae400, aNewViewer=aNewViewer@entry=0x9f8e1320)
    at /home/fabrice/dev/b2g-inbound/docshell/base/nsDocShell.cpp:9077
#12 0xb4d9b49e in nsDocShell::Embed (this=this@entry=0xa04ae400, aContentViewer=0x9f8e1320, aCommand=<optimized out>, aExtraInfo=aExtraInfo@entry=0x0)
    at /home/fabrice/dev/b2g-inbound/docshell/base/nsDocShell.cpp:6978
#13 0xb4d9df14 in nsDocShell::CreateContentViewer (this=0xa04ae400, aContentType=..., aRequest=aRequest@entry=0xa04900a8, 
    aContentHandler=aContentHandler@entry=0x9f855fe0) at /home/fabrice/dev/b2g-inbound/docshell/base/nsDocShell.cpp:8885
#14 0xb4da3b28 in DoContent (aAbortProcess=0xbe9ec30f, aContentHandler=0x9f855fe0, aRequest=0xa04900a8, aIsContentPreferred=<optimized out>, aContentType=..., 
    this=0x9f8b8670) at /home/fabrice/dev/b2g-inbound/docshell/base/nsDSURIContentListener.cpp:129
#15 nsDSURIContentListener::DoContent (this=0x9f8b8670, aContentType=..., aIsContentPreferred=<optimized out>, aRequest=0xa04900a8, aContentHandler=0x9f855fe0, 
    aAbortProcess=0xbe9ec30f) at /home/fabrice/dev/b2g-inbound/docshell/base/nsDSURIContentListener.cpp:78
#16 0xb42d5e28 in nsDocumentOpenInfo::TryContentListener (this=this@entry=0x9f855fd0, aListener=0x9f8b8670, aChannel=0xa04900a8)
    at /home/fabrice/dev/b2g-inbound/uriloader/base/nsURILoader.cpp:725
#17 0xb42d5fec in nsDocumentOpenInfo::DispatchContent (this=this@entry=0x9f855fd0, request=request@entry=0xa04900a8, aCtxt=aCtxt@entry=0x0)
    at /home/fabrice/dev/b2g-inbound/uriloader/base/nsURILoader.cpp:398
#18 0xb42d671a in OnStartRequest (aCtxt=0x0, request=0xa04900a8, this=0x9f855fd0) at /home/fabrice/dev/b2g-inbound/uriloader/base/nsURILoader.cpp:259
#19 nsDocumentOpenInfo::OnStartRequest (this=0x9f855fd0, request=0xa04900a8, aCtxt=0x0) at /home/fabrice/dev/b2g-inbound/uriloader/base/nsURILoader.cpp:200
#20 0xb3fd67f8 in nsBaseChannel::OnStartRequest (this=0xa0490080, request=<optimized out>, ctxt=<optimized out>)
    at /home/fabrice/dev/b2g-inbound/netwerk/base/nsBaseChannel.cpp:788
#21 0xb3fe39ec in nsInputStreamPump::OnStateStart (this=this@entry=0x9f8ffa00) at /home/fabrice/dev/b2g-inbound/netwerk/base/nsInputStreamPump.cpp:527
#22 0xb3fe3f8e in nsInputStreamPump::OnInputStreamReady (this=0x9f8ffa00, stream=<optimized out>)
    at /home/fabrice/dev/b2g-inbound/netwerk/base/nsInputStreamPump.cpp:429
Blocks: addons25
Ok, so we crash because mAddonId is "https://people.mozilla.org/~fdesre/extensions/webrequest/update.webapp" and contains characters from dom::quota::QuotaManager::kReplaceChars
Bill, these are the minimal changes to get background pages to work on b2g. That doesn't fix the webRequest issues yet, but that's useful on its own.

Most of the changes are due to the different scope/global behavior on b2g due to jsloader.reuseGlobal being true.
Attachment #8653661 - Flags: review?(wmccloskey)
Comment on attachment 8653661 [details] [diff] [review]
background-page.patch

Review of attachment 8653661 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for this. Sorry I was wrong about the IDs.
Attachment #8653661 - Flags: review?(wmccloskey) → review+
https://hg.mozilla.org/mozilla-central/rev/4e5e7b50bc48
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S6 (04Sep)
Depends on: 1209091
You need to log in before you can comment on or make changes to this bug.