Closed Bug 1188623 Opened 9 years ago Closed 9 years ago

Crash in FaviconFetcher when loading favicon for error page

Categories

(Firefox for iOS :: Favicons, defect)

All
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
fxios + ---

People

(Reporter: rnewman, Assigned: rnewman)

References

(Depends on 1 open bug)

Details

(Keywords: crash)

* Launch. See localhost:58404/errors/undefined.
* Tap URL bar.
* Get EXC_BAD_ACCESS inside RXMLElement iterate:usingBlock:.

        return fetchDataForUrl(url).bind({ result -> Deferred<Result<[Favicon]>> in
            var icons = [Favicon]()

            if let data = result.successValue,
               let element = RXMLElement(fromHTMLData: data) {
                var reloadUrl: NSURL? = nil
                element.iterate("head.meta") { meta in
                    if let refresh = meta.attribute("http-equiv") where refresh == "Refresh",
                        let content = meta.attribute("content"),
                        let index = content.rangeOfString("URL="),
                        let url = NSURL(string: content.substringFromIndex(advance(index.startIndex,4))) {
                            reloadUrl = url
                    }
                }


Notably `result` is `Failure`, but the debugger thinks that `data` is an `NSMutableData`, and apparently we're inside this block.

We should not be attempting to load favicons for localhost URLs.

* thread #18: tid = 0x10f1d56, 0x00000001048d3b39 Client`-[RXMLElement iterate:usingBlock:](self=0x00007fea71dcdb40, _cmd=0x0000000104b341cf, query=0x00007fea71ef2620, blk=0x00007fea71eae620) + 889 at RXMLElement.m:490, queue = 'com.apple.root.default-qos', stop reason = EXC_BAD_ACCESS (code=1, address=0x18)
  * frame #0: 0x00000001048d3b39 Client`-[RXMLElement iterate:usingBlock:](self=0x00007fea71dcdb40, _cmd=0x0000000104b341cf, query=0x00007fea71ef2620, blk=0x00007fea71eae620) + 889 at RXMLElement.m:490
    frame #1: 0x0000000104aa18e7 Client`Client.FaviconFetcher.(result=Failure, self=0x00007fea74177af0, url=0x00007fea74178080) (Client.FaviconFetcher) -> (ObjectiveC.NSURL) -> Shared.Deferred<Shared.Result<Swift.Array<Storage.Favicon>>>).(closure #1) + 1511 at FaviconFetcher.swift:100
    frame #2: 0x000000010537a5d9 Shared`Shared.Deferred.($0=0x00007fea74087d40, f=0x0000000104a75990 Client`partial apply forwarder for Client.FaviconFetcher.((parseHTMLForFavicons in _629638589BC523C89B47D10DC6C6420A) (Client.FaviconFetcher) -> (ObjectiveC.NSURL) -> Shared.Deferred<Shared.Result<Swift.Array<Storage.Favicon>>>).(closure #1) at <unknown>, queue=0x0000000109dcad00, d=0x00007fea7416f530) -> <B>(ObjectiveC.NSObject, f : (A) -> Shared.Deferred<B>) -> Shared.Deferred<B>).(closure #1) + 153 at Deferred.swift:94
    frame #3: 0x0000000105373428 Shared`reabstraction thunk helper <T_0_0> from @callee_owned (@in T_0_0) -> (@unowned ()) to @callee_owned (@in T_0_0) -> (@out ()) + 24 at <unknown>:0
    frame #4: 0x000000010536e501 Shared`partial apply forwarder for reabstraction thunk helper <T_0_0> from @callee_owned (@in T_0_0) -> (@unowned ()) to @callee_owned (@in T_0_0) -> (@out ()) with unmangled suffix "226" + 97 at <unknown>:0
    frame #5: 0x0000000105374034 Shared`reabstraction thunk helper <T_0_0> from @callee_owned (@in T_0_0) -> (@out ()) to @callee_owned (@in T_0_0) -> (@unowned ()) + 36 at <unknown>:0
    frame #6: 0x0000000105379936 Shared`Shared.Deferred.(block=0x000000010536e160 Shared`partial apply forwarder for reabstraction thunk helper <T_0_0> from @callee_owned (@in T_0_0) -> (@out ()) to @callee_owned (@in T_0_0) -> (@unowned ()) with unmangled suffix "214" at <unknown>, filledValue=0x00007fea7408c1b0) <A>(Shared.Deferred<A>) -> (A, assertIfFilled : Swift.Bool) -> ()).(closure #2) + 118 at Deferred.swift:44
    frame #7: 0x000000010536fc77 Shared`reabstraction thunk helper from @callee_owned () -> (@unowned ()) to @callee_unowned @objc_block () -> (@unowned ()) + 39 at <unknown>:0
Depends on: 1188626
Depends on: 1188632
Assignee: nobody → etoop
Status: NEW → ASSIGNED
This should be fixed by one of the checks I added in Bug 1188626 (in particular the isValid check on the RXMLElement), but please take a second look, Emily!
Assignee: etoop → nobody
Status: ASSIGNED → NEW
Assignee: nobody → rnewman
I'll close this out if I don't see it again after my fixes in the dependencies.
Status: NEW → ASSIGNED
Flags: needinfo?(rnewman)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Flags: needinfo?(rnewman)
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.