Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Added documentation.
Browse files Browse the repository at this point in the history
Minor change to filtering tabs.
Implicitly use the error parameter.
  • Loading branch information
Brandon-T committed Jul 12, 2019
1 parent cf96e9a commit 0068fb5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Client/Frontend/Browser/ResourceDownloadManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ResourceDownloadManager: TabContentScript {
do {
let response = try DownloadedResourceResponse.from(message: message)
tab?.temporaryDocument?.onDocumentDownloaded(document: response, error: nil)
} catch let error {
} catch {
tab?.temporaryDocument?.onDocumentDownloaded(document: nil, error: error)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Client/Frontend/Browser/TabManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ class TabManager: NSObject {
if tab.isPrivate {
// Only when ALL tabs are dead, we clean up.
// This is because other tabs share the same data-store.
if allTabs.filter({ $0.isPrivate }).count <= 1 {
if tabsForCurrentMode.count <= 1 {
removeAllBrowsingDataForTab(tab)
}
}
Expand Down
4 changes: 4 additions & 0 deletions Client/Frontend/Browser/UserScriptManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ class UserScriptManager {
return nil
}
var alteredSource: String = source

//Verify that the application itself is making a call to the JS script instead of other scripts on the page.
//This variable will be unique amongst scripts loaded in the page.
//When the script is called, the token is provided in order to access teh script variable.
let token = UserScriptManager.securityToken.uuidString.replacingOccurrences(of: "-", with: "", options: .literal)
alteredSource = alteredSource.replacingOccurrences(of: "$<downloadManager>", with: "D\(token)", options: .literal)

Expand Down

0 comments on commit 0068fb5

Please sign in to comment.