Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 function onNewResultView(event)
7 {
8 dump("onNewResultView\n");
9 const db = runItem.prototype.kDatabase;
10 const kXalan = runItem.prototype.kXalan;
11 var index = view.boxObject.view.selection.currentIndex;
12 var res = view.builder.getResourceAtIndex(index);
13 var name = db.GetTarget(res, krTypeName, true);
14 if (!name) {
15 return false;
16 }
17 var cat = db.GetTarget(res, krTypeCat, true);
18 var path = db.GetTarget(res, krTypePath, true);
19 cat = cat.QueryInterface(nsIRDFLiteral);
20 name = name.QueryInterface(nsIRDFLiteral);
21 path = path.QueryInterface(nsIRDFLiteral);
22 xalan_fl = kXalan.resolve(cat.Value+"/"+path.Value);
23 xalan_ref = kXalan.resolve(cat.Value+"-gold/"+path.Value);
24 var currentResultItem = new Object();
25 currentResultItem.testpath = xalan_fl;
26 currentResultItem.refpath = xalan_ref;
27 var currentRunItem = itemCache.getItem(res);
28 // XXX todo, keep a list of these windows, so that we can close them.
29 resultWin = window.openDialog('result-view.xul','_blank',
30 'chrome,resizable,dialog=no',
31 currentResultItem, currentRunItem);
32 return true;
33 }
35 var refInspector;
36 var resInspector;
38 function onResultViewLoad(event)
39 {
40 dump("onResultViewLoad\n");
41 aResultItem = window.arguments[0];
42 aRunItem = window.arguments[1];
43 var loadFlags = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
44 document.getElementById('src').webNavigation.loadURI('view-source:'+
45 aResultItem.testpath+'.xml', loadFlags, null, null, null);
46 document.getElementById('style').webNavigation.loadURI('view-source:'+
47 aResultItem.testpath+'.xsl', loadFlags, null, null, null);
49 if (aRunItem && aRunItem.mRefDoc && aRunItem.mResDoc) {
50 document.getElementById("refSourceBox").setAttribute("class", "hidden");
51 refInspector = new ObjectApp();
52 refInspector.initialize("refInsp", aRunItem.mRefDoc);
53 resInspector = new ObjectApp();
54 resInspector.initialize("resInsp", aRunItem.mResDoc);
55 }
56 else {
57 document.getElementById("inspectorBox").setAttribute("class", "hidden");
58 document.getElementById('ref').webNavigation.loadURI('view-source:'+
59 aResultItem.refpath+'.out', loadFlags, null, null, null);
60 }
61 return true;
62 }
64 function onResultViewUnload(event)
65 {
66 dump("onResultUnload\n");
67 }
69 function ObjectApp()
70 {
71 }
73 ObjectApp.prototype =
74 {
75 mDoc: null,
76 mPanelSet: null,
78 initialize: function(aId, aDoc)
79 {
80 this.mDoc = aDoc;
81 this.mPanelSet = document.getElementById(aId).contentDocument.getElementById("bxPanelSet");
82 this.mPanelSet.addObserver("panelsetready", this, false);
83 this.mPanelSet.initialize();
84 },
86 doViewerCommand: function(aCommand)
87 {
88 this.mPanelSet.execCommand(aCommand);
89 },
91 getViewer: function(aUID)
92 {
93 return this.mPanelSet.registry.getViewerByUID(aUID);
94 },
96 onEvent: function(aEvent)
97 {
98 switch (aEvent.type) {
99 case "panelsetready":
100 {
101 this.mPanelSet.getPanel(0).subject = this.mDoc;
102 }
103 }
104 }
105 };