зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1202052 - Bypass cache on reload button long press. r=margaret
--HG-- extra : commitid : Jqr0id1curC extra : rebase_source : c1b541e4295f0b516f01d2cb8884cecd9be5f337
This commit is contained in:
Родитель
7edbc38b65
Коммит
0e0121f2cb
|
@ -669,7 +669,7 @@ public class BrowserApp extends GeckoApp
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case KeyEvent.KEYCODE_R:
|
case KeyEvent.KEYCODE_R:
|
||||||
tab.doReload();
|
tab.doReload(false);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case KeyEvent.KEYCODE_PERIOD:
|
case KeyEvent.KEYCODE_PERIOD:
|
||||||
|
@ -3410,7 +3410,7 @@ public class BrowserApp extends GeckoApp
|
||||||
if (itemId == R.id.reload) {
|
if (itemId == R.id.reload) {
|
||||||
tab = Tabs.getInstance().getSelectedTab();
|
tab = Tabs.getInstance().getSelectedTab();
|
||||||
if (tab != null)
|
if (tab != null)
|
||||||
tab.doReload();
|
tab.doReload(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3527,6 +3527,21 @@ public class BrowserApp extends GeckoApp
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemLongClick(MenuItem item) {
|
||||||
|
if (item.getItemId() == R.id.reload) {
|
||||||
|
Tab tab = Tabs.getInstance().getSelectedTab();
|
||||||
|
if (tab != null) {
|
||||||
|
tab.doReload(true);
|
||||||
|
|
||||||
|
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.MENU, "reload_force");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onMenuItemLongClick(item);
|
||||||
|
}
|
||||||
|
|
||||||
public void showGuestModeDialog(final GuestModeDialog type) {
|
public void showGuestModeDialog(final GuestModeDialog type) {
|
||||||
final Prompt ps = new Prompt(this, new Prompt.PromptCallback() {
|
final Prompt ps = new Prompt(this, new Prompt.PromptCallback() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -465,7 +465,7 @@ public class GeckoView extends LayerView
|
||||||
public void reload() {
|
public void reload() {
|
||||||
Tab tab = Tabs.getInstance().getTab(mId);
|
Tab tab = Tabs.getInstance().getTab(mId);
|
||||||
if (tab != null) {
|
if (tab != null) {
|
||||||
tab.doReload();
|
tab.doReload(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -614,8 +614,8 @@ public class Tab {
|
||||||
return mEnteringReaderMode;
|
return mEnteringReaderMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doReload() {
|
public void doReload(boolean bypassCache) {
|
||||||
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Reload", "");
|
GeckoEvent e = GeckoEvent.createBroadcastEvent("Session:Reload", "{\"bypassCache\":" + String.valueOf(bypassCache) + "}");
|
||||||
GeckoAppShell.sendEventToGecko(e);
|
GeckoAppShell.sendEventToGecko(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
package org.mozilla.gecko.menu;
|
package org.mozilla.gecko.menu;
|
||||||
|
|
||||||
import org.mozilla.gecko.AppConstants;
|
import org.mozilla.gecko.AppConstants;
|
||||||
|
import org.mozilla.gecko.GeckoAppShell;
|
||||||
import org.mozilla.gecko.R;
|
import org.mozilla.gecko.R;
|
||||||
import org.mozilla.gecko.util.ThreadUtils;
|
import org.mozilla.gecko.util.ThreadUtils;
|
||||||
import org.mozilla.gecko.util.ThreadUtils.AssertBehavior;
|
import org.mozilla.gecko.util.ThreadUtils.AssertBehavior;
|
||||||
|
@ -256,8 +257,12 @@ public class GeckoMenu extends ListView
|
||||||
});
|
});
|
||||||
((MenuItemActionBar) actionView).setOnLongClickListener(new View.OnLongClickListener() {
|
((MenuItemActionBar) actionView).setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View v) {
|
public boolean onLongClick(View view) {
|
||||||
return handleMenuItemLongClick(menuItem);
|
if (handleMenuItemLongClick(menuItem)) {
|
||||||
|
GeckoAppShell.vibrateOnHapticFeedbackEnabled(getResources().getIntArray(R.array.long_press_vibrate_msec));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (actionView instanceof MenuItemActionView) {
|
} else if (actionView instanceof MenuItemActionView) {
|
||||||
|
@ -270,7 +275,11 @@ public class GeckoMenu extends ListView
|
||||||
((MenuItemActionView) actionView).setMenuItemLongClickListener(new View.OnLongClickListener() {
|
((MenuItemActionView) actionView).setMenuItemLongClickListener(new View.OnLongClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onLongClick(View view) {
|
public boolean onLongClick(View view) {
|
||||||
return handleMenuItemLongClick(menuItem);
|
if (handleMenuItemLongClick(menuItem)) {
|
||||||
|
GeckoAppShell.vibrateOnHapticFeedbackEnabled(getResources().getIntArray(R.array.long_press_vibrate_msec));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -644,12 +653,15 @@ public class GeckoMenu extends ListView
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean handleMenuItemLongClick(GeckoMenuItem item) {
|
boolean handleMenuItemLongClick(GeckoMenuItem item) {
|
||||||
if(!item.isEnabled()) {
|
if (!item.isEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mCallback != null) {
|
if (mCallback != null) {
|
||||||
return mCallback.onMenuItemLongClick(item);
|
if (mCallback.onMenuItemLongClick(item)) {
|
||||||
|
close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1727,6 +1727,11 @@ var BrowserApp = {
|
||||||
// Check to see if this is a message to enable/disable mixed content blocking.
|
// Check to see if this is a message to enable/disable mixed content blocking.
|
||||||
if (aData) {
|
if (aData) {
|
||||||
let data = JSON.parse(aData);
|
let data = JSON.parse(aData);
|
||||||
|
|
||||||
|
if (data.bypassCache) {
|
||||||
|
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.contentType === "tracking") {
|
if (data.contentType === "tracking") {
|
||||||
// Convert document URI into the format used by
|
// Convert document URI into the format used by
|
||||||
// nsChannelClassifier::ShouldEnableTrackingProtection
|
// nsChannelClassifier::ShouldEnableTrackingProtection
|
||||||
|
|
Загрузка…
Ссылка в новой задаче