Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: mobile/android/chrome/content/browser.js

Issue 29606596: Issue 6032 - Page not added to the Reading List (Closed)
Patch Set: Created Nov. 13, 2017, 10:23 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 // -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2- skip-preprocessor-directives: t; -*- 1 // -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2- skip-preprocessor-directives: t; -*-
2 /* This Source Code Form is subject to the terms of the Mozilla Public 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 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/. */ 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 "use strict"; 5 "use strict";
6 6
7 var Cc = Components.classes; 7 var Cc = Components.classes;
8 var Ci = Components.interfaces; 8 var Ci = Components.interfaces;
9 var Cu = Components.utils; 9 var Cu = Components.utils;
10 var Cr = Components.results; 10 var Cr = Components.results;
(...skipping 4332 matching lines...) Expand 10 before | Expand all | Expand 10 after
4343 // Note: going 'back' will not make this tab pinned again 4343 // Note: going 'back' will not make this tab pinned again
4344 ss.deleteTabValue(this, "appOrigin"); 4344 ss.deleteTabValue(this, "appOrigin");
4345 } 4345 }
4346 } 4346 }
4347 4347
4348 // Update the page actions URI for helper apps. 4348 // Update the page actions URI for helper apps.
4349 if (BrowserApp.selectedTab == this) { 4349 if (BrowserApp.selectedTab == this) {
4350 ExternalApps.updatePageActionUri(fixedURI); 4350 ExternalApps.updatePageActionUri(fixedURI);
4351 } 4351 }
4352 4352
4353 // Strip reader mode URI and also make it exposable if needed
4354 fixedURI = this._stripAboutReaderURL(fixedURI);
4355
4356 let webNav = contentWin.QueryInterface(Ci.nsIInterfaceRequestor).getInterfac e(Ci.nsIWebNavigation); 4353 let webNav = contentWin.QueryInterface(Ci.nsIInterfaceRequestor).getInterfac e(Ci.nsIWebNavigation);
4357 4354
4358 let message = { 4355 let message = {
4359 type: "Content:LocationChange", 4356 type: "Content:LocationChange",
4360 tabID: this.id, 4357 tabID: this.id,
4361 uri: truncate(fixedURI.spec, MAX_URI_LENGTH), 4358 uri: truncate(fixedURI.spec, MAX_URI_LENGTH),
4362 userRequested: this.userRequested || "", 4359 userRequested: this.userRequested || "",
4363 baseDomain: baseDomain, 4360 baseDomain: baseDomain,
4364 contentType: (contentType ? contentType : ""), 4361 contentType: (contentType ? contentType : ""),
4365 sameDocument: sameDocument, 4362 sameDocument: sameDocument,
(...skipping 10 matching lines...) Expand all
4376 4373
4377 if (!sameDocument) { 4374 if (!sameDocument) {
4378 // XXX This code assumes that this is the earliest hook we have at which 4375 // XXX This code assumes that this is the earliest hook we have at which
4379 // browser.contentDocument is changed to the new document we're loading 4376 // browser.contentDocument is changed to the new document we're loading
4380 this.contentDocumentIsDisplayed = false; 4377 this.contentDocumentIsDisplayed = false;
4381 this.hasTouchListener = false; 4378 this.hasTouchListener = false;
4382 Services.obs.notifyObservers(this.browser, "Session:NotifyLocationChange", null); 4379 Services.obs.notifyObservers(this.browser, "Session:NotifyLocationChange", null);
4383 } 4380 }
4384 }, 4381 },
4385 4382
4386 _stripAboutReaderURL: function (originalURI) {
4387 try {
4388 let strippedURL = ReaderMode.getOriginalUrl(originalURI.spec);
4389 if(strippedURL){
4390 // Continue to create exposable uri if original uri is stripped.
4391 originalURI = URIFixup.createExposableURI(Services.io.newURI(strippedURL ));
4392 }
4393 } catch (ex) { }
4394 return originalURI;
4395 },
4396
4397 // Properties used to cache security state used to update the UI 4383 // Properties used to cache security state used to update the UI
4398 _state: null, 4384 _state: null,
4399 _hostChanged: false, // onLocationChange will flip this bit 4385 _hostChanged: false, // onLocationChange will flip this bit
4400 4386
4401 onSecurityChange: function(aWebProgress, aRequest, aState) { 4387 onSecurityChange: function(aWebProgress, aRequest, aState) {
4402 // Don't need to do anything if the data we use to update the UI hasn't chan ged 4388 // Don't need to do anything if the data we use to update the UI hasn't chan ged
4403 if (this._state == aState && !this._hostChanged) 4389 if (this._state == aState && !this._hostChanged)
4404 return; 4390 return;
4405 4391
4406 this._state = aState; 4392 this._state = aState;
(...skipping 2698 matching lines...) Expand 10 before | Expand all | Expand 10 after
7105 disabled: elt.disabled, 7091 disabled: elt.disabled,
7106 menu: elt instanceof Ci.nsIDOMHTMLMenuElement 7092 menu: elt instanceof Ci.nsIDOMHTMLMenuElement
7107 }; 7093 };
7108 } 7094 }
7109 }, 7095 },
7110 }); 7096 });
7111 7097
7112 let {AdblockPlusApi} = Cu.import("chrome://adblockplus/content/Api.jsm"); 7098 let {AdblockPlusApi} = Cu.import("chrome://adblockplus/content/Api.jsm");
7113 AdblockPlusApi.initCommunication(); 7099 AdblockPlusApi.initCommunication();
7114 7100
OLDNEW

Powered by Google App Engine
This is Rietveld