зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to mozilla-inbound
This commit is contained in:
Коммит
7177a36cde
|
@ -274,7 +274,6 @@ var gPrivacyPane = {
|
|||
document.getElementById("offlineAppsList")
|
||||
.style.height = bundlePrefs.getString("offlineAppsList.height");
|
||||
let offlineGroup = document.getElementById("offlineGroup");
|
||||
offlineGroup.hidden = false;
|
||||
offlineGroup.removeAttribute("data-hidden-from-search");
|
||||
}
|
||||
|
||||
|
@ -295,7 +294,6 @@ var gPrivacyPane = {
|
|||
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "storage-permissions";
|
||||
document.getElementById("siteDataLearnMoreLink").setAttribute("href", url);
|
||||
let siteDataGroup = document.getElementById("siteDataGroup");
|
||||
siteDataGroup.hidden = false;
|
||||
siteDataGroup.removeAttribute("data-hidden-from-search");
|
||||
}
|
||||
|
||||
|
|
|
@ -950,26 +950,6 @@ ChannelMediaResource::CacheClientSeek(int64_t aOffset, bool aResume)
|
|||
return OpenChannel(nullptr);
|
||||
}
|
||||
|
||||
void
|
||||
ChannelMediaResource::FlushCache()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
|
||||
// Ensure that data in the cache's partial block is written to disk.
|
||||
mCacheStream.FlushPartialBlock();
|
||||
}
|
||||
|
||||
void
|
||||
ChannelMediaResource::NotifyLastByteRange()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
|
||||
|
||||
// Tell media cache that the last data has been downloaded.
|
||||
// Note: subsequent seeks will require re-opening the channel etc.
|
||||
mCacheStream.NotifyDataEnded(NS_OK);
|
||||
|
||||
}
|
||||
|
||||
nsresult
|
||||
ChannelMediaResource::CacheClientSuspend()
|
||||
{
|
||||
|
|
|
@ -160,9 +160,6 @@ public:
|
|||
// the main thread.
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
// The following can be called on the main thread only:
|
||||
// Get the URI
|
||||
virtual nsIURI* URI() const { return nullptr; }
|
||||
// Close the resource, stop any listeners, channels, etc.
|
||||
// Cancels any currently blocking Read request and forces that request to
|
||||
// return an error.
|
||||
|
@ -314,23 +311,11 @@ public:
|
|||
*/
|
||||
virtual nsresult GetCachedRanges(MediaByteRangeSet& aRanges) = 0;
|
||||
|
||||
// Ensure that the media cache writes any data held in its partial block.
|
||||
// Called on the main thread only.
|
||||
virtual void FlushCache() { }
|
||||
|
||||
// Notify that the last data byte range was loaded.
|
||||
virtual void NotifyLastByteRange() { }
|
||||
|
||||
// Returns the container content type of the resource. This is copied from the
|
||||
// nsIChannel when the MediaResource is created. Safe to call from
|
||||
// any thread.
|
||||
virtual const MediaContainerType& GetContentType() const = 0;
|
||||
|
||||
// Return true if the stream is a live stream
|
||||
virtual bool IsRealTime() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns true if the resource is a live stream.
|
||||
virtual bool IsLiveStream()
|
||||
{
|
||||
|
@ -345,8 +330,6 @@ public:
|
|||
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
const nsCString& GetContentURL() const { return EmptyCString(); }
|
||||
|
||||
protected:
|
||||
virtual ~MediaResource() {};
|
||||
|
||||
|
@ -356,7 +339,6 @@ private:
|
|||
|
||||
class BaseMediaResource : public MediaResource {
|
||||
public:
|
||||
nsIURI* URI() const override { return mURI; }
|
||||
void SetLoadInBackground(bool aLoadInBackground) override;
|
||||
|
||||
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
|
||||
|
@ -377,12 +359,6 @@ public:
|
|||
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
|
||||
}
|
||||
|
||||
// Returns the url of the resource. Safe to call from any thread?
|
||||
const nsCString& GetContentURL() const
|
||||
{
|
||||
return mContentURL;
|
||||
}
|
||||
|
||||
protected:
|
||||
BaseMediaResource(MediaResourceCallback* aCallback,
|
||||
nsIChannel* aChannel,
|
||||
|
@ -394,7 +370,6 @@ protected:
|
|||
mContainerType(aContainerType),
|
||||
mLoadInBackground(false)
|
||||
{
|
||||
mURI->GetSpec(mContentURL);
|
||||
}
|
||||
virtual ~BaseMediaResource()
|
||||
{
|
||||
|
@ -429,9 +404,6 @@ protected:
|
|||
// is safe.
|
||||
const MediaContainerType mContainerType;
|
||||
|
||||
// Copy of the url of the channel resource.
|
||||
nsCString mContentURL;
|
||||
|
||||
// True if SetLoadInBackground() has been called with
|
||||
// aLoadInBackground = true, i.e. when the document load event is not
|
||||
// blocked by this resource, and all channel loads will be in the
|
||||
|
@ -533,13 +505,6 @@ public:
|
|||
|
||||
void ThrottleReadahead(bool bThrottle) override;
|
||||
|
||||
// Ensure that the media cache writes any data held in its partial block.
|
||||
// Called on the main thread.
|
||||
void FlushCache() override;
|
||||
|
||||
// Notify that the last data byte range was loaded.
|
||||
void NotifyLastByteRange() override;
|
||||
|
||||
// Main thread
|
||||
nsresult Open(nsIStreamListener** aStreamListener) override;
|
||||
nsresult Close() override;
|
||||
|
|
|
@ -18,7 +18,6 @@ public:
|
|||
explicit MockMediaResource(const char* aFileName,
|
||||
const MediaContainerType& aMimeType =
|
||||
MediaContainerType(MEDIAMIMETYPE("video/mp4")));
|
||||
nsIURI* URI() const override { return nullptr; }
|
||||
nsresult Close() override { return NS_OK; }
|
||||
void Suspend(bool aCloseImmediately) override {}
|
||||
void Resume() override {}
|
||||
|
|
|
@ -8,4 +8,4 @@ files after the copy step.
|
|||
|
||||
The upstream repository is https://git.xiph.org/opus.git
|
||||
|
||||
The git tag/revision used was v1.2-rc1.
|
||||
The git tag/revision used was v1.2.
|
||||
|
|
|
@ -20,7 +20,7 @@ ALLOW_COMPILER_WARNINGS = True
|
|||
FINAL_LIBRARY = 'gkmedias'
|
||||
|
||||
DEFINES['OPUS_BUILD'] = True
|
||||
DEFINES['OPUS_VERSION'] = '"v1.2-rc1-mozilla"'
|
||||
DEFINES['OPUS_VERSION'] = '"v1.2-mozilla"'
|
||||
DEFINES['USE_ALLOCA'] = True
|
||||
|
||||
# Don't export symbols
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
diff --git a/silk/tables_NLSF_CB_WB.c b/silk/tables_NLSF_CB_WB.c
|
||||
index a15f7eb..5cc9f57 100644
|
||||
--- a/silk/tables_NLSF_CB_WB.c
|
||||
+++ b/silk/tables_NLSF_CB_WB.c
|
||||
@@ -98,7 +98,7 @@ static const opus_uint8 silk_NLSF_CB1_WB_Q8[ 512 ] = {
|
||||
110, 119, 129, 141, 175, 198, 218, 237
|
||||
};
|
||||
|
||||
-static const opus_int16 silk_NLSF_CB1_Wght_Q9[ 512 ] = {
|
||||
+static const opus_int16 silk_NLSF_CB1_WB_Wght_Q9[ 512 ] = {
|
||||
3657, 2925, 2925, 2925, 2925, 2925, 2925, 2925, 2925, 2925, 2925, 2925, 2963, 2963, 2925, 2846,
|
||||
3216, 3085, 2972, 3056, 3056, 3010, 3010, 3010, 2963, 2963, 3010, 2972, 2888, 2846, 2846, 2726,
|
||||
3920, 4014, 2981, 3207, 3207, 2934, 3056, 2846, 3122, 3244, 2925, 2846, 2620, 2553, 2780, 2925,
|
||||
@@ -223,7 +223,7 @@ const silk_NLSF_CB_struct silk_NLSF_CB_WB =
|
||||
SILK_FIX_CONST( 0.15, 16 ),
|
||||
SILK_FIX_CONST( 1.0 / 0.15, 6 ),
|
||||
silk_NLSF_CB1_WB_Q8,
|
||||
- silk_NLSF_CB1_Wght_Q9,
|
||||
+ silk_NLSF_CB1_WB_Wght_Q9,
|
||||
silk_NLSF_CB1_iCDF_WB,
|
||||
silk_NLSF_PRED_WB_Q8,
|
||||
silk_NLSF_CB2_SELECT_WB,
|
|
@ -57,11 +57,13 @@ celt_am_sources_arm_asm = [
|
|||
]
|
||||
|
||||
celt_sources_arm_neon_intr = [
|
||||
'celt/arm/celt_ne10_fft.c',
|
||||
'celt/arm/celt_ne10_mdct.c',
|
||||
'celt/arm/celt_neon_intr.c',
|
||||
'celt/arm/pitch_neon_intr.c',
|
||||
'CELT_SOURCES_ARM_NE10=',
|
||||
]
|
||||
|
||||
celt_sources_arm_ne10 = [
|
||||
'celt/arm/celt_ne10_fft.c',
|
||||
'celt/arm/celt_ne10_mdct.c',
|
||||
]
|
||||
|
||||
opus_sources = [
|
||||
|
|
|
@ -233,6 +233,9 @@ void tonality_get_info(TonalityAnalysisState *tonal, AnalysisInfo *info_out, int
|
|||
int pos;
|
||||
int curr_lookahead;
|
||||
float psum;
|
||||
float tonality_max;
|
||||
float tonality_avg;
|
||||
int tonality_count;
|
||||
int i;
|
||||
|
||||
pos = tonal->read_pos;
|
||||
|
@ -252,6 +255,8 @@ void tonality_get_info(TonalityAnalysisState *tonal, AnalysisInfo *info_out, int
|
|||
if (pos<0)
|
||||
pos = DETECT_SIZE-1;
|
||||
OPUS_COPY(info_out, &tonal->info[pos], 1);
|
||||
tonality_max = tonality_avg = info_out->tonality;
|
||||
tonality_count = 1;
|
||||
/* If possible, look ahead for a tone to compensate for the delay in the tone detector. */
|
||||
for (i=0;i<3;i++)
|
||||
{
|
||||
|
@ -260,8 +265,11 @@ void tonality_get_info(TonalityAnalysisState *tonal, AnalysisInfo *info_out, int
|
|||
pos = 0;
|
||||
if (pos == tonal->write_pos)
|
||||
break;
|
||||
info_out->tonality = MAX32(0, -.03f + MAX32(info_out->tonality, tonal->info[pos].tonality-.05f));
|
||||
tonality_max = MAX32(tonality_max, tonal->info[pos].tonality);
|
||||
tonality_avg += tonal->info[pos].tonality;
|
||||
tonality_count++;
|
||||
}
|
||||
info_out->tonality = MAX32(tonality_avg/tonality_count, tonality_max-.2f);
|
||||
tonal->read_subframe += len/(tonal->Fs/400);
|
||||
while (tonal->read_subframe>=8)
|
||||
{
|
||||
|
@ -362,9 +370,9 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
|
|||
|
||||
if (tonal->count<4) {
|
||||
if (tonal->application == OPUS_APPLICATION_VOIP)
|
||||
tonal->music_prob = .1;
|
||||
tonal->music_prob = .1f;
|
||||
else
|
||||
tonal->music_prob = .625;
|
||||
tonal->music_prob = .625f;
|
||||
}
|
||||
kfft = celt_mode->mdct.kfft[0];
|
||||
if (tonal->count==0)
|
||||
|
@ -695,7 +703,7 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
|
|||
frame_stationarity /= NB_TBANDS;
|
||||
relativeE /= NB_TBANDS;
|
||||
if (tonal->count<10)
|
||||
relativeE = .5;
|
||||
relativeE = .5f;
|
||||
frame_noisiness /= NB_TBANDS;
|
||||
#if 1
|
||||
info->activity = frame_noisiness + (1-frame_noisiness)*relativeE;
|
||||
|
@ -825,9 +833,9 @@ static void tonality_analysis(TonalityAnalysisState *tonal, const CELTMode *celt
|
|||
if (tonal->count==1)
|
||||
{
|
||||
if (tonal->application == OPUS_APPLICATION_VOIP)
|
||||
tonal->pmusic[0] = .1;
|
||||
tonal->pmusic[0] = .1f;
|
||||
else
|
||||
tonal->pmusic[0] = .625;
|
||||
tonal->pmusic[0] = .625f;
|
||||
tonal->pspeech[0] = 1-tonal->pmusic[0];
|
||||
}
|
||||
/* Updated probability of having only speech (s0) or only music (m0),
|
||||
|
|
|
@ -75,4 +75,3 @@ python gen-sources.py $1
|
|||
|
||||
# apply outstanding local patches
|
||||
patch -p3 < nonunified.patch
|
||||
patch -p1 < rename.patch
|
||||
|
|
|
@ -36,6 +36,10 @@ android {
|
|||
targetCompatibility JavaVersion.VERSION_1_7
|
||||
}
|
||||
|
||||
aaptOptions {
|
||||
cruncherEnabled = false
|
||||
}
|
||||
|
||||
dexOptions {
|
||||
javaMaxHeapSize "2g"
|
||||
jumboMode = true
|
||||
|
@ -137,6 +141,12 @@ android {
|
|||
srcDir "${topsrcdir}/mobile/android/search/java"
|
||||
srcDir "${topsrcdir}/mobile/android/services/src/main/java"
|
||||
|
||||
// These aren't included in moz.build builds, for reasons unknown.
|
||||
exclude "org/mozilla/gecko/dlc/CleanupAction.java"
|
||||
// This is a marker file for linting. We can probably find
|
||||
// other ways to achieve this once we're Gradle-only.
|
||||
exclude "org/mozilla/gecko/util/UnusedResourcesUtil.java"
|
||||
|
||||
if (mozconfig.substs.MOZ_ANDROID_MLS_STUMBLER) {
|
||||
srcDir "${topsrcdir}/mobile/android/stumbler/java"
|
||||
}
|
||||
|
@ -544,3 +554,17 @@ android.applicationVariants.all { variant ->
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Bug 1355625: strip extra .class files from Gradle builds; modified from
|
||||
// http://stackoverflow.com/a/40705699.
|
||||
android.applicationVariants.all { variant ->
|
||||
variant.javaCompile.doLast {
|
||||
// BuildConfig is not part of release builds, but it is required by the
|
||||
// local unit tests of the android-test job. Since the debug buildType
|
||||
// is overloaded as the release type (see comments above), we have to
|
||||
// keep the BuildConfig for testing.
|
||||
// delete fileTree(dir: "${project.buildDir}", include: '**/org/mozilla/gecko/BuildConfig.class')
|
||||
delete fileTree(dir: "${project.buildDir}", include: '**/org/mozilla/gecko/Manifest.class')
|
||||
delete fileTree(dir: "${project.buildDir}", include: '**/org/mozilla/gecko/Manifest$permission.class')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -449,23 +449,18 @@ ANDROID_AAPT_IGNORE := !.svn:!.git:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc
|
|||
# removes the target file if any recipe command fails.
|
||||
|
||||
define aapt_command
|
||||
$(1): $$(call mkdir_deps,$(filter-out ./,$(dir $(3) $(4) $(5)))) $(2)
|
||||
$(1): $(topsrcdir)/python/mozbuild/mozbuild/action/aapt_package.py $$(call mkdir_deps,$(filter-out ./,$(dir $(3) $(4) $(5)))) $(2)
|
||||
@$$(TOUCH) $$@
|
||||
$$(AAPT) package -f -m \
|
||||
$$(call py_action,aapt_package,-f \
|
||||
-M AndroidManifest.xml \
|
||||
-I $(ANDROID_SDK)/android.jar \
|
||||
$(if $(MOZ_ANDROID_MAX_SDK_VERSION),--max-res-version $(MOZ_ANDROID_MAX_SDK_VERSION),) \
|
||||
--auto-add-overlay \
|
||||
$$(addprefix -S ,$$(ANDROID_RES_DIRS)) \
|
||||
$$(addprefix -A ,$$(ANDROID_ASSETS_DIRS)) \
|
||||
$(if $(ANDROID_EXTRA_PACKAGES),--extra-packages $$(subst $$(NULL) ,:,$$(strip $$(ANDROID_EXTRA_PACKAGES)))) \
|
||||
$$(addprefix -S ,$$(ANDROID_RES_DIRS)) \
|
||||
$(if $(ANDROID_EXTRA_RES_DIRS),$$(addprefix -S ,$$(ANDROID_EXTRA_RES_DIRS))) \
|
||||
--custom-package org.mozilla.gecko \
|
||||
--no-version-vectors \
|
||||
$(if $(ANDROID_EXTRA_PACKAGES),--extra-packages $$(subst $$(NULL) ,:,$$(strip $$(ANDROID_EXTRA_PACKAGES)))) \
|
||||
-F $(3) \
|
||||
-J $(4) \
|
||||
--output-text-symbols $(5) \
|
||||
--ignore-assets "$$(ANDROID_AAPT_IGNORE)"
|
||||
--verbose)
|
||||
endef
|
||||
|
||||
# [Comment 3/3] The first of these rules is used during regular
|
||||
|
|
|
@ -179,9 +179,6 @@ public class BrowserSearch extends HomeFragment
|
|||
// On edit suggestion listener
|
||||
private OnEditSuggestionListener mEditSuggestionListener;
|
||||
|
||||
// Whether the suggestions will fade in when shown
|
||||
private boolean mAnimateSuggestions;
|
||||
|
||||
// Opt-in prompt view for search suggestions
|
||||
private View mSuggestionsOptInPrompt;
|
||||
|
||||
|
@ -933,8 +930,7 @@ public class BrowserSearch extends HomeFragment
|
|||
|
||||
// Show search suggestions and update them
|
||||
if (enabled) {
|
||||
mSuggestionsEnabled = enabled;
|
||||
mAnimateSuggestions = true;
|
||||
mSuggestionsEnabled = true;
|
||||
mAdapter.notifyDataSetChanged();
|
||||
filterSuggestions();
|
||||
}
|
||||
|
@ -1164,13 +1160,7 @@ public class BrowserSearch extends HomeFragment
|
|||
row.setSearchTerm(mSearchTerm);
|
||||
|
||||
final SearchEngine engine = mSearchEngines.get(position);
|
||||
final boolean haveSuggestions = (engine.hasSuggestions() || !mSearchHistorySuggestions.isEmpty());
|
||||
final boolean animate = (mAnimateSuggestions && haveSuggestions);
|
||||
row.updateSuggestions(mSuggestionsEnabled, engine, mSearchHistorySuggestions, animate);
|
||||
if (animate) {
|
||||
// Only animate suggestions the first time they are shown
|
||||
mAnimateSuggestions = false;
|
||||
}
|
||||
row.updateSuggestions(mSuggestionsEnabled, engine, mSearchHistorySuggestions);
|
||||
} else {
|
||||
// Account for the search engines
|
||||
position -= getPrimaryEngineCount();
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.mozilla.gecko.preferences.GeckoPreferences;
|
|||
import org.mozilla.gecko.util.DrawableUtil;
|
||||
import org.mozilla.gecko.util.StringUtils;
|
||||
import org.mozilla.gecko.util.HardwareUtils;
|
||||
import org.mozilla.gecko.widget.AnimatedHeightLayout;
|
||||
import org.mozilla.gecko.widget.FaviconView;
|
||||
import org.mozilla.gecko.widget.FlowLayout;
|
||||
|
||||
|
@ -34,9 +33,9 @@ import android.util.AttributeSet;
|
|||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -45,9 +44,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
class SearchEngineRow extends AnimatedHeightLayout {
|
||||
// Duration for fade-in animation
|
||||
private static final int ANIMATION_DURATION = 250;
|
||||
class SearchEngineRow extends RelativeLayout {
|
||||
|
||||
// Inner views
|
||||
private final FlowLayout mSuggestionView;
|
||||
|
@ -84,7 +81,7 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
|||
private int mMaxSavedSuggestions;
|
||||
private int mMaxSearchSuggestions;
|
||||
|
||||
private final List<Integer> mOccurrences = new ArrayList<Integer>();
|
||||
private final List<Integer> mOccurrences = new ArrayList<>();
|
||||
|
||||
public SearchEngineRow(Context context) {
|
||||
this(context, null);
|
||||
|
@ -268,7 +265,7 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
|||
mEditSuggestionListener = listener;
|
||||
}
|
||||
|
||||
private void bindSuggestionView(String suggestion, boolean animate, int recycledSuggestionCount, Integer previousSuggestionChildIndex, boolean isUserSavedSearch, String telemetryTag) {
|
||||
private void bindSuggestionView(String suggestion, int recycledSuggestionCount, Integer previousSuggestionChildIndex, boolean isUserSavedSearch, String telemetryTag) {
|
||||
final View suggestionItem;
|
||||
|
||||
// Reuse suggestion views from recycled view, if possible.
|
||||
|
@ -287,13 +284,6 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
|||
}
|
||||
|
||||
setSuggestionOnView(suggestionItem, suggestion, isUserSavedSearch);
|
||||
|
||||
if (animate) {
|
||||
AlphaAnimation anim = new AlphaAnimation(0, 1);
|
||||
anim.setDuration(ANIMATION_DURATION);
|
||||
anim.setStartOffset(previousSuggestionChildIndex * ANIMATION_DURATION);
|
||||
suggestionItem.startAnimation(anim);
|
||||
}
|
||||
}
|
||||
|
||||
private void hideRecycledSuggestions(int lastVisibleChildIndex, int recycledSuggestionCount) {
|
||||
|
@ -310,10 +300,9 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
|||
* enforce a ui maximum or filter. It will show all the suggestions in this list.
|
||||
* @param suggestionStartIndex global index of where to start adding suggestion "buttons" in the search engine row. Also
|
||||
* acts as a counter for total number of suggestions visible.
|
||||
* @param animate whether or not to animate suggestions for visual polish
|
||||
* @param recycledSuggestionCount How many suggestion "button" views we could recycle from previous calls
|
||||
*/
|
||||
private void updateFromSavedSearches(List<String> savedSuggestions, boolean animate, int suggestionStartIndex, int recycledSuggestionCount) {
|
||||
private void updateFromSavedSearches(List<String> savedSuggestions, int suggestionStartIndex, int recycledSuggestionCount) {
|
||||
if (savedSuggestions == null || savedSuggestions.isEmpty()) {
|
||||
hideRecycledSuggestions(suggestionStartIndex, recycledSuggestionCount);
|
||||
return;
|
||||
|
@ -325,7 +314,7 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
|||
String telemetryTag = "history." + i;
|
||||
final String suggestion = savedSuggestions.get(i);
|
||||
indexOfPreviousSuggestion = suggestionStartIndex + i;
|
||||
bindSuggestionView(suggestion, animate, recycledSuggestionCount, indexOfPreviousSuggestion, true, telemetryTag);
|
||||
bindSuggestionView(suggestion, recycledSuggestionCount, indexOfPreviousSuggestion, true, telemetryTag);
|
||||
}
|
||||
|
||||
hideRecycledSuggestions(indexOfPreviousSuggestion + 1, recycledSuggestionCount);
|
||||
|
@ -334,12 +323,11 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
|||
/**
|
||||
* Displays suggestions supplied by the search engine, relative to number of suggestions from search history.
|
||||
*
|
||||
* @param animate whether or not to animate suggestions for visual polish
|
||||
* @param recycledSuggestionCount How many suggestion "button" views we could recycle from previous calls
|
||||
* @param savedSuggestionCount how many saved searches this searchTerm has
|
||||
* @return the global count of how many suggestions have been bound/shown in the search engine row
|
||||
*/
|
||||
private int updateFromSearchEngine(boolean animate, List<String> searchEngineSuggestions, int recycledSuggestionCount, int savedSuggestionCount) {
|
||||
private int updateFromSearchEngine(List<String> searchEngineSuggestions, int recycledSuggestionCount, int savedSuggestionCount) {
|
||||
int maxSuggestions = mMaxSearchSuggestions;
|
||||
// If there are less than max saved searches on phones, fill the space with more search engine suggestions
|
||||
if (!HardwareUtils.isTablet() && savedSuggestionCount < mMaxSavedSuggestions) {
|
||||
|
@ -356,7 +344,7 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
|||
// Since the search engine suggestions are listed first, their relative index is their global index
|
||||
String telemetryTag = "engine." + relativeIndex;
|
||||
final String suggestion = searchEngineSuggestions.get(relativeIndex);
|
||||
bindSuggestionView(suggestion, animate, recycledSuggestionCount, relativeIndex, false, telemetryTag);
|
||||
bindSuggestionView(suggestion, recycledSuggestionCount, relativeIndex, false, telemetryTag);
|
||||
}
|
||||
|
||||
hideRecycledSuggestions(relativeIndex + 1, recycledSuggestionCount);
|
||||
|
@ -379,9 +367,8 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
|||
* @param searchSuggestionsEnabled whether or not suggestions from the default search engine are enabled
|
||||
* @param searchEngine the search engine to use throughout the SearchEngineRow class
|
||||
* @param rawSearchHistorySuggestions search history suggestions
|
||||
* @param animate whether or not to use animations
|
||||
**/
|
||||
public void updateSuggestions(boolean searchSuggestionsEnabled, SearchEngine searchEngine, @Nullable List<String> rawSearchHistorySuggestions, boolean animate) {
|
||||
public void updateSuggestions(boolean searchSuggestionsEnabled, SearchEngine searchEngine, @Nullable List<String> rawSearchHistorySuggestions) {
|
||||
mSearchEngine = searchEngine;
|
||||
// Set the search engine icon (e.g., Google) for the row.
|
||||
|
||||
|
@ -407,7 +394,7 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
|||
}
|
||||
|
||||
|
||||
List<String> searchEngineSuggestions = new ArrayList<String>();
|
||||
final List<String> searchEngineSuggestions = new ArrayList<>();
|
||||
if (searchSuggestionsEnabled) {
|
||||
for (String suggestion : searchEngine.getSuggestions()) {
|
||||
searchHistorySuggestions.remove(suggestion);
|
||||
|
@ -426,12 +413,12 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
|||
final int searchHistoryCount = searchHistorySuggestions.size();
|
||||
|
||||
if (searchSuggestionsEnabled && savedSearchesEnabled) {
|
||||
final int suggestionViewCount = updateFromSearchEngine(animate, searchEngineSuggestions, recycledSuggestionCount, searchHistoryCount);
|
||||
updateFromSavedSearches(searchHistorySuggestions, animate, suggestionViewCount, recycledSuggestionCount);
|
||||
final int suggestionViewCount = updateFromSearchEngine(searchEngineSuggestions, recycledSuggestionCount, searchHistoryCount);
|
||||
updateFromSavedSearches(searchHistorySuggestions, suggestionViewCount, recycledSuggestionCount);
|
||||
} else if (savedSearchesEnabled) {
|
||||
updateFromSavedSearches(searchHistorySuggestions, animate, 0, recycledSuggestionCount);
|
||||
updateFromSavedSearches(searchHistorySuggestions, 0, recycledSuggestionCount);
|
||||
} else if (searchSuggestionsEnabled) {
|
||||
updateFromSearchEngine(animate, searchEngineSuggestions, recycledSuggestionCount, 0);
|
||||
updateFromSearchEngine(searchEngineSuggestions, recycledSuggestionCount, 0);
|
||||
} else {
|
||||
// The current search term is treated separately from the suggestions list, hence we can
|
||||
// recycle ALL suggestion items here. (We always show the current search term, i.e. 1 item,
|
||||
|
|
|
@ -7,7 +7,6 @@ package org.mozilla.gecko.media;
|
|||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.exoplayer2.C;
|
||||
|
@ -30,17 +29,18 @@ import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
|||
import com.google.android.exoplayer2.upstream.DataSource;
|
||||
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
|
||||
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
|
||||
import com.google.android.exoplayer2.upstream.DefaultHttpDataSource;
|
||||
import com.google.android.exoplayer2.upstream.DefaultHttpDataSourceFactory;
|
||||
import com.google.android.exoplayer2.upstream.HttpDataSource;
|
||||
import com.google.android.exoplayer2.util.MimeTypes;
|
||||
import com.google.android.exoplayer2.util.Util;
|
||||
|
||||
import org.mozilla.gecko.annotation.ReflectionTarget;
|
||||
import org.mozilla.gecko.AppConstants;
|
||||
import org.mozilla.gecko.GeckoAppShell;
|
||||
import org.mozilla.gecko.annotation.ReflectionTarget;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@ReflectionTarget
|
||||
public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
|
||||
|
@ -251,7 +251,13 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
|
|||
}
|
||||
|
||||
private HttpDataSource.Factory buildHttpDataSourceFactory(DefaultBandwidthMeter bandwidthMeter) {
|
||||
return new DefaultHttpDataSourceFactory(AppConstants.USER_AGENT_FENNEC_MOBILE, bandwidthMeter);
|
||||
return new DefaultHttpDataSourceFactory(
|
||||
AppConstants.USER_AGENT_FENNEC_MOBILE,
|
||||
bandwidthMeter /* listener */,
|
||||
DefaultHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS,
|
||||
DefaultHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS,
|
||||
true /* allowCrossProtocolRedirects */
|
||||
);
|
||||
}
|
||||
|
||||
// To make sure that each player has a unique id, GeckoHlsPlayer should be
|
||||
|
@ -314,6 +320,7 @@ public class GeckoHlsPlayer implements BaseHlsPlayer, ExoPlayer.EventListener {
|
|||
@Override
|
||||
public void onPlayerError(ExoPlaybackException e) {
|
||||
if (DEBUG) { Log.e(LOGTAG, "playerFailed" , e); }
|
||||
mIsPlayerInitDone = false;
|
||||
if (mResourceCallbacks != null) {
|
||||
mResourceCallbacks.onError(ResourceError.PLAYER.code());
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ dependencies {
|
|||
if (mozconfig.substs.MOZ_ANDROID_MMA) {
|
||||
compile "com.android.support:appcompat-v7:${mozconfig.substs.ANDROID_SUPPORT_LIBRARY_VERSION}"
|
||||
compile "com.android.support:support-annotations:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
|
||||
compile "com.google.android.gms:play-services-ads:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
|
||||
compile "com.google.android.gms:play-services-gcm:${mozconfig.substs.ANDROID_GOOGLE_PLAY_SERVICES_VERSION}"
|
||||
}
|
||||
}
|
||||
|
@ -69,3 +68,11 @@ idea {
|
|||
// Bug 1353055 - Strip 'vars' debugging information to agree with moz.build.
|
||||
apply from: "${topsrcdir}/mobile/android/gradle/debug_level.gradle"
|
||||
android.libraryVariants.all configureVariantDebugLevel
|
||||
|
||||
// Bug 1355625: strip extra .class files from Gradle builds; modified from
|
||||
// http://stackoverflow.com/a/40705699.
|
||||
android.libraryVariants.all { variant ->
|
||||
variant.javaCompile.doLast {
|
||||
delete fileTree(dir: "${project.buildDir}", include: "**/org/mozilla/gecko/thirdparty_unused/BuildConfig.class")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5218,7 +5218,7 @@ pref("urlclassifier.phishTable", "googpub-phish-shavar,test-phish-simple");
|
|||
pref("urlclassifier.downloadAllowTable", "goog-downloadwhite-proto");
|
||||
pref("urlclassifier.downloadBlockTable", "goog-badbinurl-proto");
|
||||
|
||||
pref("urlclassifier.disallow_completions", "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple,test-flashallow-simple,testexcept-flashallow-simple,test-flash-simple,testexcept-flash-simple,test-flashsubdoc-simple,testexcept-flashsubdoc-simple,goog-downloadwhite-digest256,base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,block-flash-digest256,except-flash-digest256,allow-flashallow-digest256,except-flashallow-digest256,block-flashsubdoc-digest256,except-flashsubdoc-digest256,except-flashinfobar-digest256");
|
||||
pref("urlclassifier.disallow_completions", "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple,goog-downloadwhite-digest256,base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,block-flash-digest256,except-flash-digest256,allow-flashallow-digest256,except-flashallow-digest256,block-flashsubdoc-digest256,except-flashsubdoc-digest256,except-flashinfobar-digest256");
|
||||
|
||||
// The table and update/gethash URLs for Safebrowsing phishing and malware
|
||||
// checks.
|
||||
|
@ -5294,12 +5294,12 @@ pref("browser.safebrowsing.provider.mozilla.lists.base.description", "mozstdDesc
|
|||
pref("browser.safebrowsing.provider.mozilla.lists.content.name", "mozfullName");
|
||||
pref("browser.safebrowsing.provider.mozilla.lists.content.description", "mozfullDesc");
|
||||
|
||||
pref("urlclassifier.flashAllowTable", "test-flashallow-simple,allow-flashallow-digest256");
|
||||
pref("urlclassifier.flashAllowExceptTable", "testexcept-flashallow-simple,except-flashallow-digest256");
|
||||
pref("urlclassifier.flashTable", "test-flash-simple,block-flash-digest256");
|
||||
pref("urlclassifier.flashExceptTable", "testexcept-flash-simple,except-flash-digest256");
|
||||
pref("urlclassifier.flashSubDocTable", "test-flashsubdoc-simple,block-flashsubdoc-digest256");
|
||||
pref("urlclassifier.flashSubDocExceptTable", "testexcept-flashsubdoc-simple,except-flashsubdoc-digest256");
|
||||
pref("urlclassifier.flashAllowTable", "allow-flashallow-digest256");
|
||||
pref("urlclassifier.flashAllowExceptTable", "except-flashallow-digest256");
|
||||
pref("urlclassifier.flashTable", "block-flash-digest256");
|
||||
pref("urlclassifier.flashExceptTable", "except-flash-digest256");
|
||||
pref("urlclassifier.flashSubDocTable", "block-flashsubdoc-digest256");
|
||||
pref("urlclassifier.flashSubDocExceptTable", "except-flashsubdoc-digest256");
|
||||
pref("urlclassifier.flashInfobarTable", "except-flashinfobar-digest256");
|
||||
|
||||
pref("plugins.http_https_only", true);
|
||||
|
|
|
@ -1980,6 +1980,14 @@ nsProtocolProxyService::Resolve_Internal(nsIChannel *channel,
|
|||
uri->GetScheme(scheme);
|
||||
uri->GetPort(&port);
|
||||
|
||||
if (flags & RESOLVE_PREFER_SOCKS_PROXY) {
|
||||
LOG(("Ignoring RESOLVE_PREFER_SOCKS_PROXY for system proxy setting\n"));
|
||||
} else if (flags & RESOLVE_PREFER_HTTPS_PROXY) {
|
||||
scheme.AssignLiteral("https");
|
||||
} else if (flags & RESOLVE_IGNORE_URI_SCHEME) {
|
||||
scheme.AssignLiteral("http");
|
||||
}
|
||||
|
||||
// now try the system proxy settings for this particular url
|
||||
if (NS_SUCCEEDED(mSystemProxySettings->
|
||||
GetProxyForURI(spec, scheme, host, port,
|
||||
|
|
|
@ -2494,6 +2494,9 @@ nsCookieService::AddNative(const nsACString &aHost,
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
AutoRestore<DBState*> savePrevDBState(mDBState);
|
||||
mDBState = (aOriginAttributes->mPrivateBrowsingId > 0) ? mPrivateDBState : mDefaultDBState;
|
||||
|
||||
// first, normalize the hostname, and fail if it contains illegal characters.
|
||||
nsAutoCString host(aHost);
|
||||
nsresult rv = NormalizeHost(host);
|
||||
|
@ -2536,6 +2539,9 @@ nsCookieService::Remove(const nsACString& aHost, const OriginAttributes& aAttrs,
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
AutoRestore<DBState*> savePrevDBState(mDBState);
|
||||
mDBState = (aAttrs.mPrivateBrowsingId > 0) ? mPrivateDBState : mDefaultDBState;
|
||||
|
||||
// first, normalize the hostname, and fail if it contains illegal characters.
|
||||
nsAutoCString host(aHost);
|
||||
nsresult rv = NormalizeHost(host);
|
||||
|
@ -2621,25 +2627,6 @@ nsCookieService::RemoveNative(const nsACString &aHost,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCookieService::UsePrivateMode(bool aIsPrivate,
|
||||
nsIPrivateModeCallback* aCallback)
|
||||
{
|
||||
if (!aCallback) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (!mDBState) {
|
||||
NS_WARNING("No DBState! Profile already closed?");
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
AutoRestore<DBState*> savePrevDBState(mDBState);
|
||||
mDBState = aIsPrivate ? mPrivateDBState : mDefaultDBState;
|
||||
|
||||
return aCallback->Callback();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* nsCookieService impl:
|
||||
* private file I/O functions
|
||||
|
@ -4641,6 +4628,9 @@ nsCookieService::CookieExistsNative(nsICookie2* aCookie,
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
AutoRestore<DBState*> savePrevDBState(mDBState);
|
||||
mDBState = (aOriginAttributes->mPrivateBrowsingId > 0) ? mPrivateDBState : mDefaultDBState;
|
||||
|
||||
nsAutoCString host, name, path;
|
||||
nsresult rv = aCookie->GetHost(host);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -4831,6 +4821,9 @@ nsCookieService::GetCookiesFromHost(const nsACString &aHost,
|
|||
u"2");
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
AutoRestore<DBState*> savePrevDBState(mDBState);
|
||||
mDBState = (attrs.mPrivateBrowsingId > 0) ? mPrivateDBState : mDefaultDBState;
|
||||
|
||||
nsCookieKey key = nsCookieKey(baseDomain, attrs);
|
||||
EnsureReadDomain(key);
|
||||
|
||||
|
@ -4879,6 +4872,10 @@ nsCookieService::GetCookiesWithOriginAttributes(
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
AutoRestore<DBState*> savePrevDBState(mDBState);
|
||||
mDBState = (aPattern.mPrivateBrowsingId.WasPassed() &&
|
||||
aPattern.mPrivateBrowsingId.Value() > 0) ? mPrivateDBState : mDefaultDBState;
|
||||
|
||||
nsCOMArray<nsICookie> cookies;
|
||||
for (auto iter = mDBState->hostTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
nsCookieEntry* entry = iter.Get();
|
||||
|
@ -4933,6 +4930,10 @@ nsCookieService::RemoveCookiesWithOriginAttributes(
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
AutoRestore<DBState*> savePrevDBState(mDBState);
|
||||
mDBState = (aPattern.mPrivateBrowsingId.WasPassed() &&
|
||||
aPattern.mPrivateBrowsingId.Value() > 0) ? mPrivateDBState : mDefaultDBState;
|
||||
|
||||
mozStorageTransaction transaction(mDBState->dbConn, false);
|
||||
// Iterate the hash table of nsCookieEntry.
|
||||
for (auto iter = mDBState->hostTable.Iter(); !iter.Done(); iter.Next()) {
|
||||
|
|
|
@ -38,12 +38,16 @@ interface nsICookieManager : nsISupports
|
|||
/**
|
||||
* Called to enumerate through each cookie in the cookie list.
|
||||
* The objects enumerated over are of type nsICookie
|
||||
* This enumerator should only be used for non-private browsing cookies.
|
||||
* To retrieve an enumerator for private browsing cookies, use
|
||||
* getCookiesWithOriginAttributes from nsICookieManager2.
|
||||
*/
|
||||
readonly attribute nsISimpleEnumerator enumerator;
|
||||
|
||||
/**
|
||||
* Called to enumerate through each session cookie in the cookie list.
|
||||
* The objects enumerated over are of type nsICookie
|
||||
* This enumerator should only be used for non-private browsing cookies.
|
||||
*/
|
||||
readonly attribute nsISimpleEnumerator sessionEnumerator;
|
||||
|
||||
|
@ -79,16 +83,4 @@ interface nsICookieManager : nsISupports
|
|||
in AUTF8String aPath,
|
||||
in boolean aBlocked,
|
||||
in OriginAttributesPtr aOriginAttributes);
|
||||
|
||||
/**
|
||||
* Set the cookie manager to work on private or non-private cookies for the
|
||||
* duration of the callback.
|
||||
*
|
||||
* @param aIsPrivate True to work on private cookies, false to work on
|
||||
* non-private cookies.
|
||||
* @param aCallback Methods on the cookie manager interface will work on
|
||||
* private or non-private cookies for the duration of this
|
||||
* callback.
|
||||
*/
|
||||
void usePrivateMode(in boolean aIsPrivate, in nsIPrivateModeCallback aCallback);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,149 @@
|
|||
"use strict";
|
||||
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://testing-common/MockRegistrar.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "gProxyService",
|
||||
"@mozilla.org/network/protocol-proxy-service;1",
|
||||
"nsIProtocolProxyService");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "systemSettings", function() {
|
||||
return {
|
||||
QueryInterface: function (iid) {
|
||||
if (iid.equals(Components.interfaces.nsISupports) ||
|
||||
iid.equals(Components.interfaces.nsISystemProxySettings))
|
||||
return this;
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
|
||||
mainThreadOnly: true,
|
||||
PACURI: null,
|
||||
|
||||
getProxyForURI: function(aSpec, aScheme, aHost, aPort) {
|
||||
if (aPort != -1) {
|
||||
return 'SOCKS5 http://localhost:9050'
|
||||
}
|
||||
if (aScheme == 'http' ||
|
||||
aScheme == 'https' ||
|
||||
aScheme == 'ftp') {
|
||||
return 'PROXY http://localhost:8080';
|
||||
}
|
||||
return 'DIRECT';
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
let gMockProxy = MockRegistrar.register("@mozilla.org/system-proxy-settings;1",
|
||||
systemSettings);
|
||||
|
||||
do_register_cleanup(() => {
|
||||
MockRegistrar.unregister(gMockProxy);
|
||||
});
|
||||
|
||||
function makeChannel(uri) {
|
||||
return NetUtil.newChannel({
|
||||
uri: uri,
|
||||
loadUsingSystemPrincipal: true,
|
||||
});
|
||||
}
|
||||
|
||||
async function TestProxyType(chan, flags) {
|
||||
const prefs = Cc["@mozilla.org/preferences-service;1"]
|
||||
.getService(Ci.nsIPrefBranch);
|
||||
prefs.setIntPref(
|
||||
"network.proxy.type",
|
||||
Components.interfaces.nsIProtocolProxyService.PROXYCONFIG_SYSTEM);
|
||||
|
||||
return await new Promise((resolve, reject) => {
|
||||
gProxyService.asyncResolve(chan, flags, {
|
||||
onProxyAvailable(req, uri, pi, status) {
|
||||
resolve(pi);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function TestProxyTypeByURI(uri) {
|
||||
return await TestProxyType(makeChannel(uri), 0);
|
||||
}
|
||||
|
||||
add_task(async function testHttpProxy() {
|
||||
let pi = await TestProxyTypeByURI("http://www.mozilla.org/");
|
||||
equal(pi.host, "localhost", "Expected proxy host to be localhost");
|
||||
equal(pi.port, 8080, "Expected proxy port to be 8080");
|
||||
equal(pi.type, "http", "Expected proxy type to be http");
|
||||
});
|
||||
|
||||
add_task(async function testHttpsProxy() {
|
||||
let pi = await TestProxyTypeByURI("https://www.mozilla.org/");
|
||||
equal(pi.host, "localhost", "Expected proxy host to be localhost");
|
||||
equal(pi.port, 8080, "Expected proxy port to be 8080");
|
||||
equal(pi.type, "http", "Expected proxy type to be http");
|
||||
});
|
||||
|
||||
add_task(async function testFtpProxy() {
|
||||
let pi = await TestProxyTypeByURI("ftp://ftp.mozilla.org/");
|
||||
equal(pi.host, "localhost", "Expected proxy host to be localhost");
|
||||
equal(pi.port, 8080, "Expected proxy port to be 8080");
|
||||
equal(pi.type, "http", "Expected proxy type to be http");
|
||||
});
|
||||
|
||||
add_task(async function testSocksProxy() {
|
||||
let pi = await TestProxyTypeByURI("http://www.mozilla.org:1234/");
|
||||
equal(pi.host, "localhost", "Expected proxy host to be localhost");
|
||||
equal(pi.port, 9050, "Expected proxy port to be 8080");
|
||||
equal(pi.type, "socks", "Expected proxy type to be http");
|
||||
});
|
||||
|
||||
add_task(async function testDirectProxy() {
|
||||
// Do what |WebSocketChannel::AsyncOpen| do, but do not prefer https proxy.
|
||||
let proxyURI = Cc["@mozilla.org/network/standard-url;1"].createInstance(Ci.nsIURI);
|
||||
proxyURI.spec = "wss://ws.mozilla.org/";
|
||||
let uri = proxyURI.clone();
|
||||
uri.scheme = "https";
|
||||
|
||||
let ioService = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService2);
|
||||
let chan = ioService.
|
||||
newChannelFromURIWithProxyFlags2(uri,
|
||||
proxyURI,
|
||||
0,
|
||||
null,
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null,
|
||||
Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
let pi = await TestProxyType(chan, 0);
|
||||
equal(pi, null, "Expected proxy host to be null");
|
||||
});
|
||||
|
||||
add_task(async function testWebSocketProxy() {
|
||||
// Do what |WebSocketChannel::AsyncOpen| do
|
||||
let proxyURI = Cc["@mozilla.org/network/standard-url;1"].createInstance(Ci.nsIURI);
|
||||
proxyURI.spec = "wss://ws.mozilla.org/";
|
||||
let uri = proxyURI.clone();
|
||||
uri.scheme = "https";
|
||||
|
||||
let proxyFlags = Ci.nsIProtocolProxyService.RESOLVE_PREFER_HTTPS_PROXY |
|
||||
Ci.nsIProtocolProxyService.RESOLVE_ALWAYS_TUNNEL;
|
||||
|
||||
let ioService = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService2);
|
||||
let chan = ioService.
|
||||
newChannelFromURIWithProxyFlags2(uri,
|
||||
proxyURI,
|
||||
proxyFlags,
|
||||
null,
|
||||
Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
null,
|
||||
Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
|
||||
Ci.nsIContentPolicy.TYPE_OTHER);
|
||||
|
||||
let pi = await TestProxyType(chan, proxyFlags);
|
||||
equal(pi.host, "localhost", "Expected proxy host to be localhost");
|
||||
equal(pi.port, 8080, "Expected proxy port to be 8080");
|
||||
equal(pi.type, "http", "Expected proxy type to be http");
|
||||
});
|
|
@ -172,6 +172,7 @@ skip-if = os == "android"
|
|||
skip-if = bits != 32
|
||||
[test_bug935499.js]
|
||||
[test_bug1064258.js]
|
||||
[test_bug1177909.js]
|
||||
[test_bug1218029.js]
|
||||
[test_udpsocket.js]
|
||||
[test_udpsocket_offline.js]
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
#!/bin/python
|
||||
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
'''
|
||||
Invoke Android `aapt package`.
|
||||
|
||||
Right now, this passes arguments through. Eventually it will
|
||||
implement a much restricted version of the Gradle build system's
|
||||
resource merging algorithm before invoking aapt.
|
||||
'''
|
||||
|
||||
from __future__ import (
|
||||
print_function,
|
||||
unicode_literals,
|
||||
)
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import buildconfig
|
||||
import mozpack.path as mozpath
|
||||
|
||||
import merge_resources
|
||||
|
||||
|
||||
def uniqify(iterable):
|
||||
"""Remove duplicates from iterable, preserving order."""
|
||||
# Cribbed from
|
||||
# https://thingspython.wordpress.com/2011/03/09/snippet-uniquify-a-sequence-preserving-order/.
|
||||
seen = set()
|
||||
return [item for item in iterable if not (item in seen or seen.add(item))]
|
||||
|
||||
|
||||
def main(*argv):
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Invoke Android `aapt package`.')
|
||||
|
||||
# These serve to order build targets; they're otherwise ignored.
|
||||
parser.add_argument('ignored_inputs', nargs='*')
|
||||
parser.add_argument('-f', action='store_true', default=False,
|
||||
help='force overwrite of existing files')
|
||||
parser.add_argument('-F', required=True,
|
||||
help='specify the apk file to output')
|
||||
parser.add_argument('-M', required=True,
|
||||
help='specify full path to AndroidManifest.xml to include in zip')
|
||||
parser.add_argument('-J', required=True,
|
||||
help='specify where to output R.java resource constant definitions')
|
||||
parser.add_argument('-S', action='append', dest='res_dirs',
|
||||
default=[],
|
||||
help='directory in which to find resources. ' +
|
||||
'Multiple directories will be scanned and the first ' +
|
||||
'match found (left to right) will take precedence.')
|
||||
parser.add_argument('-A', action='append', dest='assets_dirs',
|
||||
default=[],
|
||||
help='additional directory in which to find raw asset files')
|
||||
parser.add_argument('--extra-packages', action='append',
|
||||
default=[],
|
||||
help='generate R.java for libraries')
|
||||
parser.add_argument('--output-text-symbols', required=True,
|
||||
help='Generates a text file containing the resource ' +
|
||||
'symbols of the R class in the specified folder.')
|
||||
parser.add_argument('--verbose', action='store_true', default=False,
|
||||
help='provide verbose output')
|
||||
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
args.res_dirs = uniqify(args.res_dirs)
|
||||
args.assets_dirs = uniqify(args.assets_dirs)
|
||||
args.extra_packages = uniqify(args.extra_packages)
|
||||
|
||||
import itertools
|
||||
|
||||
debug = False
|
||||
if (not buildconfig.substs['MOZILLA_OFFICIAL']) or \
|
||||
(buildconfig.substs['NIGHTLY_BUILD'] and buildconfig.substs['MOZ_DEBUG']):
|
||||
debug = True
|
||||
|
||||
merge_resources.main('merged', True, *args.res_dirs)
|
||||
|
||||
cmd = [
|
||||
buildconfig.substs['AAPT'],
|
||||
'package',
|
||||
] + \
|
||||
(['-f'] if args.f else []) + \
|
||||
[
|
||||
'-m',
|
||||
'-M', args.M,
|
||||
'-I', mozpath.join(buildconfig.substs['ANDROID_SDK'], 'android.jar'),
|
||||
'--auto-add-overlay',
|
||||
] + \
|
||||
list(itertools.chain(*(('-A', x) for x in args.assets_dirs))) + \
|
||||
['-S', os.path.abspath('merged')] + \
|
||||
(['--extra-packages', ':'.join(args.extra_packages)] if args.extra_packages else []) + \
|
||||
['--custom-package', 'org.mozilla.gecko'] + \
|
||||
['--no-version-vectors'] + \
|
||||
(['--debug-mode'] if debug else []) + \
|
||||
[
|
||||
'-F',
|
||||
args.F,
|
||||
'-J',
|
||||
args.J,
|
||||
'--output-text-symbols',
|
||||
args.output_text_symbols,
|
||||
'--ignore-assets',
|
||||
'!.svn:!.git:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~:#*:*.rej:*.orig',
|
||||
]
|
||||
|
||||
# We run aapt to produce gecko.ap_ and gecko-nodeps.ap_; it's
|
||||
# helpful to tag logs with the file being produced.
|
||||
logtag = os.path.basename(args.F)
|
||||
|
||||
if args.verbose:
|
||||
print('[aapt {}] {}'.format(logtag, ' '.join(cmd)))
|
||||
|
||||
try:
|
||||
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print('\n'.join(['[aapt {}] {}'.format(logtag, line) for line in e.output.splitlines()]))
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(*sys.argv[1:]))
|
|
@ -0,0 +1,301 @@
|
|||
#!/bin/python
|
||||
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
'''
|
||||
A hacked together clone of the Android Gradle plugin's resource
|
||||
merging algorithm. To be abandoned in favour of --with-gradle as soon
|
||||
as possible!
|
||||
'''
|
||||
|
||||
from __future__ import (
|
||||
print_function,
|
||||
unicode_literals,
|
||||
)
|
||||
|
||||
from collections import defaultdict
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
|
||||
from mozbuild.util import ensureParentDir
|
||||
from mozpack.copier import (
|
||||
FileCopier,
|
||||
)
|
||||
from mozpack.manifests import (
|
||||
InstallManifest,
|
||||
)
|
||||
import mozpack.path as mozpath
|
||||
from mozpack.files import (
|
||||
FileFinder,
|
||||
)
|
||||
|
||||
import xml.etree.cElementTree as ET
|
||||
|
||||
|
||||
# From https://github.com/miracle2k/android-platform_sdk/blob/master/common/src/com/android/resources/ResourceType.java.
|
||||
# TODO: find a more authoritative source!
|
||||
resource_type = {
|
||||
"anim": 0,
|
||||
"animator": 1,
|
||||
# The only interesting ones.
|
||||
"string-array": 2,
|
||||
"integer-array": 2,
|
||||
"attr": 3,
|
||||
"bool": 4,
|
||||
"color": 5,
|
||||
"declare-styleable": 6,
|
||||
"dimen": 7,
|
||||
"drawable": 8,
|
||||
"fraction": 9,
|
||||
"id": 10,
|
||||
"integer": 11,
|
||||
"interpolator": 12,
|
||||
"layout": 13,
|
||||
"menu": 14,
|
||||
"mipmap": 15,
|
||||
"plurals": 16,
|
||||
"raw": 17,
|
||||
"string": 18,
|
||||
"style": 19,
|
||||
"styleable": 20,
|
||||
"xml": 21,
|
||||
# "public": 0,
|
||||
}
|
||||
|
||||
|
||||
def uniqify(iterable):
|
||||
"""Remove duplicates from iterable, preserving order."""
|
||||
# Cribbed from https://thingspython.wordpress.com/2011/03/09/snippet-uniquify-a-sequence-preserving-order/.
|
||||
seen = set()
|
||||
return [item for item in iterable if not (item in seen or seen.add(item))]
|
||||
|
||||
|
||||
# Exclusions, arising in appcompat-v7-23.4.0.
|
||||
MANIFEST_EXCLUSIONS = (
|
||||
'color/abc_background_cache_hint_selector_material_dark.xml',
|
||||
'color/abc_background_cache_hint_selector_material_light.xml',
|
||||
)
|
||||
|
||||
SMALLEST_SCREEN_WIDTH_QUALIFIER_RE = re.compile(r"(^|-)w(\d+)dp($|-)")
|
||||
SCREEN_WIDTH_QUALIFIER_RE = re.compile(r"(^|-)sw(\d+)dp($|-)")
|
||||
# Different densities were introduced in different Android versions.
|
||||
# However, earlier versions of aapt (like the one we are building
|
||||
# with) don't have fine-grained versions; they're all lumped into v4.
|
||||
DENSITIES = [
|
||||
(re.compile(r"(^|-)xxxhdpi($|-)"), 18),
|
||||
(re.compile(r"(^|-)560dpi($|-)"), 1),
|
||||
(re.compile(r"(^|-)xxhdpi($|-)"), 16),
|
||||
(re.compile(r"(^|-)400dpi($|-)"), 1),
|
||||
(re.compile(r"(^|-)360dpi($|-)"), 23),
|
||||
(re.compile(r"(^|-)xhdpi($|-)"), 8),
|
||||
(re.compile(r"(^|-)280dpi($|-)"), 22),
|
||||
(re.compile(r"(^|-)hdpi($|-)"), 4),
|
||||
(re.compile(r"(^|-)tvdpi($|-)"), 13),
|
||||
(re.compile(r"(^|-)mdpi($|-)"), 4),
|
||||
(re.compile(r"(^|-)ldpi($|-)"), 4),
|
||||
(re.compile(r"(^|-)anydpi($|-)"), 21),
|
||||
(re.compile(r"(^|-)nodpi($|-)"), 4),
|
||||
]
|
||||
SCREEN_SIZE_RE = re.compile(r"(^|-)(small|normal|large|xlarge)($|-)")
|
||||
|
||||
def with_version(dir):
|
||||
"""Resources directories without versions (like values-large) that
|
||||
correspond to resource filters added to Android in vN (like large,
|
||||
which was added in v4) automatically get a -vN added (so values-large
|
||||
becomes values-large-v4, since Android versions before v4 will not
|
||||
recognize values-large)."""
|
||||
# Order matters! We need to check for later features before
|
||||
# earlier features, so that "ldrtl-sw-large" will be v17, not v13
|
||||
# or v4.
|
||||
if '-ldrtl' in dir and '-v' not in dir:
|
||||
return '{}-v17'.format(dir)
|
||||
|
||||
if re.search(SMALLEST_SCREEN_WIDTH_QUALIFIER_RE, dir) and '-v' not in dir:
|
||||
return '{}-v13'.format(dir)
|
||||
|
||||
if re.search(SCREEN_WIDTH_QUALIFIER_RE, dir) and '-v' not in dir:
|
||||
return '{}-v13'.format(dir)
|
||||
|
||||
for (density, _since) in DENSITIES:
|
||||
if re.search(density, dir) and '-v' not in dir:
|
||||
return '{}-v{}'.format(dir, 4)
|
||||
|
||||
if re.search(SCREEN_SIZE_RE, dir) and '-v' not in dir:
|
||||
return '{}-v4'.format(dir)
|
||||
|
||||
return dir
|
||||
|
||||
|
||||
def classify(path):
|
||||
"""Return `(resource, version)` for a given path.
|
||||
|
||||
`resource` is of the form `unversioned/name` where `unversionsed` is a resource
|
||||
type (like "drawable" or "strings"), and `version` is an
|
||||
integer version number or `None`."""
|
||||
dir, name = path.split('/')
|
||||
segments = dir.split('-')
|
||||
version = None
|
||||
for segment in segments[1:]:
|
||||
if segment.startswith('v'):
|
||||
version = int(segment[1:])
|
||||
break
|
||||
segments = [segment for segment in segments if not segment.startswith('v')]
|
||||
resource = '{}/{}'.format('-'.join(segments), name)
|
||||
return (resource, version)
|
||||
|
||||
|
||||
def main(output_dirname, verbose, *input_dirs):
|
||||
# Map directories to source paths, like
|
||||
# `{'values-large-v11': ['/path/to/values-large-v11/strings.xml',
|
||||
# '/path/to/values-large-v11/colors.xml', ...], ...}`.
|
||||
values = defaultdict(list)
|
||||
# Map unversioned resource names to maps from versions to source paths, like:
|
||||
# `{'drawable-large/icon.png':
|
||||
# {None: '/path/to/drawable-large/icon.png',
|
||||
# 11: '/path/to/drawable-large-v11/icon.png', ...}, ...}`.
|
||||
resources = defaultdict(dict)
|
||||
|
||||
manifest = InstallManifest()
|
||||
|
||||
for p in uniqify(input_dirs):
|
||||
finder = FileFinder(p, find_executables=False)
|
||||
|
||||
values_pattern = 'values*/*.xml'
|
||||
for path, _ in finder.find('*/*'):
|
||||
if path in MANIFEST_EXCLUSIONS:
|
||||
continue
|
||||
|
||||
source_path = mozpath.join(finder.base, path)
|
||||
|
||||
if mozpath.match(path, values_pattern):
|
||||
dir, _name = path.split('/')
|
||||
dir = with_version(dir)
|
||||
values[dir].append(source_path)
|
||||
continue
|
||||
|
||||
(resource, version) = classify(path)
|
||||
|
||||
# Earlier paths are taken in preference to later paths.
|
||||
# This agrees with aapt.
|
||||
if version not in resources:
|
||||
resources[resource][version] = source_path
|
||||
|
||||
# Step 1: merge all XML values into one single, sorted
|
||||
# per-configuration values.xml file. This apes what the Android
|
||||
# Gradle resource merging algorithm does.
|
||||
merged_values = defaultdict(list)
|
||||
|
||||
for dir, files in values.items():
|
||||
for file in files:
|
||||
values = ET.ElementTree(file=file).getroot()
|
||||
merged_values[dir].extend(values)
|
||||
|
||||
values = ET.Element('resources')
|
||||
# Sort by <type> tag, and then by name. Note that <item
|
||||
# type="type"> is equivalent to <type>.
|
||||
key = lambda x: (resource_type.get(x.get('type', x.tag)), x.get('name'))
|
||||
values[:] = sorted(merged_values[dir], key=key)
|
||||
|
||||
for value in values:
|
||||
if value.get('name') == 'TextAppearance.Design.Snackbar.Message':
|
||||
if value.get('{http://schemas.android.com/tools}override', False):
|
||||
values.remove(value)
|
||||
break
|
||||
|
||||
merged_values[dir] = values
|
||||
|
||||
for dir, values in merged_values.items():
|
||||
o = mozpath.join(output_dirname, dir, '{}.xml'.format(dir))
|
||||
ensureParentDir(o)
|
||||
ET.ElementTree(values).write(o)
|
||||
|
||||
manifest.add_required_exists(mozpath.join(dir, '{}.xml'.format(dir)))
|
||||
|
||||
# Step 2a: add version numbers for unversioned features
|
||||
# corresponding to when the feature was introduced. Resource
|
||||
# qualifiers will never be recognized by Android versions before
|
||||
# they were introduced. For example, density qualifiers are
|
||||
# supported only in Android v4 and above. Therefore
|
||||
# "drawable-hdpi" is implicitly "drawable-hdpi-v4". We version
|
||||
# such unversioned resources here.
|
||||
for (resource, versions) in resources.items():
|
||||
if None in versions:
|
||||
dir, name = resource.split('/')
|
||||
new_dir = with_version(dir)
|
||||
(new_resource, new_version) = classify('{}/{}'.format(new_dir, name))
|
||||
if new_resource != resource:
|
||||
raise ValueError('this is bad')
|
||||
|
||||
# `new_version` might be None: for example, `dir` might be "drawable".
|
||||
source_path = versions.pop(None)
|
||||
versions[new_version] = source_path
|
||||
|
||||
if verbose:
|
||||
if new_version:
|
||||
print("Versioning unversioned resource {} as {}-v{}/{}".format(source_path, dir, new_version, name))
|
||||
|
||||
# TODO: make this a command line argument that takes MOZ_ANDROID_MIN_SDK_VERSION.
|
||||
min_sdk = 15
|
||||
retained = defaultdict(dict)
|
||||
|
||||
# Step 2b: drop resource directories that will never be used by
|
||||
# Android on device. This depends on the minimum supported
|
||||
# Android SDK version. Suppose the minimum SDK is 15 and we have
|
||||
# drawable-v4/icon.png and drawable-v11/icon.png. The v4 version
|
||||
# will never be chosen, since v15 is always greater than v11.
|
||||
for (resource, versions) in resources.items():
|
||||
def key(v):
|
||||
return 0 if v is None else v
|
||||
# Versions in descending order.
|
||||
version_list = sorted(versions.keys(), key=key, reverse=True)
|
||||
for version in version_list:
|
||||
retained[resource][version] = versions[version]
|
||||
if version is not None and version <= min_sdk:
|
||||
break
|
||||
|
||||
if set(retained.keys()) != set(resources.keys()):
|
||||
raise ValueError('Something terrible has happened; retained '
|
||||
'resource names do not match input resources '
|
||||
'names')
|
||||
|
||||
if verbose:
|
||||
for resource in resources:
|
||||
if resources[resource] != retained[resource]:
|
||||
for version in sorted(resources[resource].keys(), reverse=True):
|
||||
if version in retained[resource]:
|
||||
print("Keeping reachable resource {}".format(resources[resource][version]))
|
||||
else:
|
||||
print("Dropping unreachable resource {}".format(resources[resource][version]))
|
||||
|
||||
# Populate manifest.
|
||||
for (resource, versions) in retained.items():
|
||||
for version in sorted(versions.keys(), reverse=True):
|
||||
path = resource
|
||||
if version:
|
||||
dir, name = resource.split('/')
|
||||
path = '{}-v{}/{}'.format(dir, version, name)
|
||||
manifest.add_copy(versions[version], path)
|
||||
|
||||
|
||||
copier = FileCopier()
|
||||
manifest.populate_registry(copier)
|
||||
print('mr', os.getcwd())
|
||||
result = copier.copy(output_dirname,
|
||||
remove_unaccounted=True,
|
||||
remove_all_directory_symlinks=False,
|
||||
remove_empty_directories=True)
|
||||
|
||||
if verbose:
|
||||
print('Updated:', result.updated_files_count)
|
||||
print('Removed:', result.removed_files_count + result.removed_directories_count)
|
||||
print('Existed:', result.existing_files_count)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(*sys.argv[1:]))
|
|
@ -627,6 +627,10 @@ class MozbuildObject(ProcessExecutionMixin):
|
|||
self.virtualenv_manager.activate()
|
||||
|
||||
|
||||
def _set_log_level(self, verbose):
|
||||
self.log_manager.terminal_handler.setLevel(logging.INFO if not verbose else logging.DEBUG)
|
||||
|
||||
|
||||
class MachCommandBase(MozbuildObject):
|
||||
"""Base class for mach command providers that wish to be MozbuildObjects.
|
||||
|
||||
|
|
|
@ -1542,9 +1542,6 @@ class PackageFrontend(MachCommandBase):
|
|||
'''
|
||||
pass
|
||||
|
||||
def _set_log_level(self, verbose):
|
||||
self.log_manager.terminal_handler.setLevel(logging.INFO if not verbose else logging.DEBUG)
|
||||
|
||||
def _make_artifacts(self, tree=None, job=None, skip_cache=False):
|
||||
state_dir = self._mach_context.state_dir
|
||||
cache_dir = os.path.join(state_dir, 'package-frontend')
|
||||
|
|
|
@ -36,21 +36,12 @@ module.exports = {
|
|||
// case/default clauses.
|
||||
"no-case-declarations": "error",
|
||||
|
||||
// Disallow modifying variables of class declarations.
|
||||
"no-class-assign": "error",
|
||||
|
||||
// Disallow use of the console API.
|
||||
"no-console": "error",
|
||||
|
||||
// Disallow modifying variables that are declared using const.
|
||||
"no-const-assign": "error",
|
||||
|
||||
// Disallow constant expressions in conditions (except for loops).
|
||||
"no-constant-condition": ["error", { "checkLoops": false }],
|
||||
|
||||
// Disallow duplicate class members.
|
||||
"no-dupe-class-members": "error",
|
||||
|
||||
// Disallow extending of native objects.
|
||||
"no-extend-native": "error",
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.25.5"
|
||||
version = "0.26.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2892,7 +2892,7 @@ dependencies = [
|
|||
"arraydeque 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bindgen 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bindgen 0.26.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -3530,7 +3530,7 @@ dependencies = [
|
|||
"checksum base64 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30e93c03064e7590d0466209155251b90c22e37fab1daf2771582598b5827557"
|
||||
"checksum binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88ceb0d16c4fd0e42876e298d7d3ce3780dd9ebdcbe4199816a32c77e08597ff"
|
||||
"checksum bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e103c8b299b28a9c6990458b7013dc4a8356a9b854c51b9883241f5866fac36e"
|
||||
"checksum bindgen 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)" = "cc7973dbc2990511877ad9e5e50a312f02fbbc9b356c30bb102307424fa73630"
|
||||
"checksum bindgen 0.26.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04488a91af8f15eec4d88eb59e2c4e982c03ff31582acf2f5623e2e6d8ae9e0b"
|
||||
"checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c"
|
||||
"checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d"
|
||||
"checksum bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f67931368edf3a9a51d29886d245f1c3db2f1ef0dcc9e35ff70341b78c10d23"
|
||||
|
|
|
@ -77,7 +77,7 @@ kernel32-sys = "0.2"
|
|||
[build-dependencies]
|
||||
lazy_static = "0.2"
|
||||
log = "0.3"
|
||||
bindgen = { version = "0.25.5", optional = true }
|
||||
bindgen = { version = "0.26.1", optional = true }
|
||||
regex = {version = "0.2", optional = true}
|
||||
walkdir = "1.0"
|
||||
toml = {version = "0.2.1", optional = true, default-features = false}
|
||||
|
|
|
@ -200,7 +200,7 @@ mod bindings {
|
|||
|
||||
impl BuilderExt for Builder {
|
||||
fn get_initial_builder(build_type: BuildType) -> Builder {
|
||||
let mut builder = Builder::default().no_unstable_rust();
|
||||
let mut builder = Builder::default();
|
||||
for dir in SEARCH_PATHS.iter() {
|
||||
builder = builder.clang_arg("-I").clang_arg(dir.to_str().unwrap());
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -53,3 +53,9 @@ if (json.substs.MOZ_ANDROID_PACKAGE_INSTALL_BOUNCER) {
|
|||
// tries to configure the project even once, and as a side benefit
|
||||
// saves invoking |mach environment| multiple times.
|
||||
gradle.ext.mozconfig = json
|
||||
|
||||
if (!gradle.ext.mozconfig.substs.COMPILE_ENVIRONMENT) {
|
||||
// These should really come from the included binaries, but that's not easy.
|
||||
gradle.ext.mozconfig.substs.TARGET_XPCOM_ABI = 'arm-eabi-gcc3'
|
||||
}
|
||||
gradle.ext.mozconfig.substs.MOZ_APP_ABI = gradle.ext.mozconfig.substs.TARGET_XPCOM_ABI
|
||||
|
|
|
@ -45,6 +45,8 @@ user_pref("network.http.prompt-temp-redirect", false);
|
|||
user_pref("media.preload.default", 2); // default = metadata
|
||||
user_pref("media.preload.auto", 3); // auto = enough
|
||||
user_pref("media.cache_size", 1000);
|
||||
user_pref("media.memory_cache_max_size", 32);
|
||||
user_pref("media.memory_caches_combined_limit_kb", 256);
|
||||
user_pref("media.volume_scale", "0.01");
|
||||
user_pref("media.test.dumpDebugInfo", true);
|
||||
user_pref("media.dormant-on-pause-timeout-ms", 0); // Enter dormant immediately without waiting for timeout.
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -10,6 +10,7 @@ out to us in a GitHub issue, or stop by
|
|||
|
||||
- [Code of Conduct](#code-of-conduct)
|
||||
- [Filing an Issue](#filing-an-issue)
|
||||
- [Looking to Start Contributing to `bindgen`?](#looking-to-start-contributing-to-bindgen)
|
||||
- [Building](#building)
|
||||
- [Testing](#testing)
|
||||
- [Overview](#overview)
|
||||
|
@ -18,6 +19,7 @@ out to us in a GitHub issue, or stop by
|
|||
- [Authoring New Tests](#authoring-new-tests)
|
||||
- [Test Expectations and `libclang` Versions](#test-expectations-and-libclang-versions)
|
||||
- [Automatic code formatting](#automatic-code-formatting)
|
||||
- [Pull Requests and Code Reviews](#pull-requests-and-code-reviews)
|
||||
- [Generating Graphviz Dot Files](#generating-graphviz-dot-files)
|
||||
- [Debug Logging](#debug-logging)
|
||||
- [Using `creduce` to Minimize Test Cases](#using-creduce-to-minimize-test-cases)
|
||||
|
@ -37,12 +39,18 @@ We abide by the [Rust Code of Conduct][coc] and ask that you do as well.
|
|||
Think you've found a bug? File an issue! To help us understand and reproduce the
|
||||
issue, provide us with:
|
||||
|
||||
* A (preferrably reduced) C/C++ header file that reproduces the issue
|
||||
* A (preferably reduced) C/C++ header file that reproduces the issue
|
||||
* The `bindgen` flags used to reproduce the issue with the header file
|
||||
* The expected `bindgen` output
|
||||
* The actual `bindgen` output
|
||||
* The [debugging logs](#logs) generated when running `bindgen` on this testcase
|
||||
|
||||
## Looking to Start Contributing to `bindgen`?
|
||||
|
||||
* [Issues labeled "easy"](https://github.com/servo/rust-bindgen/issues?q=is%3Aopen+is%3Aissue+label%3AE-easy)
|
||||
* [Issues labeled "less easy"](https://github.com/servo/rust-bindgen/issues?q=is%3Aopen+is%3Aissue+label%3AE-less-easy)
|
||||
* Still can't find something to work on? [Drop a comment here](https://github.com/servo/rust-bindgen/issues/747)
|
||||
|
||||
## Building
|
||||
|
||||
To build the `bindgen` library and the `bindgen` executable:
|
||||
|
@ -176,6 +184,27 @@ $ cargo fmt
|
|||
|
||||
The code style is described in the `rustfmt.toml` file in top level of the repo.
|
||||
|
||||
## Pull Requests and Code Reviews
|
||||
|
||||
Ensure that each commit stands alone, and passes tests. This enables better `git
|
||||
bisect`ing when needed. If your commits do not stand on their own, then rebase
|
||||
them on top of the latest master and squash them into a single commit.
|
||||
|
||||
All pull requests undergo code review before merging. To request review, comment
|
||||
`r? @github_username_of_reviewer`. They we will respond with `r+` to approve the
|
||||
pull request, or may leave feedback and request changes to the pull request. Any
|
||||
changes should be squashed into the original commit.
|
||||
|
||||
Unsure who to ask for review? Ask any of:
|
||||
|
||||
* `@emilio`
|
||||
* `@fitzgen`
|
||||
|
||||
More resources:
|
||||
|
||||
* [Servo's GitHub Workflow](https://github.com/servo/servo/wiki/Github-workflow)
|
||||
* [Beginner's Guide to Rebasing and Squashing](https://github.com/servo/servo/wiki/Beginner's-guide-to-rebasing-and-squashing)
|
||||
|
||||
## Generating Graphviz Dot Files
|
||||
|
||||
We can generate [Graphviz](http://graphviz.org/pdf/dotguide.pdf) dot files from
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
[package]
|
||||
name = "bindgen"
|
||||
version = "0.25.5"
|
||||
version = "0.26.1"
|
||||
authors = ["Jyun-Yan You <jyyou.tw@gmail.com>", "Emilio Cobos Álvarez <emilio@crisal.io>", "Nick Fitzgerald <fitzgen@gmail.com>", "The Servo project developers"]
|
||||
build = "build.rs"
|
||||
exclude = ["bindgen-integration", "ci", "tests/**", "*.orig"]
|
||||
|
@ -31,37 +31,16 @@ path = "src/lib.rs"
|
|||
name = "bindgen"
|
||||
path = "src/main.rs"
|
||||
doc = false
|
||||
[dependencies.regex]
|
||||
version = "0.2"
|
||||
|
||||
[dependencies.env_logger]
|
||||
version = "0.4"
|
||||
optional = true
|
||||
|
||||
[dependencies.peeking_take_while]
|
||||
version = "0.1.2"
|
||||
|
||||
[dependencies.log]
|
||||
version = "0.3"
|
||||
optional = true
|
||||
|
||||
[dependencies.clap]
|
||||
version = "2"
|
||||
|
||||
[dependencies.quasi]
|
||||
version = "0.32"
|
||||
features = ["with-syntex"]
|
||||
|
||||
[dependencies.lazy_static]
|
||||
version = "0.2.1"
|
||||
|
||||
[dependencies.cexpr]
|
||||
version = "0.2"
|
||||
|
||||
[dependencies.aster]
|
||||
version = "0.41"
|
||||
features = ["with-syntex"]
|
||||
|
||||
[dependencies.cfg-if]
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies.clang-sys]
|
||||
version = "0.18.0"
|
||||
features = ["runtime", "clang_3_9"]
|
||||
|
@ -69,27 +48,48 @@ features = ["runtime", "clang_3_9"]
|
|||
[dependencies.syntex_syntax]
|
||||
version = "0.58"
|
||||
|
||||
[dependencies.cfg-if]
|
||||
version = "0.1.0"
|
||||
[dependencies.regex]
|
||||
version = "0.2"
|
||||
|
||||
[dependencies.peeking_take_while]
|
||||
version = "0.1.2"
|
||||
|
||||
[dependencies.cexpr]
|
||||
version = "0.2"
|
||||
|
||||
[dependencies.quasi]
|
||||
version = "0.32"
|
||||
features = ["with-syntex"]
|
||||
|
||||
[dependencies.env_logger]
|
||||
version = "0.4"
|
||||
optional = true
|
||||
|
||||
[dependencies.clap]
|
||||
version = "2"
|
||||
|
||||
[dependencies.log]
|
||||
version = "0.3"
|
||||
optional = true
|
||||
[dev-dependencies.shlex]
|
||||
version = "0.1"
|
||||
|
||||
[dev-dependencies.diff]
|
||||
version = "0.1"
|
||||
|
||||
[dev-dependencies.clap]
|
||||
version = "2"
|
||||
|
||||
[dev-dependencies.shlex]
|
||||
version = "0.1"
|
||||
[build-dependencies.quasi_codegen]
|
||||
version = "0.32"
|
||||
|
||||
[features]
|
||||
logging = ["env_logger", "log"]
|
||||
testing_only_libclang_3_8 = []
|
||||
testing_only_libclang_4 = []
|
||||
testing_only_extra_assertions = []
|
||||
static = []
|
||||
testing_only_docs = []
|
||||
testing_only_libclang_3_8 = []
|
||||
testing_only_libclang_3_9 = []
|
||||
default = ["logging"]
|
||||
testing_only_libclang_4 = []
|
||||
testing_only_libclang_3_9 = []
|
||||
testing_only_docs = []
|
||||
logging = ["env_logger", "log"]
|
||||
[badges.travis-ci]
|
||||
repository = "servo/rust-bindgen"
|
||||
|
|
|
@ -22,10 +22,6 @@ fn main() {
|
|||
// to bindgen, and lets you build up options for
|
||||
// the resulting bindings.
|
||||
let bindings = bindgen::Builder::default()
|
||||
// Do not generate unstable Rust code that
|
||||
// requires a nightly rustc and enabling
|
||||
// unstable features.
|
||||
.no_unstable_rust()
|
||||
// The input header we would like to generate
|
||||
// bindings for.
|
||||
.header("wrapper.h")
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# Using the Union Types Generated by Bindgen
|
||||
|
||||
**NOTE:** As of Rust version 1.17, Rust does not have a stable `union` type. Issue [#32836](https://github.com/rust-lang/rust/issues/32836) tracks the stabilization of a `union` type in Rust. By default, bindgen will generate the preliminary unstable `union` type, unless the flag `--no-unstable-rust` flag is used.
|
||||
**NOTE:** As of Rust version 1.17, Rust does not have a stable `union` type. Issue [#32836](https://github.com/rust-lang/rust/issues/32836) tracks the stabilization of a `union` type in Rust.
|
||||
|
||||
By using the flag `--unstable-rust`, bindgen will generate the preliminary unstable `union` type.
|
||||
|
||||
In general, most interactions with unions (either reading or writing) are unsafe.
|
||||
|
||||
|
@ -29,12 +31,12 @@ typedef union {
|
|||
|
||||
### Library
|
||||
|
||||
* [`bindgen::Builder::no_unstable_rust()`](https://docs.rs/bindgen/0.25.3/bindgen/struct.Builder.html#method.no_unstable_rust)
|
||||
* [`bindgen::Builder::unstable_rust()`](https://docs.rs/bindgen/0.25.3/bindgen/struct.Builder.html#method.unstable_rust)
|
||||
* [`bindgen::Builder::derive_default()`](https://docs.rs/bindgen/0.25.3/bindgen/struct.Builder.html#method.derive_default)
|
||||
|
||||
### Command Line
|
||||
|
||||
* `--no-unstable-rust`
|
||||
* `--unstable-rust`
|
||||
* `--with-derive-default`
|
||||
|
||||
## Using the unstable `union` version
|
||||
|
@ -129,4 +131,4 @@ error[E0308]: mismatched types
|
|||
|
|
||||
= note: expected type `bindings::__BindgenUnionField<bindings::alpha_t>`
|
||||
found type `bindings::alpha_t`
|
||||
```
|
||||
```
|
||||
|
|
|
@ -1361,55 +1361,31 @@ impl TranslationUnit {
|
|||
-> Option<Vec<cexpr::token::Token>> {
|
||||
use cexpr::token;
|
||||
|
||||
let mut tokens = match self.tokens(cursor) {
|
||||
Some(tokens) => tokens,
|
||||
None => return None,
|
||||
};
|
||||
self.tokens(cursor).map(|tokens| {
|
||||
tokens
|
||||
.into_iter()
|
||||
.filter_map(|token| {
|
||||
let kind = match token.kind {
|
||||
CXToken_Punctuation => token::Kind::Punctuation,
|
||||
CXToken_Literal => token::Kind::Literal,
|
||||
CXToken_Identifier => token::Kind::Identifier,
|
||||
CXToken_Keyword => token::Kind::Keyword,
|
||||
// NB: cexpr is not too happy about comments inside
|
||||
// expressions, so we strip them down here.
|
||||
CXToken_Comment => return None,
|
||||
_ => {
|
||||
error!("Found unexpected token kind: {:?}", token);
|
||||
return None
|
||||
}
|
||||
};
|
||||
|
||||
// FIXME(emilio): LLVM 3.9 at least always include an extra token for no
|
||||
// good reason (except if we're at EOF). So we do this kind of hack,
|
||||
// where we skip known-to-cause problems trailing punctuation and
|
||||
// trailing keywords.
|
||||
//
|
||||
// This is sort of unfortunate, though :(.
|
||||
//
|
||||
// I'll try to get it fixed in LLVM if I have the time to submit a
|
||||
// patch.
|
||||
let mut trim_last_token = false;
|
||||
if let Some(token) = tokens.last() {
|
||||
// The starting of the next macro.
|
||||
trim_last_token |= token.spelling == "#" &&
|
||||
token.kind == CXToken_Punctuation;
|
||||
|
||||
// A following keyword of any kind, like a following declaration.
|
||||
trim_last_token |= token.kind == CXToken_Keyword;
|
||||
}
|
||||
|
||||
if trim_last_token {
|
||||
tokens.pop().unwrap();
|
||||
}
|
||||
|
||||
Some(tokens.into_iter()
|
||||
.filter_map(|token| {
|
||||
let kind = match token.kind {
|
||||
CXToken_Punctuation => token::Kind::Punctuation,
|
||||
CXToken_Literal => token::Kind::Literal,
|
||||
CXToken_Identifier => token::Kind::Identifier,
|
||||
CXToken_Keyword => token::Kind::Keyword,
|
||||
// NB: cexpr is not too happy about comments inside
|
||||
// expressions, so we strip them down here.
|
||||
CXToken_Comment => return None,
|
||||
_ => {
|
||||
panic!("Found unexpected token kind: {:?}", token.kind)
|
||||
}
|
||||
};
|
||||
|
||||
Some(token::Token {
|
||||
kind: kind,
|
||||
raw: token.spelling.into_bytes().into_boxed_slice(),
|
||||
Some(token::Token {
|
||||
kind: kind,
|
||||
raw: token.spelling.into_bytes().into_boxed_slice(),
|
||||
})
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>())
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ use ir::item_kind::ItemKind;
|
|||
use ir::layout::Layout;
|
||||
use ir::module::Module;
|
||||
use ir::objc::{ObjCInterface, ObjCMethod};
|
||||
use ir::template::{AsNamed, TemplateInstantiation, TemplateParameters};
|
||||
use ir::template::{AsTemplateParam, TemplateInstantiation, TemplateParameters};
|
||||
use ir::ty::{Type, TypeKind};
|
||||
use ir::var::Var;
|
||||
|
||||
|
@ -641,7 +641,7 @@ impl CodeGenerator for Type {
|
|||
if let Some(ref params) = used_template_params {
|
||||
for template_param in params {
|
||||
if let Some(id) =
|
||||
template_param.as_named(ctx, &()) {
|
||||
template_param.as_template_param(ctx, &()) {
|
||||
let template_param = ctx.resolve_type(id);
|
||||
if template_param.is_invalid_named_type() {
|
||||
warn!("Item contained invalid template \
|
||||
|
@ -1113,9 +1113,9 @@ impl Bitfield {
|
|||
#[inline]
|
||||
$fn_prefix $ctor_name($params $param_name : $bitfield_ty)
|
||||
-> $unit_field_int_ty {
|
||||
($body |
|
||||
(($param_name as $bitfield_int_ty as $unit_field_int_ty) << $offset) &
|
||||
($mask as $unit_field_int_ty))
|
||||
($body |
|
||||
(($param_name as $bitfield_int_ty as $unit_field_int_ty) << $offset) &
|
||||
($mask as $unit_field_int_ty))
|
||||
}
|
||||
}
|
||||
).unwrap()
|
||||
|
@ -1147,12 +1147,18 @@ impl<'a> FieldCodegen<'a> for BitfieldUnit {
|
|||
.build_ty(field_ty.clone());
|
||||
fields.extend(Some(field));
|
||||
|
||||
let unit_field_int_ty = match self.layout().size {
|
||||
let mut field_int_size = self.layout().size;
|
||||
if !field_int_size.is_power_of_two() {
|
||||
field_int_size = field_int_size.next_power_of_two();
|
||||
}
|
||||
|
||||
let unit_field_int_ty = match field_int_size {
|
||||
8 => quote_ty!(ctx.ext_cx(), u64),
|
||||
4 => quote_ty!(ctx.ext_cx(), u32),
|
||||
2 => quote_ty!(ctx.ext_cx(), u16),
|
||||
1 => quote_ty!(ctx.ext_cx(), u8),
|
||||
_ => {
|
||||
size => {
|
||||
debug_assert!(size > 8);
|
||||
// Can't generate bitfield accessors for unit sizes larget than
|
||||
// 64 bits at the moment.
|
||||
struct_layout.saw_bitfield_unit(self.layout());
|
||||
|
@ -1273,17 +1279,26 @@ impl<'a> FieldCodegen<'a> for Bitfield {
|
|||
let bitfield_ty = bitfield_ty.to_rust_ty_or_opaque(ctx, bitfield_ty_item);
|
||||
|
||||
let offset = self.offset_into_unit();
|
||||
let mask: usize = self.mask();
|
||||
let mask = self.mask();
|
||||
|
||||
let impl_item = quote_item!(
|
||||
ctx.ext_cx(),
|
||||
impl XxxIgnored {
|
||||
#[inline]
|
||||
pub fn $getter_name(&self) -> $bitfield_ty {
|
||||
let mask = $mask as $unit_field_int_ty;
|
||||
let unit_field_val: $unit_field_int_ty = unsafe {
|
||||
::$prefix::mem::transmute(self.$unit_field_ident)
|
||||
let mut unit_field_val: $unit_field_int_ty = unsafe {
|
||||
::$prefix::mem::uninitialized()
|
||||
};
|
||||
|
||||
unsafe {
|
||||
::$prefix::ptr::copy_nonoverlapping(
|
||||
&self.$unit_field_ident as *const _ as *const u8,
|
||||
&mut unit_field_val as *mut $unit_field_int_ty as *mut u8,
|
||||
::$prefix::mem::size_of::<$unit_field_int_ty>(),
|
||||
)
|
||||
};
|
||||
|
||||
let mask = $mask as $unit_field_int_ty;
|
||||
let val = (unit_field_val & mask) >> $offset;
|
||||
unsafe {
|
||||
::$prefix::mem::transmute(val as $bitfield_int_ty)
|
||||
|
@ -1296,14 +1311,27 @@ impl<'a> FieldCodegen<'a> for Bitfield {
|
|||
let val = val as $bitfield_int_ty as $unit_field_int_ty;
|
||||
|
||||
let mut unit_field_val: $unit_field_int_ty = unsafe {
|
||||
::$prefix::mem::transmute(self.$unit_field_ident)
|
||||
::$prefix::mem::uninitialized()
|
||||
};
|
||||
|
||||
unsafe {
|
||||
::$prefix::ptr::copy_nonoverlapping(
|
||||
&self.$unit_field_ident as *const _ as *const u8,
|
||||
&mut unit_field_val as *mut $unit_field_int_ty as *mut u8,
|
||||
::$prefix::mem::size_of::<$unit_field_int_ty>(),
|
||||
)
|
||||
};
|
||||
|
||||
unit_field_val &= !mask;
|
||||
unit_field_val |= (val << $offset) & mask;
|
||||
|
||||
self.$unit_field_ident = unsafe {
|
||||
::$prefix::mem::transmute(unit_field_val)
|
||||
};
|
||||
unsafe {
|
||||
::$prefix::ptr::copy_nonoverlapping(
|
||||
&unit_field_val as *const _ as *const u8,
|
||||
&mut self.$unit_field_ident as *mut _ as *mut u8,
|
||||
::$prefix::mem::size_of::<$unit_field_int_ty>(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
).unwrap();
|
||||
|
@ -2264,7 +2292,8 @@ impl CodeGenerator for Enum {
|
|||
builder = builder.with_attr(derives);
|
||||
}
|
||||
|
||||
fn add_constant<'a>(enum_: &Type,
|
||||
fn add_constant<'a>(ctx: &BindgenContext,
|
||||
enum_: &Type,
|
||||
// Only to avoid recomputing every time.
|
||||
enum_canonical_name: &str,
|
||||
// May be the same as "variant" if it's because the
|
||||
|
@ -2275,7 +2304,11 @@ impl CodeGenerator for Enum {
|
|||
enum_rust_ty: P<ast::Ty>,
|
||||
result: &mut CodegenResult<'a>) {
|
||||
let constant_name = if enum_.name().is_some() {
|
||||
format!("{}_{}", enum_canonical_name, variant_name)
|
||||
if ctx.options().prepend_enum_name {
|
||||
format!("{}_{}", enum_canonical_name, variant_name)
|
||||
} else {
|
||||
variant_name.into()
|
||||
}
|
||||
} else {
|
||||
variant_name.into()
|
||||
};
|
||||
|
@ -2358,7 +2391,8 @@ impl CodeGenerator for Enum {
|
|||
};
|
||||
|
||||
let existing_variant_name = entry.get();
|
||||
add_constant(enum_ty,
|
||||
add_constant(ctx,
|
||||
enum_ty,
|
||||
&name,
|
||||
&*mangled_name,
|
||||
existing_variant_name,
|
||||
|
@ -2397,7 +2431,8 @@ impl CodeGenerator for Enum {
|
|||
variant_name))
|
||||
};
|
||||
|
||||
add_constant(enum_ty,
|
||||
add_constant(ctx,
|
||||
enum_ty,
|
||||
&name,
|
||||
&mangled_name,
|
||||
&variant_name,
|
||||
|
@ -2709,7 +2744,7 @@ impl TryToRustTy for Type {
|
|||
let template_params = item.used_template_params(ctx)
|
||||
.unwrap_or(vec![])
|
||||
.into_iter()
|
||||
.filter(|param| param.is_named(ctx, &()))
|
||||
.filter(|param| param.is_template_param(ctx, &()))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let spelling = self.name().expect("Unnamed alias?");
|
||||
|
|
|
@ -293,18 +293,15 @@ impl Bitfield {
|
|||
|
||||
/// Get the mask value that when &'ed with this bitfield's allocation unit
|
||||
/// produces this bitfield's value.
|
||||
///
|
||||
/// TODO(emilio): This should probably use the target's word size, and what
|
||||
/// about bitfields that are bigger than that?
|
||||
pub fn mask(&self) -> usize {
|
||||
pub fn mask(&self) -> u64 {
|
||||
use std::mem;
|
||||
use std::usize;
|
||||
use std::u64;
|
||||
|
||||
let unoffseted_mask =
|
||||
if self.width() as usize == mem::size_of::<usize>() * 8 {
|
||||
usize::MAX
|
||||
if self.width() as u64 == mem::size_of::<u64>() as u64 * 8 {
|
||||
u64::MAX
|
||||
} else {
|
||||
((1usize << self.width()) - 1usize)
|
||||
((1u64 << self.width()) - 1u64)
|
||||
};
|
||||
|
||||
unoffseted_mask << self.offset_into_unit()
|
||||
|
@ -488,8 +485,9 @@ fn bitfields_to_allocation_units<E, I>(ctx: &BindgenContext,
|
|||
where E: Extend<Field>
|
||||
{
|
||||
*bitfield_unit_count += 1;
|
||||
let layout = Layout::new(bytes_from_bits_pow2(unit_size_in_bits),
|
||||
bytes_from_bits_pow2(unit_align_in_bits));
|
||||
let align = bytes_from_bits_pow2(unit_align_in_bits);
|
||||
let size = align_to(unit_size_in_bits, align * 8) / 8;
|
||||
let layout = Layout::new(size, align);
|
||||
fields.extend(Some(Field::Bitfields(BitfieldUnit {
|
||||
nth: *bitfield_unit_count,
|
||||
layout: layout,
|
||||
|
|
|
@ -139,9 +139,6 @@ pub struct BindgenContext<'ctx> {
|
|||
/// The active replacements collected from replaces="xxx" annotations.
|
||||
replacements: HashMap<Vec<String>, ItemId>,
|
||||
|
||||
/// The target string bindgen was able to deduce from the input.
|
||||
effective_target: String,
|
||||
|
||||
collected_typerefs: bool,
|
||||
|
||||
/// Dummy structures for code generation.
|
||||
|
@ -168,6 +165,9 @@ pub struct BindgenContext<'ctx> {
|
|||
/// The set of `TypeKind::Comp` items found during parsing that need their
|
||||
/// bitfield allocation units computed. Drained in `compute_bitfield_units`.
|
||||
need_bitfield_allocation: Vec<ItemId>,
|
||||
|
||||
/// Whether we need the mangling hack which removes the prefixing underscore.
|
||||
needs_mangling_hack: bool,
|
||||
}
|
||||
|
||||
/// A traversal of whitelisted items.
|
||||
|
@ -261,6 +261,16 @@ impl<'ctx> BindgenContext<'ctx> {
|
|||
effective_target = Some(HOST_TARGET.to_owned());
|
||||
}
|
||||
|
||||
// Mac os and Win32 need __ for mangled symbols but rust will automatically
|
||||
// prepend the extra _.
|
||||
//
|
||||
// We need to make sure that we don't include __ because rust will turn into
|
||||
// ___.
|
||||
let effective_target = effective_target.unwrap();
|
||||
let needs_mangling_hack =
|
||||
effective_target.contains("darwin") ||
|
||||
effective_target == "i686-pc-win32";
|
||||
|
||||
let root_module = Self::build_root_module(ItemId(0));
|
||||
let mut me = BindgenContext {
|
||||
items: Default::default(),
|
||||
|
@ -273,7 +283,6 @@ impl<'ctx> BindgenContext<'ctx> {
|
|||
currently_parsed_types: vec![],
|
||||
parsed_macros: Default::default(),
|
||||
replacements: Default::default(),
|
||||
effective_target: effective_target.unwrap(),
|
||||
collected_typerefs: false,
|
||||
gen_ctx: None,
|
||||
span: DUMMY_SP,
|
||||
|
@ -283,6 +292,7 @@ impl<'ctx> BindgenContext<'ctx> {
|
|||
generated_bindegen_complex: Cell::new(false),
|
||||
used_template_parameters: None,
|
||||
need_bitfield_allocation: Default::default(),
|
||||
needs_mangling_hack: needs_mangling_hack,
|
||||
};
|
||||
|
||||
me.add_item(root_module, None, None);
|
||||
|
@ -795,8 +805,8 @@ impl<'ctx> BindgenContext<'ctx> {
|
|||
}
|
||||
|
||||
/// Returns the target triple bindgen is running over.
|
||||
pub fn target(&self) -> &str {
|
||||
&self.effective_target
|
||||
pub fn needs_mangling_hack(&self) -> bool {
|
||||
self.needs_mangling_hack
|
||||
}
|
||||
|
||||
/// Get the root module.
|
||||
|
|
|
@ -128,16 +128,8 @@ fn get_abi(cc: CXCallingConv) -> Abi {
|
|||
})
|
||||
}
|
||||
|
||||
// Mac os and Win32 need __ for mangled symbols but rust will automatically
|
||||
// prepend the extra _.
|
||||
//
|
||||
// We need to make sure that we don't include __ because rust will turn into
|
||||
// ___.
|
||||
fn mangling_hack_if_needed(ctx: &BindgenContext, symbol: &mut String) {
|
||||
// NB: win64 also contains the substring "win32" in the target triple, so
|
||||
// we need to actually check for i686...
|
||||
if ctx.target().contains("darwin") ||
|
||||
(ctx.target().contains("i686") && ctx.target().contains("windows")) {
|
||||
if ctx.needs_mangling_hack() {
|
||||
symbol.remove(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use super::function::Function;
|
|||
use super::item_kind::ItemKind;
|
||||
use super::layout::Opaque;
|
||||
use super::module::Module;
|
||||
use super::template::{AsNamed, TemplateParameters};
|
||||
use super::template::{AsTemplateParam, TemplateParameters};
|
||||
use super::traversal::{EdgeKind, Trace, Tracer};
|
||||
use super::ty::{Type, TypeKind};
|
||||
use clang;
|
||||
|
@ -131,28 +131,28 @@ impl<'a, 'b> Iterator for ItemAncestorsIter<'a, 'b>
|
|||
}
|
||||
}
|
||||
|
||||
impl AsNamed for ItemId {
|
||||
impl AsTemplateParam for ItemId {
|
||||
type Extra = ();
|
||||
|
||||
fn as_named(&self, ctx: &BindgenContext, _: &()) -> Option<ItemId> {
|
||||
ctx.resolve_item(*self).as_named(ctx, &())
|
||||
fn as_template_param(&self, ctx: &BindgenContext, _: &()) -> Option<ItemId> {
|
||||
ctx.resolve_item(*self).as_template_param(ctx, &())
|
||||
}
|
||||
}
|
||||
|
||||
impl AsNamed for Item {
|
||||
impl AsTemplateParam for Item {
|
||||
type Extra = ();
|
||||
|
||||
fn as_named(&self, ctx: &BindgenContext, _: &()) -> Option<ItemId> {
|
||||
self.kind.as_named(ctx, self)
|
||||
fn as_template_param(&self, ctx: &BindgenContext, _: &()) -> Option<ItemId> {
|
||||
self.kind.as_template_param(ctx, self)
|
||||
}
|
||||
}
|
||||
|
||||
impl AsNamed for ItemKind {
|
||||
impl AsTemplateParam for ItemKind {
|
||||
type Extra = Item;
|
||||
|
||||
fn as_named(&self, ctx: &BindgenContext, item: &Item) -> Option<ItemId> {
|
||||
fn as_template_param(&self, ctx: &BindgenContext, item: &Item) -> Option<ItemId> {
|
||||
match *self {
|
||||
ItemKind::Type(ref ty) => ty.as_named(ctx, item),
|
||||
ItemKind::Type(ref ty) => ty.as_template_param(ctx, item),
|
||||
ItemKind::Module(..) |
|
||||
ItemKind::Function(..) |
|
||||
ItemKind::Var(..) => None,
|
||||
|
@ -756,7 +756,7 @@ impl Item {
|
|||
|
||||
// Named template type arguments are never namespaced, and never
|
||||
// mangled.
|
||||
if target.is_named(ctx, &()) {
|
||||
if target.is_template_param(ctx, &()) {
|
||||
return base_name;
|
||||
}
|
||||
|
||||
|
|
|
@ -176,19 +176,19 @@ pub trait TemplateParameters {
|
|||
}
|
||||
|
||||
/// A trait for things which may or may not be a named template type parameter.
|
||||
pub trait AsNamed {
|
||||
pub trait AsTemplateParam {
|
||||
/// Any extra information the implementor might need to make this decision.
|
||||
type Extra;
|
||||
|
||||
/// Convert this thing to the item id of a named template type parameter.
|
||||
fn as_named(&self,
|
||||
ctx: &BindgenContext,
|
||||
extra: &Self::Extra)
|
||||
-> Option<ItemId>;
|
||||
fn as_template_param(&self,
|
||||
ctx: &BindgenContext,
|
||||
extra: &Self::Extra)
|
||||
-> Option<ItemId>;
|
||||
|
||||
/// Is this a named template type parameter?
|
||||
fn is_named(&self, ctx: &BindgenContext, extra: &Self::Extra) -> bool {
|
||||
self.as_named(ctx, extra).is_some()
|
||||
fn is_template_param(&self, ctx: &BindgenContext, extra: &Self::Extra) -> bool {
|
||||
self.as_template_param(ctx, extra).is_some()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use super::int::IntKind;
|
|||
use super::item::Item;
|
||||
use super::layout::{Layout, Opaque};
|
||||
use super::objc::ObjCInterface;
|
||||
use super::template::{AsNamed, TemplateInstantiation, TemplateParameters};
|
||||
use super::template::{AsTemplateParam, TemplateInstantiation, TemplateParameters};
|
||||
use super::traversal::{EdgeKind, Trace, Tracer};
|
||||
use clang::{self, Cursor};
|
||||
use parse::{ClangItemParser, ParseError, ParseResult};
|
||||
|
@ -374,21 +374,21 @@ impl Type {
|
|||
}
|
||||
}
|
||||
|
||||
impl AsNamed for Type {
|
||||
impl AsTemplateParam for Type {
|
||||
type Extra = Item;
|
||||
|
||||
fn as_named(&self, ctx: &BindgenContext, item: &Item) -> Option<ItemId> {
|
||||
self.kind.as_named(ctx, item)
|
||||
fn as_template_param(&self, ctx: &BindgenContext, item: &Item) -> Option<ItemId> {
|
||||
self.kind.as_template_param(ctx, item)
|
||||
}
|
||||
}
|
||||
|
||||
impl AsNamed for TypeKind {
|
||||
impl AsTemplateParam for TypeKind {
|
||||
type Extra = Item;
|
||||
|
||||
fn as_named(&self, ctx: &BindgenContext, item: &Item) -> Option<ItemId> {
|
||||
fn as_template_param(&self, ctx: &BindgenContext, item: &Item) -> Option<ItemId> {
|
||||
match *self {
|
||||
TypeKind::Named => Some(item.id()),
|
||||
TypeKind::ResolvedTypeRef(id) => id.as_named(ctx, &()),
|
||||
TypeKind::ResolvedTypeRef(id) => id.as_template_param(ctx, &()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -284,17 +284,35 @@ fn parse_macro(ctx: &BindgenContext,
|
|||
-> Option<(Vec<u8>, cexpr::expr::EvalResult)> {
|
||||
use cexpr::{expr, nom};
|
||||
|
||||
let cexpr_tokens = match unit.cexpr_tokens(cursor) {
|
||||
let mut cexpr_tokens = match unit.cexpr_tokens(cursor) {
|
||||
None => return None,
|
||||
Some(tokens) => tokens,
|
||||
};
|
||||
|
||||
let parser = expr::IdentifierParser::new(ctx.parsed_macros());
|
||||
let result = parser.macro_definition(&cexpr_tokens);
|
||||
|
||||
match result {
|
||||
nom::IResult::Done(_, (id, val)) => Some((id.into(), val)),
|
||||
_ => None,
|
||||
match parser.macro_definition(&cexpr_tokens) {
|
||||
nom::IResult::Done(_, (id, val)) => {
|
||||
return Some((id.into(), val));
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// Try without the last token, to workaround a libclang bug in versions
|
||||
// previous to 4.0.
|
||||
//
|
||||
// See:
|
||||
// https://bugs.llvm.org//show_bug.cgi?id=9069
|
||||
// https://reviews.llvm.org/D26446
|
||||
if cexpr_tokens.pop().is_none() {
|
||||
return None;
|
||||
}
|
||||
|
||||
match parser.macro_definition(&cexpr_tokens) {
|
||||
nom::IResult::Done(_, (id, val)) => {
|
||||
Some((id.into(), val))
|
||||
}
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ impl Builder {
|
|||
}
|
||||
|
||||
if !self.options.unstable_rust {
|
||||
output_vector.push("--no-unstable-rust".into());
|
||||
output_vector.push("--unstable-rust".into());
|
||||
}
|
||||
|
||||
self.options
|
||||
|
@ -736,8 +736,8 @@ impl Builder {
|
|||
}
|
||||
|
||||
/// Avoid generating any unstable Rust, such as Rust unions, in the generated bindings.
|
||||
pub fn no_unstable_rust(mut self) -> Builder {
|
||||
self.options.unstable_rust = false;
|
||||
pub fn unstable_rust(mut self, doit: bool) -> Self {
|
||||
self.options.unstable_rust = doit;
|
||||
self
|
||||
}
|
||||
|
||||
|
@ -959,7 +959,7 @@ impl Default for BindgenOptions {
|
|||
derive_default: false,
|
||||
enable_cxx_namespaces: false,
|
||||
disable_name_namespacing: false,
|
||||
unstable_rust: true,
|
||||
unstable_rust: false,
|
||||
use_core: false,
|
||||
ctypes_prefix: None,
|
||||
namespaced_constants: true,
|
||||
|
|
|
@ -135,9 +135,9 @@ pub fn builder_from_flags<I>
|
|||
Arg::with_name("no-prepend-enum-name")
|
||||
.long("no-prepend-enum-name")
|
||||
.help("Do not prepend the enum name to bitfield or constant variants."),
|
||||
Arg::with_name("no-unstable-rust")
|
||||
.long("no-unstable-rust")
|
||||
.help("Do not generate unstable Rust code.")
|
||||
Arg::with_name("unstable-rust")
|
||||
.long("unstable-rust")
|
||||
.help("Generate unstable Rust code.")
|
||||
.multiple(true), // FIXME: Pass legacy test suite
|
||||
Arg::with_name("opaque-type")
|
||||
.long("opaque-type")
|
||||
|
@ -325,8 +325,8 @@ pub fn builder_from_flags<I>
|
|||
builder = builder.ignore_methods();
|
||||
}
|
||||
|
||||
if matches.is_present("no-unstable-rust") {
|
||||
builder = builder.no_unstable_rust();
|
||||
if matches.is_present("unstable-rust") {
|
||||
builder = builder.unstable_rust(true);
|
||||
}
|
||||
|
||||
if matches.is_present("no-convert-floats") {
|
||||
|
|
|
@ -175,24 +175,22 @@ function* query(detailsIn, props, context) {
|
|||
// We can use getCookiesFromHost for faster searching.
|
||||
let enumerator;
|
||||
let uri;
|
||||
let originAttributes = {
|
||||
userContextId,
|
||||
privateBrowsingId: isPrivate ? 1 : 0,
|
||||
};
|
||||
if ("url" in details) {
|
||||
try {
|
||||
uri = NetUtil.newURI(details.url).QueryInterface(Ci.nsIURL);
|
||||
Services.cookies.usePrivateMode(isPrivate, () => {
|
||||
enumerator = Services.cookies.getCookiesFromHost(uri.host, {userContextId});
|
||||
});
|
||||
enumerator = Services.cookies.getCookiesFromHost(uri.host, originAttributes);
|
||||
} catch (ex) {
|
||||
// This often happens for about: URLs
|
||||
return;
|
||||
}
|
||||
} else if ("domain" in details) {
|
||||
Services.cookies.usePrivateMode(isPrivate, () => {
|
||||
enumerator = Services.cookies.getCookiesFromHost(details.domain, {userContextId});
|
||||
});
|
||||
enumerator = Services.cookies.getCookiesFromHost(details.domain, originAttributes);
|
||||
} else {
|
||||
Services.cookies.usePrivateMode(isPrivate, () => {
|
||||
enumerator = Services.cookies.enumerator;
|
||||
});
|
||||
enumerator = Services.cookies.getCookiesWithOriginAttributes(JSON.stringify(originAttributes));
|
||||
}
|
||||
|
||||
// Based on nsCookieService::GetCookieStringInternal
|
||||
|
@ -238,10 +236,6 @@ function* query(detailsIn, props, context) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (userContextId != cookie.originAttributes.userContextId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// "Restricts the retrieved cookies to those whose domains match or are subdomains of this one."
|
||||
if ("domain" in details && !isSubdomain(cookie.rawHost, details.domain)) {
|
||||
return false;
|
||||
|
@ -340,21 +334,22 @@ this.cookies = class extends ExtensionAPI {
|
|||
return Promise.reject({message: `Permission denied to set cookie ${JSON.stringify(details)}`});
|
||||
}
|
||||
|
||||
let originAttributes = {
|
||||
userContextId,
|
||||
privateBrowsingId: isPrivate ? 1 : 0,
|
||||
};
|
||||
|
||||
// The permission check may have modified the domain, so use
|
||||
// the new value instead.
|
||||
Services.cookies.usePrivateMode(isPrivate, () => {
|
||||
Services.cookies.add(cookieAttrs.host, path, name, value,
|
||||
secure, httpOnly, isSession, expiry, {userContextId});
|
||||
});
|
||||
Services.cookies.add(cookieAttrs.host, path, name, value,
|
||||
secure, httpOnly, isSession, expiry, originAttributes);
|
||||
|
||||
return self.cookies.get(details);
|
||||
},
|
||||
|
||||
remove: function(details) {
|
||||
for (let {cookie, isPrivate, storeId} of query(details, ["url", "name", "storeId"], context)) {
|
||||
Services.cookies.usePrivateMode(isPrivate, () => {
|
||||
Services.cookies.remove(cookie.host, cookie.name, cookie.path, false, cookie.originAttributes);
|
||||
});
|
||||
for (let {cookie, storeId} of query(details, ["url", "name", "storeId"], context)) {
|
||||
Services.cookies.remove(cookie.host, cookie.name, cookie.path, false, cookie.originAttributes);
|
||||
|
||||
// Todo: could there be multiple per subdomain?
|
||||
return Promise.resolve({
|
||||
|
|
|
@ -23,6 +23,40 @@ add_task(async function test_cookies() {
|
|||
browser.test.assertEq(Object.keys(expected).length, Object.keys(cookie).length, "all expected properties found");
|
||||
}
|
||||
|
||||
async function getDocumentCookie(tabId) {
|
||||
let results = await browser.tabs.executeScript(tabId, {
|
||||
code: "document.cookie",
|
||||
});
|
||||
browser.test.assertEq(results.length, 1, "executeScript returns one result");
|
||||
return results[0];
|
||||
}
|
||||
|
||||
async function openPrivateWindowAndTab(TEST_URL) {
|
||||
// Add some random suffix to make sure that we select the right tab.
|
||||
const PRIVATE_TEST_URL = TEST_URL + "?random" + Math.random();
|
||||
|
||||
let tabReadyPromise = new Promise((resolve) => {
|
||||
browser.webNavigation.onDOMContentLoaded.addListener(function listener({tabId}) {
|
||||
browser.webNavigation.onDOMContentLoaded.removeListener(listener);
|
||||
resolve(tabId);
|
||||
}, {
|
||||
url: [{
|
||||
urlPrefix: PRIVATE_TEST_URL,
|
||||
}],
|
||||
});
|
||||
});
|
||||
// This tab is opened for two purposes:
|
||||
// 1. To allow tests to run content scripts in the context of a tab,
|
||||
// for fetching the value of document.cookie.
|
||||
// 2. To work around bug 1309637, based on the analysis in comment 8.
|
||||
let {id: windowId} = await browser.windows.create({
|
||||
incognito: true,
|
||||
url: PRIVATE_TEST_URL,
|
||||
});
|
||||
let tabId = await tabReadyPromise;
|
||||
return {windowId, tabId};
|
||||
}
|
||||
|
||||
const TEST_URL = "http://example.org/";
|
||||
const TEST_SECURE_URL = "https://example.org/";
|
||||
const THE_FUTURE = Date.now() + 5 * 60;
|
||||
|
@ -88,9 +122,9 @@ add_task(async function test_cookies() {
|
|||
browser.test.assertEq(1, stores[0].tabIds.length, "one tabId returned for store");
|
||||
browser.test.assertEq("number", typeof stores[0].tabIds[0], "tabId is a number");
|
||||
|
||||
// This part causes intermittent failures see Bug 1309637.
|
||||
if (false) {
|
||||
let privateWindow = await browser.windows.create({incognito: true});
|
||||
// Opening private windows/tabs is not supported on Android - bug 1372178
|
||||
if (browser.windows) {
|
||||
let {windowId} = await openPrivateWindowAndTab(TEST_URL);
|
||||
let stores = await browser.cookies.getAllCookieStores();
|
||||
|
||||
browser.test.assertEq(2, stores.length, "expected number of stores returned");
|
||||
|
@ -99,7 +133,7 @@ add_task(async function test_cookies() {
|
|||
browser.test.assertEq(PRIVATE_STORE_ID, stores[1].id, "expected private store id returned");
|
||||
browser.test.assertEq(1, stores[0].tabIds.length, "one tab returned for private store");
|
||||
|
||||
await browser.windows.remove(privateWindow.id);
|
||||
await browser.windows.remove(windowId);
|
||||
}
|
||||
|
||||
cookie = await browser.cookies.set({url: TEST_URL, name: "name2", domain: ".example.org", expirationDate: THE_FUTURE});
|
||||
|
@ -180,12 +214,11 @@ add_task(async function test_cookies() {
|
|||
browser.test.assertEq("", cookie.value, "default value set");
|
||||
browser.test.assertEq(true, cookie.session, "no expiry date created session cookie");
|
||||
|
||||
// This part causes intermittent failures see Bug 1309637.
|
||||
if (false) {
|
||||
let privateWindow = await browser.windows.create({incognito: true});
|
||||
// Opening private windows/tabs is not supported on Android - bug 1372178
|
||||
if (browser.windows) {
|
||||
let {tabId, windowId} = await openPrivateWindowAndTab(TEST_URL);
|
||||
|
||||
// Hacky work-around for bugzil.la/1309637
|
||||
await new Promise(resolve => setTimeout(resolve, 700));
|
||||
browser.test.assertEq("", await getDocumentCookie(tabId), "initially no cookie");
|
||||
|
||||
let cookie = await browser.cookies.set({url: TEST_URL, name: "store", value: "private", expirationDate: THE_FUTURE, storeId: PRIVATE_STORE_ID});
|
||||
browser.test.assertEq("private", cookie.value, "set the private cookie");
|
||||
|
@ -201,6 +234,8 @@ add_task(async function test_cookies() {
|
|||
browser.test.assertEq("default", cookie.value, "get the default cookie");
|
||||
browser.test.assertEq(STORE_ID, cookie.storeId, "get the default cookie storeId");
|
||||
|
||||
browser.test.assertEq("store=private", await getDocumentCookie(tabId), "private document.cookie should be set");
|
||||
|
||||
let details = await browser.cookies.remove({url: TEST_URL, name: "store", storeId: STORE_ID});
|
||||
assertExpected({url: TEST_URL, name: "store", storeId: STORE_ID}, details);
|
||||
|
||||
|
@ -213,7 +248,9 @@ add_task(async function test_cookies() {
|
|||
cookie = await browser.cookies.get({url: TEST_URL, name: "store", storeId: PRIVATE_STORE_ID});
|
||||
browser.test.assertEq(null, cookie, "deleted the private cookie");
|
||||
|
||||
await browser.windows.remove(privateWindow.id);
|
||||
browser.test.assertEq("", await getDocumentCookie(tabId), "private document.cookie should be removed");
|
||||
|
||||
await browser.windows.remove(windowId);
|
||||
}
|
||||
|
||||
browser.test.notifyPass("cookies");
|
||||
|
@ -222,7 +259,7 @@ add_task(async function test_cookies() {
|
|||
let extension = ExtensionTestUtils.loadExtension({
|
||||
background,
|
||||
manifest: {
|
||||
permissions: ["cookies", "*://example.org/"],
|
||||
permissions: ["cookies", "*://example.org/", "webNavigation"],
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -415,25 +415,23 @@ var TelemetryScheduler = {
|
|||
case "active":
|
||||
// User is back to work, restore the original tick interval.
|
||||
this._isUserIdle = false;
|
||||
return this._onSchedulerTick(true);
|
||||
return this._onSchedulerTick();
|
||||
case "wake_notification":
|
||||
// The machine woke up from sleep, trigger a tick to avoid sessions
|
||||
// spanning more than a day.
|
||||
// This is needed because sleep time does not count towards timeouts
|
||||
// on Mac & Linux - see bug 1262386, bug 1204823 et al.
|
||||
return this._onSchedulerTick(true);
|
||||
return this._onSchedulerTick();
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
|
||||
/**
|
||||
* Performs a scheduler tick. This function manages Telemetry recurring operations.
|
||||
* @param {Boolean} [dispatchOnIdle=false] If true, the tick is dispatched in the
|
||||
* next idle cycle of the main thread.
|
||||
* @return {Promise} A promise, only used when testing, resolved when the scheduled
|
||||
* operation completes.
|
||||
*/
|
||||
_onSchedulerTick(dispatchOnIdle = false) {
|
||||
_onSchedulerTick() {
|
||||
// This call might not be triggered from a timeout. In that case we don't want to
|
||||
// leave any previously scheduled timeouts pending.
|
||||
this._clearTimeout();
|
||||
|
@ -445,12 +443,7 @@ var TelemetryScheduler = {
|
|||
|
||||
let promise = Promise.resolve();
|
||||
try {
|
||||
if (dispatchOnIdle) {
|
||||
promise = new Promise((resolve, reject) =>
|
||||
Services.tm.mainThread.idleDispatch(() => this._schedulerTickLogic().then(resolve, reject)));
|
||||
} else {
|
||||
promise = this._schedulerTickLogic();
|
||||
}
|
||||
promise = this._schedulerTickLogic();
|
||||
} catch (e) {
|
||||
Telemetry.getHistogramById("TELEMETRY_SCHEDULER_TICK_EXCEPTION").add(1);
|
||||
this._log.error("_onSchedulerTick - There was an exception", e);
|
||||
|
|
|
@ -1870,10 +1870,9 @@ add_task(async function test_schedulerEnvironmentReschedules() {
|
|||
[PREF_TEST, {what: TelemetryEnvironment.RECORD_PREF_VALUE}],
|
||||
]);
|
||||
|
||||
await TelemetryController.testReset();
|
||||
await TelemetryController.testShutdown();
|
||||
await TelemetryStorage.testClearPendingPings();
|
||||
PingServer.clearRequests();
|
||||
await TelemetryController.testReset();
|
||||
|
||||
// Set a fake current date and start Telemetry.
|
||||
let nowDate = fakeNow(2060, 10, 18, 0, 0, 0);
|
||||
|
@ -2031,7 +2030,7 @@ add_task(async function test_schedulerUserIdle() {
|
|||
Assert.equal(schedulerTimeout, SCHEDULER_TICK_IDLE_INTERVAL_MS);
|
||||
|
||||
// Send an "active" notification to the scheduler.
|
||||
await fakeIdleNotification("active");
|
||||
fakeIdleNotification("active");
|
||||
|
||||
// When user is back active, the scheduler tick should be 5 minutes again.
|
||||
Assert.equal(schedulerTimeout, SCHEDULER_TICK_INTERVAL_MS);
|
||||
|
|
|
@ -400,13 +400,6 @@ this.SafeBrowsing = {
|
|||
const whitelistURL = "itisatrap.org/?resource=itisatracker.org";
|
||||
const blockedURL = "itisatrap.org/firefox/blocked.html";
|
||||
|
||||
const flashDenyURL = "flashblock.itisatrap.org/";
|
||||
const flashDenyExceptURL = "except.flashblock.itisatrap.org/";
|
||||
const flashAllowURL = "flashallow.itisatrap.org/";
|
||||
const flashAllowExceptURL = "except.flashallow.itisatrap.org/";
|
||||
const flashSubDocURL = "flashsubdoc.itisatrap.org/";
|
||||
const flashSubDocExceptURL = "except.flashsubdoc.itisatrap.org/";
|
||||
|
||||
let update = "n:1000\ni:test-malware-simple\nad:1\n" +
|
||||
"a:1:32:" + malwareURL.length + "\n" +
|
||||
malwareURL + "\n";
|
||||
|
@ -428,24 +421,6 @@ this.SafeBrowsing = {
|
|||
update += "n:1000\ni:test-block-simple\nad:1\n" +
|
||||
"a:1:32:" + blockedURL.length + "\n" +
|
||||
blockedURL;
|
||||
update += "n:1000\ni:test-flash-simple\nad:1\n" +
|
||||
"a:1:32:" + flashDenyURL.length + "\n" +
|
||||
flashDenyURL;
|
||||
update += "n:1000\ni:testexcept-flash-simple\nad:1\n" +
|
||||
"a:1:32:" + flashDenyExceptURL.length + "\n" +
|
||||
flashDenyExceptURL;
|
||||
update += "n:1000\ni:test-flashallow-simple\nad:1\n" +
|
||||
"a:1:32:" + flashAllowURL.length + "\n" +
|
||||
flashAllowURL;
|
||||
update += "n:1000\ni:testexcept-flashallow-simple\nad:1\n" +
|
||||
"a:1:32:" + flashAllowExceptURL.length + "\n" +
|
||||
flashAllowExceptURL;
|
||||
update += "n:1000\ni:test-flashsubdoc-simple\nad:1\n" +
|
||||
"a:1:32:" + flashSubDocURL.length + "\n" +
|
||||
flashSubDocURL;
|
||||
update += "n:1000\ni:testexcept-flashsubdoc-simple\nad:1\n" +
|
||||
"a:1:32:" + flashSubDocExceptURL.length + "\n" +
|
||||
flashSubDocExceptURL;
|
||||
log("addMozEntries:", update);
|
||||
|
||||
let db = Cc["@mozilla.org/url-classifier/dbservice;1"].
|
||||
|
@ -466,7 +441,7 @@ this.SafeBrowsing = {
|
|||
};
|
||||
|
||||
try {
|
||||
let tables = "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple,test-flash-simple,testexcept-flash-simple,test-flashallow-simple,testexcept-flashallow-simple,test-flashsubdoc-simple,testexcept-flashsubdoc-simple";
|
||||
let tables = "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple";
|
||||
db.beginUpdate(dummyListener, tables, "");
|
||||
db.beginStream("", "");
|
||||
db.updateStream(update);
|
||||
|
|
|
@ -9,6 +9,7 @@ var classifierTester = {
|
|||
IFRAME_ID: "testFrame",
|
||||
FLASHBLOCK_ENABLE_PREF: "plugins.flashBlock.enabled",
|
||||
FLASH_PLUGIN_USER_SETTING_PREF: "plugin.state.flash",
|
||||
URLCLASSIFIER_DISALLOW_COMPLETIONS_PREF: "urlclassifier.disallow_completions",
|
||||
NEVER_ACTIVATE_PREF_VALUE: 0,
|
||||
ASK_TO_ACTIVATE_PREF_VALUE: 1,
|
||||
ALWAYS_ACTIVATE_PREF_VALUE: 2,
|
||||
|
@ -38,21 +39,29 @@ var classifierTester = {
|
|||
{
|
||||
url: "subdocument.example.com/",
|
||||
db: "test-flashsubdoc-simple",
|
||||
pref: "urlclassifier.flashThirdPartyTable"
|
||||
pref: "urlclassifier.flashSubDocTable"
|
||||
},
|
||||
{
|
||||
url: "exception.subdocument.example.com/",
|
||||
db: "testexcept-flashsubdoc-simple",
|
||||
pref: "urlclassifier.flashThirdPartyExceptTable"
|
||||
pref: "urlclassifier.flashSubDocExceptTable"
|
||||
}
|
||||
],
|
||||
|
||||
setPrefs: function ({setDBs = true, flashBlockEnable = true, flashSetting = classifierTester.ALWAYS_ACTIVATE_PREF_VALUE} = {}) {
|
||||
if (setDBs) {
|
||||
let DBs = [];
|
||||
|
||||
for (let dbData of classifierTester.dbUrls) {
|
||||
Services.prefs.setCharPref(dbData.pref, dbData.db);
|
||||
DBs.push(dbData.db);
|
||||
}
|
||||
|
||||
let completions = Services.prefs.getCharPref(classifierTester.URLCLASSIFIER_DISALLOW_COMPLETIONS_PREF);
|
||||
completions += "," + DBs.join(",");
|
||||
Services.prefs.setCharPref(classifierTester.URLCLASSIFIER_DISALLOW_COMPLETIONS_PREF, completions);
|
||||
}
|
||||
|
||||
Services.prefs.setBoolPref(classifierTester.FLASHBLOCK_ENABLE_PREF,
|
||||
flashBlockEnable);
|
||||
Services.prefs.setIntPref(classifierTester.FLASH_PLUGIN_USER_SETTING_PREF,
|
||||
|
@ -64,6 +73,8 @@ var classifierTester = {
|
|||
for (let dbData of classifierTester.dbUrls) {
|
||||
Services.prefs.clearUserPref(dbData.pref);
|
||||
}
|
||||
|
||||
Services.prefs.clearUserPref(classifierTester.URLCLASSIFIER_DISALLOW_COMPLETIONS_PREF);
|
||||
Services.prefs.clearUserPref(classifierTester.FLASHBLOCK_ENABLE_PREF);
|
||||
Services.prefs.clearUserPref(classifierTester.FLASH_PLUGIN_USER_SETTING_PREF);
|
||||
Services.prefs.clearUserPref(classifierTester.ALLOW_CTA_PREF);
|
||||
|
|
|
@ -89,7 +89,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.25.5"
|
||||
version = "0.26.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -900,7 +900,7 @@ dependencies = [
|
|||
"arraydeque 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bindgen 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bindgen 0.26.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1238,7 +1238,7 @@ dependencies = [
|
|||
"checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159"
|
||||
"checksum binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88ceb0d16c4fd0e42876e298d7d3ce3780dd9ebdcbe4199816a32c77e08597ff"
|
||||
"checksum bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e103c8b299b28a9c6990458b7013dc4a8356a9b854c51b9883241f5866fac36e"
|
||||
"checksum bindgen 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)" = "cc7973dbc2990511877ad9e5e50a312f02fbbc9b356c30bb102307424fa73630"
|
||||
"checksum bindgen 0.26.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04488a91af8f15eec4d88eb59e2c4e982c03ff31582acf2f5623e2e6d8ae9e0b"
|
||||
"checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c"
|
||||
"checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d"
|
||||
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
|
||||
|
|
|
@ -87,7 +87,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.25.5"
|
||||
version = "0.26.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aster 0.41.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -887,7 +887,7 @@ dependencies = [
|
|||
"arraydeque 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bindgen 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bindgen 0.26.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1225,7 +1225,7 @@ dependencies = [
|
|||
"checksum atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d912da0db7fa85514874458ca3651fe2cddace8d0b0505571dbdcd41ab490159"
|
||||
"checksum binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88ceb0d16c4fd0e42876e298d7d3ce3780dd9ebdcbe4199816a32c77e08597ff"
|
||||
"checksum bincode 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e103c8b299b28a9c6990458b7013dc4a8356a9b854c51b9883241f5866fac36e"
|
||||
"checksum bindgen 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)" = "cc7973dbc2990511877ad9e5e50a312f02fbbc9b356c30bb102307424fa73630"
|
||||
"checksum bindgen 0.26.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04488a91af8f15eec4d88eb59e2c4e982c03ff31582acf2f5623e2e6d8ae9e0b"
|
||||
"checksum bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9bf6104718e80d7b26a68fdbacff3481cfc05df670821affc7e9cbc1884400c"
|
||||
"checksum bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5b97c2c8e8bbb4251754f559df8af22fb264853c7d009084a576cdf12565089d"
|
||||
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
|
||||
|
|
|
@ -150,9 +150,15 @@ module.exports = {
|
|||
// Use [] instead of Array()
|
||||
"no-array-constructor": "error",
|
||||
|
||||
// Disallow modifying variables of class declarations.
|
||||
"no-class-assign": "error",
|
||||
|
||||
// Disallow assignment operators in conditional statements
|
||||
"no-cond-assign": "error",
|
||||
|
||||
// Disallow modifying variables that are declared using const.
|
||||
"no-const-assign": "error",
|
||||
|
||||
// Disallow control characters in regular expressions.
|
||||
"no-control-regex": "error",
|
||||
|
||||
|
@ -165,6 +171,9 @@ module.exports = {
|
|||
// No duplicate arguments in function declarations
|
||||
"no-dupe-args": "error",
|
||||
|
||||
// Disallow duplicate class members.
|
||||
"no-dupe-class-members": "error",
|
||||
|
||||
// No duplicate keys in object declarations
|
||||
"no-dupe-keys": "error",
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче